Class: GOM::Object::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/gom/object/collection.rb

Overview

A class for a collection of objects.

Instance Method Summary collapse

Constructor Details

#initialize(fetcher, storage_name) ⇒ Collection

Returns a new instance of Collection.



5
6
7
# File 'lib/gom/object/collection.rb', line 5

def initialize(fetcher, storage_name)
  @fetcher, @storage_name = fetcher, storage_name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



17
18
19
20
# File 'lib/gom/object/collection.rb', line 17

def method_missing(method_name, *arguments, &block)
  load unless (@objects || @object_proxies || @rows)
  (@objects || @object_proxies || @rows).send method_name, *arguments, &block
end

Instance Method Details

#respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/gom/object/collection.rb', line 13

def respond_to?(method_name)
  (@object_proxies || @rows).respond_to?(method_name)
end

#total_countObject



9
10
11
# File 'lib/gom/object/collection.rb', line 9

def total_count
  @fetcher.total_count
end