Class: Cfruby::Users::UserInfo

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/libcfruby/users.rb

Overview

A holding object for information about a user. Currently implemented as a simple OpenStruct. Should provide accessor methods for as many of the following as possible (listed in order of importance):

username

username of the user (root)

uid

user id of the user (0)

gid

group id of he user (primary) (0)

fullname

full name of the user (Charlie Root)

shell

default shell assigned to the user

homedir

home directory of the user

Instance Method Summary collapse

Instance Method Details

#to_hashObject



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/libcfruby/users.rb', line 75

def to_hash()
	keyregex = /^([^=]+)=$/
	hash = Hash.new()
	self.methods.each() { |pkey|
		match = keyregex.match(pkey)
		if(match)
			hash[match[1]] = self.send(match[1].to_sym)
		end
	}
	
	return(hash)
end

#to_sObject



70
71
72
# File 'lib/libcfruby/users.rb', line 70

def to_s()
	return(self.username)
end