Class: Opie::Failure

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/opie/failure.rb', line 3

def data
  @data
end

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

#hashObject



14
15
16
# File 'lib/opie/failure.rb', line 14

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