Class: WindowsError::HResult::Facility::FacilityCode

Inherits:
Struct
  • Object
show all
Defined in:
lib/windows_error/h_result/facility.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



7
8
9
# File 'lib/windows_error/h_result/facility.rb', line 7

def description
  @description
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



7
8
9
# File 'lib/windows_error/h_result/facility.rb', line 7

def name
  @name
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



7
8
9
# File 'lib/windows_error/h_result/facility.rb', line 7

def value
  @value
end

Instance Method Details

#==(other_object) ⇒ Object Also known as: ===



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/windows_error/h_result/facility.rb', line 8

def ==(other_object)
  if other_object.kind_of? self.class
    self.value == other_object.value
  elsif other_object.kind_of? Integer
    self.value == other_object
  elsif other_object.nil?
    false
  else
    raise ArgumentError, "Cannot compare a #{self.class} to a #{other_object.class}"
  end
end

#to_sObject



22
23
24
25
# File 'lib/windows_error/h_result/facility.rb', line 22

def to_s
  code = sprintf "%04x", self.value
  "(0x#{code}) #{self.name}: #{self.description}"
end