Class: SolidService::State
- Inherits:
-
Object
- Object
- SolidService::State
show all
- Defined in:
- lib/solidservice/state.rb
Instance Method Summary
collapse
Constructor Details
#initialize(state = :success, data = {}) ⇒ State
Returns a new instance of State.
3
4
5
6
|
# File 'lib/solidservice/state.rb', line 3
def initialize(state = :success, data={})
@state = state || :success
@_data = (data || {}).with_indifferent_access
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key) ⇒ Object
16
17
18
|
# File 'lib/solidservice/state.rb', line 16
def method_missing(key)
@_data[key]
end
|
Instance Method Details
#fail? ⇒ Boolean
12
13
14
|
# File 'lib/solidservice/state.rb', line 12
def fail?
@state == :fail
end
|
#success? ⇒ Boolean
8
9
10
|
# File 'lib/solidservice/state.rb', line 8
def success?
@state == :success
end
|