25 lines
473 B
Crystal
25 lines
473 B
Crystal
|
require "csv"
|
||
|
|
||
|
class Passwd::Group
|
||
|
getter name : String
|
||
|
getter password_hash : String
|
||
|
getter gid : Int32
|
||
|
getter 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
|
||
|
|