Class: Burn::Configuration::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/burn/config/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Loader

Returns a new instance of Loader.



6
7
8
9
10
# File 'lib/burn/config/loader.rb', line 6

def initialize(code)
  @server = Server.new
  @app = App.new
  self.instance_eval code
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_symbol, *args, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/burn/config/loader.rb', line 12

def method_missing(method_symbol, *args, &block)
  if method_symbol == :config then
    if args[0] == :server then
      @server.instance_eval &block
    elsif args[0] == :app then
      @app.instance_eval &block
    end
  end
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



4
5
6
# File 'lib/burn/config/loader.rb', line 4

def app
  @app
end

#serverObject (readonly)

Returns the value of attribute server.



4
5
6
# File 'lib/burn/config/loader.rb', line 4

def server
  @server
end