class OodSupport::Group
A helper object describing a Unix group's details
Attributes
id[R]
The id of the group @return [Integer] the group id
name[R]
The name of the group @return [String] the group name
Public Class Methods
new(group = Process.group)
click to toggle source
@param group [Integer, to_s
] the group id or name
# File lib/ood_support/group.rb, line 17 def initialize(group = Process.group) if group.is_a?(Integer) @id = group @name = Etc.getgrgid(@id).name else @name = group.to_s @id = Etc.getgrnam(@name).gid end end
Public Instance Methods
<=>(other)
click to toggle source
The comparison operator for sorting values @param other [#to_s] group to compare against @return [Integer] how groups compare
# File lib/ood_support/group.rb, line 30 def <=>(other) name <=> other end
eql?(other)
click to toggle source
hash()
click to toggle source
Generates a hash value for this object @return [Integer] hash value of object
# File lib/ood_support/group.rb, line 44 def hash [self.class, name].hash end
to_s()
click to toggle source
Convert object to string using group name as string value @return [String] the group name
# File lib/ood_support/group.rb, line 50 def to_s name end