Class: Railsless::ActiveRecord::Config
- Inherits:
-
Object
- Object
- Railsless::ActiveRecord::Config
- Defined in:
- lib/railsless/active_record/config.rb
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(overrides = {}) ⇒ Config
constructor
A new instance of Config.
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
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 |