Class: Opie::Failure
- Inherits:
-
Object
- Object
- Opie::Failure
- Defined in:
- lib/opie/failure.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(type, data = nil) ⇒ Failure
constructor
A new instance of Failure.
Constructor Details
#initialize(type, data = nil) ⇒ Failure
Returns a new instance of Failure.
5 6 7 8 |
# File 'lib/opie/failure.rb', line 5 def initialize(type, data = nil) @type = type @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/opie/failure.rb', line 3 def data @data end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/opie/failure.rb', line 3 def type @type end |
Instance Method Details
#==(other) ⇒ Object
10 11 12 |
# File 'lib/opie/failure.rb', line 10 def ==(other) type == other.type && data == other.data end |
#hash ⇒ Object
14 15 16 |
# File 'lib/opie/failure.rb', line 14 def hash [type, (data || '').to_sym].hash end |