Class: Highlander::Dsl::DslBase
- Inherits:
-
Object
- Object
- Highlander::Dsl::DslBase
- Defined in:
- lib/highlander.dsl.base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(parent) ⇒ DslBase
constructor
A new instance of DslBase.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(parent) ⇒ DslBase
Returns a new instance of DslBase.
9 10 11 |
# File 'lib/highlander.dsl.base.rb', line 9 def initialize(parent) @config = parent.config unless parent.nil? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/highlander.dsl.base.rb', line 13 def method_missing(method, *args) if @config.nil? raise StandardError, "#{self} no config!" end return @config["#{method}"] unless @config["#{method}"].nil? raise StandardError, "#{self}Unknown method or variable #{method} in Highlander template" end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/highlander.dsl.base.rb', line 7 def config @config end |