Module: Tron::Resultable
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Class Method Summary collapse
Instance Method Summary collapse
- #code ⇒ Object
- #failure? ⇒ Boolean
- #initialize(code: nil, metadata: nil) ⇒ Object
- #meta ⇒ Object
-
#object ⇒ Object
Convenience Wrapper.
- #success? ⇒ Boolean
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/tron/resultable.rb', line 3 def @metadata end |
Class Method Details
.included(receiver) ⇒ Object
5 6 7 |
# File 'lib/tron/resultable.rb', line 5 def self.included(receiver) receiver.extend ::Tron::Resultable::ClassMethods end |
Instance Method Details
#code ⇒ Object
32 33 34 35 36 |
# File 'lib/tron/resultable.rb', line 32 def code return if @code.to_s == '' @code.to_s.to_sym end |
#failure? ⇒ Boolean
28 29 30 |
# File 'lib/tron/resultable.rb', line 28 def failure? is_a? ::Tron::Failure end |
#initialize(code: nil, metadata: nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/tron/resultable.rb', line 16 def initialize(code: nil, metadata: nil) @code = code @metadata = warn 'DEPRECATION WARNING: As of Tron 1.0.0 calls to `Tron::Success.call` and `Tron::Failure.call` are deprecated. ' \ 'They will be removed in Tron 2.0.0. Please migrate using `Tron.success` and `Tron.failure`. ' \ "See github.com/halo/tron Called in:: `#{caller[2]}`" end |
#meta ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/tron/resultable.rb', line 45 def if defined? ::Hashie::Mash else end end |
#object ⇒ Object
Convenience Wrapper
39 40 41 42 43 |
# File 'lib/tron/resultable.rb', line 39 def object [:object] || ['object'] rescue StandardError nil end |