Sha256: 87718fa88e66205e7e194bb4433ce5d2308627e2e8ee07b8e325a42273865baf

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

module CDQ
  class CDQCollectionProxy < CDQTargetedQuery

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

    def count
      @objects.size
    end
    alias :length :count
    alias :size :count

    def get
      @objects
    end

    def array
      @objects
    end

    def first(n = 1)
      n == 1 ? @objects.first : @objects.first(n)
    end

    def last(n = 1)
      n == 1 ? @objects.last : @objects.last(n)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cdq-2.0.0 motion/cdq/collection_proxy.rb
cdq-1.0.8 motion/cdq/collection_proxy.rb
cdq-1.0.7 motion/cdq/collection_proxy.rb
cdq-1.0.6 motion/cdq/collection_proxy.rb
cdq-1.0.4 motion/cdq/collection_proxy.rb
cdq-1.0.3 motion/cdq/collection_proxy.rb