Class: Course::Failure
- Inherits:
-
Object
- Object
- Course::Failure
- Defined in:
- lib/course/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.
7 8 9 10 |
# File 'lib/course/failure.rb', line 7 def initialize(type, data = nil) @type = type @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/course/failure.rb', line 5 def data @data end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/course/failure.rb', line 5 def type @type end |
Instance Method Details
#==(other) ⇒ Object
12 13 14 |
# File 'lib/course/failure.rb', line 12 def ==(other) type == other.type && data == other.data end |
#hash ⇒ Object
16 17 18 |
# File 'lib/course/failure.rb', line 16 def hash [type, (data || '').to_sym].hash end |