Sha256: 2c4ca8ddba5fa1356a3aa9b3f758cd1ef72dafa42c5218bf4b368f5e3081b1a3

Contents?: true

Size: 491 Bytes

Versions: 101

Compression:

Stored size: 491 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.key?(key)
    return @data[key]
  end
end

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
knjrbfw-0.0.116 lib/knj/sysuser.rb
knjrbfw-0.0.115 lib/knj/sysuser.rb
knjrbfw-0.0.114 lib/knj/sysuser.rb
knjrbfw-0.0.113 lib/knj/sysuser.rb
knjrbfw-0.0.111 lib/knj/sysuser.rb
knjrbfw-0.0.110 lib/knj/sysuser.rb
knjrbfw-0.0.109 lib/knj/sysuser.rb
knjrbfw-0.0.108 lib/knj/sysuser.rb
knjrbfw-0.0.107 lib/knj/sysuser.rb
knjrbfw-0.0.105 lib/knj/sysuser.rb
knjrbfw-0.0.104 lib/knj/sysuser.rb
knjrbfw-0.0.103 lib/knj/sysuser.rb
knjrbfw-0.0.102 lib/knj/sysuser.rb
knjrbfw-0.0.101 lib/knj/sysuser.rb
knjrbfw-0.0.100 lib/knj/sysuser.rb
knjrbfw-0.0.99 lib/knj/sysuser.rb
knjrbfw-0.0.98 lib/knj/sysuser.rb
knjrbfw-0.0.97 lib/knj/sysuser.rb
knjrbfw-0.0.96 lib/knj/sysuser.rb
knjrbfw-0.0.95 lib/knj/sysuser.rb