Class: ActiveRecord::Base

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
# File 'lib/active_record/base.rb', line 6

def initialize(attributes={})
  attributes.each do |key, value|
    self.send "#{key}=".to_sym, value
  end
end

Instance Method Details

#read_attribute(method_name) ⇒ Object



12
13
14
# File 'lib/active_record/base.rb', line 12

def read_attribute(method_name)
  instance_variable_get "@#{method_name}"
end

#write_attribute(method_name, value) ⇒ Object



16
17
18
# File 'lib/active_record/base.rb', line 16

def write_attribute(method_name, value)
  instance_variable_set "@#{method_name}", value
end