Class: CDQ::CDQObjectProxy

Inherits:
CDQObject show all
Defined in:
motion/cdq/object_proxy.rb

Instance Method Summary collapse

Methods inherited from CDQObject

#background, #contexts, #find, #models, #reset!, #save, #setup, #stores

Methods included from CDQ

#cdq

Constructor Details

#initialize(object) ⇒ CDQObjectProxy

Returns a new instance of CDQObjectProxy.


5
6
7
# File 'motion/cdq/object_proxy.rb', line 5

def initialize(object)
  @object = object
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object


17
18
19
20
21
22
23
# File 'motion/cdq/object_proxy.rb', line 17

def method_missing(*args)
  if @object.entity.relationshipsByName[args.first]
    CDQRelationshipQuery.new(@object, args.first)
  else
    super(*args)
  end
end

Instance Method Details

#destroyObject


25
26
27
# File 'motion/cdq/object_proxy.rb', line 25

def destroy
  @object.managedObjectContext.deleteObject(@object)
end

#getObject


9
10
11
# File 'motion/cdq/object_proxy.rb', line 9

def get
  @object
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)

13
14
15
# File 'motion/cdq/object_proxy.rb', line 13

def respond_to?(method)
  super(method) || @object.entity.relationshipsByName[method]
end