Class: Railsless::ActiveRecord::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(overrides = {}) ⇒ Config

Returns a new instance of Config.



19
20
21
# File 'lib/railsless/active_record/config.rb', line 19

def initialize(overrides={})
  overrides.each { |attr,val| send(:"#{attr}=", val) }
end

Instance Attribute Details

#rootObject



26
27
28
# File 'lib/railsless/active_record/config.rb', line 26

def root
  @root ||= Root.calculate
end

Class Method Details

.accessor_with_default(name, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/railsless/active_record/config.rb', line 9

def self.accessor_with_default(name, &block)
  module_eval do
    attr_writer name
    define_method(name) do
      # Don't cache the result; if you really needs to, define a method manually.
      instance_variable_get(:"@#{name}") || instance_exec(&block)
    end
  end
end