Sha256: 446562bc15eabd1126f6bc414e15cb3c61fe3c52e4f23bf8256e95a6f3591086

Contents?: true

Size: 443 Bytes

Versions: 3

Compression:

Stored size: 443 Bytes

Contents

class Knj::Sysuser
	def initialize(data)
		@data = data
	end
	
	def self.list(paras = {})
		cont = File.read("/etc/passwd")
		
		list = []
		cont.split("\n").each do |line|
			linearr = line.split(":")
			
			list << Knj::Sysuser.new(
				"nick" => linearr[0],
				"home" => linearr[5],
				"shell" => linearr[6]
			)
		end
		
		return list
	end
	
	def [](key)
		raise "No such key: " + key if !@data.has_key?(key)
		return @data[key]
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
knjrbfw-0.0.7 lib/knj/sysuser.rb
knjrbfw-0.0.4 lib/knj/sysuser.rb
knjrbfw-0.0.3 lib/knj/sysuser.rb