Class: Operation
- Inherits:
-
Object
- Object
- Operation
- Defined in:
- lib/operation.rb,
lib/operation/version.rb
Defined Under Namespace
Modules: VERSION
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(options = {}) ⇒ Operation
constructor
A new instance of Operation.
- #meta ⇒ Object
-
#object ⇒ Object
Convenience Wrapper.
- #success? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Operation
Returns a new instance of Operation.
8 9 10 11 12 |
# File 'lib/operation.rb', line 8 def initialize( = {}) @success = [true, 'true', 1, '1'].include? [:success] @code = [:code].to_s.to_sym unless [:code].to_s == '' @metadata = [:metadata] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/operation.rb', line 6 def code @code end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/operation.rb', line 6 def @metadata end |
Instance Method Details
#failure? ⇒ Boolean
18 19 20 |
# File 'lib/operation.rb', line 18 def failure? !success? end |
#meta ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/operation.rb', line 27 def if .respond_to? :each_pair Hashie::Mash.new elsif else Hashie::Mash.new end end |
#object ⇒ Object
Convenience Wrapper
23 24 25 |
# File 'lib/operation.rb', line 23 def object .object end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/operation.rb', line 14 def success? !!@success end |