Class: Hypertemplate::Builder::Values
- Inherits:
-
Object
- Object
- Hypertemplate::Builder::Values
- Defined in:
- lib/hypertemplate/builder/values.rb
Overview
This is a Blank Slate class to support the renderization of the values block of Builder DSLs Every Media type should implement a Builder with a insert_value method that renders the values block to a specific format
Instance Attribute Summary collapse
-
#builder ⇒ Object
Returns the value of attribute builder.
Instance Method Summary collapse
- #[](prefix) ⇒ Object
-
#initialize(builder) ⇒ Values
constructor
A new instance of Values.
- #method_missing(symbol, *args, &block) ⇒ Object
Constructor Details
#initialize(builder) ⇒ Values
Returns a new instance of Values.
14 15 16 17 |
# File 'lib/hypertemplate/builder/values.rb', line 14 def initialize(builder) @builder = builder @current_prefix = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/hypertemplate/builder/values.rb', line 24 def method_missing(symbol, *args, &block) name = symbol.to_s prefix = @current_prefix @current_prefix = nil @builder.insert_value(name, prefix, *args, &block) end |
Instance Attribute Details
#builder ⇒ Object
Returns the value of attribute builder.
7 8 9 |
# File 'lib/hypertemplate/builder/values.rb', line 7 def builder @builder end |
Instance Method Details
#[](prefix) ⇒ Object
19 20 21 22 |
# File 'lib/hypertemplate/builder/values.rb', line 19 def [](prefix) @current_prefix = prefix self end |