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.49 lib/knj/sysuser.rb
knjrbfw-0.0.48 lib/knj/sysuser.rb
knjrbfw-0.0.47 lib/knj/sysuser.rb
knjrbfw-0.0.46 lib/knj/sysuser.rb
knjrbfw-0.0.45 lib/knj/sysuser.rb
knjrbfw-0.0.44 lib/knj/sysuser.rb
knjrbfw-0.0.43 lib/knj/sysuser.rb
knjrbfw-0.0.42 lib/knj/sysuser.rb
knjrbfw-0.0.41 lib/knj/sysuser.rb
knjrbfw-0.0.40 lib/knj/sysuser.rb
knjrbfw-0.0.39 lib/knj/sysuser.rb
knjrbfw-0.0.38 lib/knj/sysuser.rb
knjrbfw-0.0.37 lib/knj/sysuser.rb
knjrbfw-0.0.36 lib/knj/sysuser.rb
knjrbfw-0.0.35 lib/knj/sysuser.rb
knjrbfw-0.0.34 lib/knj/sysuser.rb
knjrbfw-0.0.33 lib/knj/sysuser.rb
knjrbfw-0.0.32 lib/knj/sysuser.rb
knjrbfw-0.0.31 lib/knj/sysuser.rb
knjrbfw-0.0.30 lib/knj/sysuser.rb