Class: Dandy::ViewBuilder
- Inherits:
-
Object
- Object
- Dandy::ViewBuilder
- Defined in:
- lib/dandy/view_builder.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(template, container, options) ⇒ ViewBuilder
constructor
A new instance of ViewBuilder.
- #process ⇒ Object
Constructor Details
#initialize(template, container, options) ⇒ ViewBuilder
Returns a new instance of ViewBuilder.
3 4 5 6 7 8 |
# File 'lib/dandy/view_builder.rb', line 3 def initialize(template, container, ) @template = template @container = container @variables = template.scan(/@[a-z_][a-zA-Z_0-9]*/).uniq @options = end |
Instance Method Details
#process ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/dandy/view_builder.rb', line 10 def process @variables.each do |variable| value = @container.resolve(variable.sub('@', '').to_sym) instance_variable_set variable, value end build end |