Class: CDQ::CDQCollectionProxy

Inherits:
CDQTargetedQuery show all
Defined in:
motion/cdq/collection_proxy.rb

Instance Attribute Summary

Attributes inherited from CDQTargetedQuery

#entity_description

Attributes inherited from CDQQuery

#predicate, #sort_descriptors

Instance Method Summary collapse

Methods inherited from CDQTargetedQuery

#[], #all, #context, #create, #each, #fetch_request, #in_context, #log, #method_missing, #new, #scope

Methods inherited from CDQQuery

#and, #fetch_request, #limit, #offset, #or, #sort_by

Methods inherited from CDQObject

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

Methods included from CDQ

#cdq

Constructor Details

#initialize(objects, entity_description) ⇒ CDQCollectionProxy

Returns a new instance of CDQCollectionProxy.


5
6
7
8
9
# File 'motion/cdq/collection_proxy.rb', line 5

def initialize(objects, entity_description)
  @objects = objects
  super(entity_description, constantize(entity_description.managedObjectClassName))
  @predicate = self.where("%@ CONTAINS SELF", @objects).predicate
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CDQ::CDQTargetedQuery

Instance Method Details

#arrayObject


21
22
23
# File 'motion/cdq/collection_proxy.rb', line 21

def array
  @objects
end

#countObject Also known as: length, size


11
12
13
# File 'motion/cdq/collection_proxy.rb', line 11

def count
  @objects.size
end

#firstObject


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

def first
  @objects.first
end

#getObject


17
18
19
# File 'motion/cdq/collection_proxy.rb', line 17

def get
  @objects
end