Class: Highlander::Dsl::DslBase

Inherits:
Object
  • Object
show all
Defined in:
lib/highlander.dsl.base.rb

Direct Known Subclasses

Component, Parameter, Parameters, Template

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Raises:

  • (StandardError)


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