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.29 lib/knj/sysuser.rb
knjrbfw-0.0.28 lib/knj/sysuser.rb
knjrbfw-0.0.27 lib/knj/sysuser.rb
knjrbfw-0.0.26 lib/knj/sysuser.rb
knjrbfw-0.0.25 lib/knj/sysuser.rb
knjrbfw-0.0.24 lib/knj/sysuser.rb
knjrbfw-0.0.23 lib/knj/sysuser.rb
knjrbfw-0.0.22 lib/knj/sysuser.rb
knjrbfw-0.0.21 lib/knj/sysuser.rb
knjrbfw-0.0.20 lib/knj/sysuser.rb
knjrbfw-0.0.19 lib/knj/sysuser.rb
knjrbfw-0.0.18 lib/knj/sysuser.rb
knjrbfw-0.0.17 lib/knj/sysuser.rb
knjrbfw-0.0.16 lib/knj/sysuser.rb
knjrbfw-0.0.15 lib/knj/sysuser.rb
knjrbfw-0.0.14 lib/knj/sysuser.rb
knjrbfw-0.0.13 lib/knj/sysuser.rb
knjrbfw-0.0.12 lib/knj/sysuser.rb
knjrbfw-0.0.11 lib/knj/sysuser.rb
knjrbfw-0.0.10 lib/knj/sysuser.rb