Class: YodelConfig

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

Instance Method Summary collapse

Constructor Details

#initializeYodelConfig

Returns a new instance of YodelConfig.



7
8
9
10
11
12
13
14
# File 'lib/yodel/config/config.rb', line 7

def initialize
  @options = {
    'yodel_migration_directory' => File.join(File.dirname(__FILE__), '..', 'models', 'migrations'),
    'public_directories' => [File.join(File.dirname(__FILE__), '..', 'public')],
    'layout_directories' => [],
    'extensions' => []
  }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/yodel/config/config.rb', line 16

def method_missing(method, *args)
  method = method.to_s
  if method[-1] == '='
    @options[method[0...-1]] = args[0]
  elsif method[-1] == '?'
    @options.has_key?(method[0...-1])
  else
    @options[method]
  end
end

Instance Method Details

#define {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (YodelConfig)

    the object that the method was called on



27
28
29
# File 'lib/yodel/config/config.rb', line 27

def define(&block)
  yield self
end