module ActiveMocker::Base::PropertiesGetterAndSetter

Public Instance Methods

read_attribute(attr) click to toggle source

Returns the value of the attribute identified by attr_name after it has been typecast (for example, “2004-12-12” in a date column is cast to a date object, like Date.new(2004, 12, 12))

# File lib/active_mocker/mock/base.rb, line 358
def read_attribute(attr)
  @attributes[attr]
end
write_attribute(attr, value) click to toggle source

Updates the attribute identified by attr_name with the specified value. Empty strings for fixnum and float columns are turned into nil.

# File lib/active_mocker/mock/base.rb, line 365
def write_attribute(attr, value)
  @attributes[attr] = types[attr].coerce(value)
end

Protected Instance Methods

read_association(attr, assign_if_value_nil = nil) click to toggle source

@api private

# File lib/active_mocker/mock/base.rb, line 370
def read_association(attr, assign_if_value_nil = nil)
  @associations[attr.to_sym] ||= assign_if_value_nil.try(:call)
end
write_association(attr, value) click to toggle source

@api private

# File lib/active_mocker/mock/base.rb, line 375
def write_association(attr, value)
  @associations[attr.to_sym] = value
end