Method: TopModel::Base#method_missing

Defined in:
lib/topmodel/base.rb

#method_missing(method_symbol, *arguments) ⇒ Object (private)

:nodoc:



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/topmodel/base.rb', line 307

def method_missing(method_symbol, *arguments) #:nodoc:
  method_name = method_symbol.to_s

  if method_name =~ /(=|\?)$/
    case $1
    when "="
      attribute_will_change!($`)
      attributes[$`] = arguments.first
    when "?"
      attributes[$`]
    end
  else
    return attributes[method_name] if attributes.include?(method_name)
    return nil if known_attributes.include?(method_name)
    super
  end
end