Class: Jasonette::Helpers::BlockBuilder
- Inherits:
-
Object
- Object
- Jasonette::Helpers::BlockBuilder
- Defined in:
- lib/jasonette/helpers.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
Instance Method Summary collapse
-
#initialize(builder) ⇒ BlockBuilder
constructor
A new instance of BlockBuilder.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(builder) ⇒ BlockBuilder
Returns a new instance of BlockBuilder.
16 17 18 |
# File 'lib/jasonette/helpers.rb', line 16 def initialize builder @builder = builder end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
20 21 22 23 24 |
# File 'lib/jasonette/helpers.rb', line 20 def method_missing name, *args, &block next_builder = builder.public_send name, *args j.encode(next_builder, &block) if ::Kernel.block_given? next_builder end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
15 16 17 |
# File 'lib/jasonette/helpers.rb', line 15 def builder @builder end |