passwd.cr/src/group.cr

25 lines
481 B
Crystal
Raw Normal View History

require "csv"
class Passwd::Group
property name : String
property password_hash : String
property gid : Int32
property users = Array(String).new
def initialize(@name, @password_hash, @gid, @users = [] of String)
end
def initialize(line : Array(String))
@name = line[0]
@password_hash = line[1]
@gid = line[2].to_i
@users = line[3].split ","
end
def to_csv
[@name, @password_hash, @gid, @users.join ","].join ":"
end
end