Class: Vanagon::Common::User

Inherits:
Object
  • Object
show all
Defined in:
lib/vanagon/common/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, group = nil, shell = nil, is_system = false, homedir = nil) ⇒ User

Returns a new instance of User.



5
6
7
8
9
10
11
# File 'lib/vanagon/common/user.rb', line 5

def initialize(name, group = nil, shell = nil, is_system = false, homedir = nil)
  @name = name
  @group = group ? group : @name
  @shell = shell if shell
  @is_system = is_system if is_system
  @homedir = homedir if homedir
end

Instance Attribute Details

#groupObject

Returns the value of attribute group.



4
5
6
# File 'lib/vanagon/common/user.rb', line 4

def group
  @group
end

#homedirObject

Returns the value of attribute homedir.



4
5
6
# File 'lib/vanagon/common/user.rb', line 4

def homedir
  @homedir
end

#is_systemObject

Returns the value of attribute is_system.



4
5
6
# File 'lib/vanagon/common/user.rb', line 4

def is_system
  @is_system
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/vanagon/common/user.rb', line 4

def name
  @name
end

#shellObject

Returns the value of attribute shell.



4
5
6
# File 'lib/vanagon/common/user.rb', line 4

def shell
  @shell
end

Instance Method Details

#==(other) ⇒ true, false

Equality. How does it even work?

Returns:

  • (true, false)

    true if all attributes have equal values. false otherwise.



16
17
18
19
20
21
22
# File 'lib/vanagon/common/user.rb', line 16

def ==(other)
  other.name == self.name && \
    other.group == self.group && \
    other.shell == self.shell && \
    other.is_system == self.is_system && \
    other.homedir == self.homedir
end