Class: GemHadar::TemplateCompiler
- Inherits:
-
Object
- Object
- GemHadar::TemplateCompiler
- Includes:
- Tins::BlockSelf, Tins::MethodMissingDelegator::DelegatorModule
- Defined in:
- lib/gem_hadar.rb
Instance Method Summary collapse
- #compile(src, dst) ⇒ Object
-
#initialize(&block) ⇒ TemplateCompiler
constructor
A new instance of TemplateCompiler.
- #method_missing(id, *a, &b) ⇒ Object
Constructor Details
#initialize(&block) ⇒ TemplateCompiler
Returns a new instance of TemplateCompiler.
798 799 800 801 802 |
# File 'lib/gem_hadar.rb', line 798 def initialize(&block) super block_self(&block) @values = {} instance_eval(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *a, &b) ⇒ Object
813 814 815 816 817 818 819 820 821 |
# File 'lib/gem_hadar.rb', line 813 def method_missing(id, *a, &b) if a.empty? && id && @values.key?(id) @values[id] elsif a.size == 1 @values[id] = a.first else super end end |