Method: ActiveCMIS::AttributePrefix#method_missing

Defined in:
lib/active_cmis/attribute_prefix.rb

#method_missing(method, *parameters) ⇒ Object

For known attributes will act as a getter and setter



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/active_cmis/attribute_prefix.rb', line 16

def method_missing(method, *parameters)
  string = method.to_s
  if string[-1] == ?=
    assignment = true
    string = string[0..-2]
  end
  attribute = "#{prefix}:#{string}"
  if object.class.attributes.keys.include? attribute
    if assignment
      object.update(attribute => parameters.first)
    else
      object.attribute(attribute)
    end
  else
    # TODO: perhaps here we should try to look a bit further to see if there is a second :
    super
  end
end