Class: Zx::Reflect
- Inherits:
-
Object
- Object
- Zx::Reflect
- Defined in:
- lib/zx/reflect.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
Returns the value of attribute result.
-
#tag ⇒ Object
Returns the value of attribute tag.
Class Method Summary collapse
Instance Method Summary collapse
- #apply(&block) ⇒ Object
-
#initialize(result, tag) ⇒ Reflect
constructor
A new instance of Reflect.
Constructor Details
#initialize(result, tag) ⇒ Reflect
Returns a new instance of Reflect.
7 8 9 10 |
# File 'lib/zx/reflect.rb', line 7 def initialize(result, tag) self.result = result self.tag = tag end |
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
5 6 7 |
# File 'lib/zx/reflect.rb', line 5 def result @result end |
#tag ⇒ Object
Returns the value of attribute tag.
5 6 7 |
# File 'lib/zx/reflect.rb', line 5 def tag @tag end |
Class Method Details
.apply(result, tag, &block) ⇒ Object
18 19 20 |
# File 'lib/zx/reflect.rb', line 18 def self.apply(result, tag, &block) new(result, tag).apply(&block) end |
Instance Method Details
#apply(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/zx/reflect.rb', line 12 def apply(&block) return block.call(result.value, [result.type, result.success?]) if tag.nil? block.call(result.value, [result.type, result.success?]) if result.type == tag.to_sym end |