Class: ERBB::Result
- Inherits:
-
String
- Object
- String
- ERBB::Result
- Defined in:
- lib/erbb/result.rb
Instance Attribute Summary collapse
-
#named_blocks ⇒ Object
readonly
Returns the value of attribute named_blocks.
Instance Method Summary collapse
-
#initialize(str, named_blocks, opts = {}) ⇒ Result
constructor
A new instance of Result.
- #method_missing(method_name) ⇒ Object
Constructor Details
#initialize(str, named_blocks, opts = {}) ⇒ Result
Returns a new instance of Result.
13 14 15 16 |
# File 'lib/erbb/result.rb', line 13 def initialize(str, named_blocks, opts = {}) super(str, *opts) @named_blocks = Hash[named_blocks.map { |k,v| [k.to_sym, v] }] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/erbb/result.rb', line 5 def method_missing(method_name) if named_blocks.key?(method_name) named_blocks[method_name] else super end end |
Instance Attribute Details
#named_blocks ⇒ Object (readonly)
Returns the value of attribute named_blocks.
3 4 5 |
# File 'lib/erbb/result.rb', line 3 def named_blocks @named_blocks end |