Class: Cequel::Record::AssociationCollection
- Extended by:
- Util::Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/cequel/record/association_collection.rb
Overview
Instance Attribute Summary
Attributes inherited from RecordSet
Instance Method Summary collapse
- #count ⇒ Object (also: #length, #size)
- #each {|Record| ... } ⇒ void
-
#find(*keys) ⇒ Record, LazyRecordCollection
Return a loaded Record or collection of loaded Records with the specified primary key values.
- #first(*args) ⇒ Record, Array
-
#loaded? ⇒ Boolean
True if this collection’s records are loaded in memory.
- #select(*columns) ⇒ Array, RecordSet
Methods included from Util::Forwardable
Methods inherited from RecordSet
#==, #[], #after, #all, #allow_filtering!, #assert_fully_specified!, #at, #before, #consistency, #data_set, default_attributes, #delete_all, #find_each, #find_each_row, #find_in_batches, #find_rows_in_batches, #first!, #first_or_initialize, #from, #in, #initialize, #last, #last_page?, #limit, #next_paging_state, #page_size, #paging_state, #reverse, #scoped_key_attributes, #to_ary, #upto, #values_at, #where
Methods included from Util::HashAccessors
#hattr_accessor, #hattr_inquirer, #hattr_reader, #hattr_writer
Methods included from BulkWrites
#delete_all, #destroy_all, #update_all
Constructor Details
This class inherits a constructor from Cequel::Record::RecordSet
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cequel::Record::RecordSet
Instance Method Details
#count ⇒ Object Also known as: length, size
56 57 58 |
# File 'lib/cequel/record/association_collection.rb', line 56 def count raise Cequel::Record::DangerousQueryError.new end |
#each {|Record| ... } ⇒ void
This method returns an undefined value.
21 22 23 |
# File 'lib/cequel/record/association_collection.rb', line 21 def each(&block) target.each(&block) end |
#find(*keys) ⇒ Record, LazyRecordCollection
Return a loaded Record or collection of loaded Records with the specified primary key values
Multiple arguments are mapped onto unscoped key columns. To specify multiple values for a given key column, use an array.
28 29 30 31 32 |
# File 'lib/cequel/record/association_collection.rb', line 28 def find(*keys) if block_given? then super else record_set.find(*keys) end end |
#first ⇒ Record #first(count) ⇒ Array
46 47 48 49 50 |
# File 'lib/cequel/record/association_collection.rb', line 46 def first(*args) if loaded? then super else record_set.first(*args) end end |
#loaded? ⇒ Boolean
Returns true if this collection’s records are loaded in memory.
66 67 68 |
# File 'lib/cequel/record/association_collection.rb', line 66 def loaded? !!@target end |
#select {|record| ... } ⇒ Array #select(*columns) ⇒ RecordSet
37 38 39 40 41 |
# File 'lib/cequel/record/association_collection.rb', line 37 def select(*columns) if block_given? then super else record_set.select(*columns) end end |