class MingleModel

Public Instance Methods

get_attribute_value(name) click to toggle source
# File lib/models/mingle_model.rb, line 17
def get_attribute_value name
  self.attributes[key_encode(name)]
end
get_property_value(name) click to toggle source
# File lib/models/mingle_model.rb, line 21
def get_property_value name
  property = self.properties.select{ |prop| key_encode(prop.name) == key_encode(name) }.first
  property.value || 'not set' unless property.nil?
end
method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/models/mingle_model.rb, line 7
def method_missing method_name, *args
  super method_name, *args
rescue NoMethodError
  match = get_attribute_value(method_name)
  match = get_property_value(method_name) if match.nil? and self.respond_to?(:properties)

  raise if match.nil?
  match
end

Private Instance Methods

key_encode(string) click to toggle source
# File lib/models/mingle_model.rb, line 27
def key_encode string
  string.downcase.to_s.gsub('_', ' ')
end