Class: Course::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/course/failure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/course/failure.rb', line 5

def data
  @data
end

#typeObject (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

#hashObject



16
17
18
# File 'lib/course/failure.rb', line 16

def hash
  [type, (data || '').to_sym].hash
end