Sha256: 265bf8e842738522d86b8d0f54d78cf58a2aba919b8dc2fd32b01f65bea6ec03

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

module QBFC

  # A QBCollection object is used as an intermediate object when doing finds,
  # for example, in <tt>qb_session.customers.find(:all)</tt>, +customers+
  # returns a QBCollection instance which then is sent the find call.
  # The instance sends the find method on to the appropriate Class.
  # The reason for having this intermediate class is to be able to
  # pass a reference to the Session to the find method
  # (or other class method).
  # 
  # There's probably no reason to use this class directly.
  class QBCollection
    
    # +sess+ is a QBFC::Session object, +class_name+ is the name of
    # a class descended from QBFC::Base.
    def initialize(sess, class_name)
      @sess = sess
      @klass = QBFC::const_get(class_name)
    end
  
    # Send any missing methods to the class, along with the +Session+ object
    def method_missing(symbol, *params) #:nodoc:
      @klass.send(symbol, @sess, *params)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
jm81-qbfc-0.3.0 lib/qbfc/qb_collection.rb
qbfc-0.3.0 lib/qbfc/qb_collection.rb
qbfc-0.1.0-x86-mswin32-60 lib/qbfc/qb_collection.rb
qbfc-0.2.0-x86-mswin32-60 lib/qbfc/qb_collection.rb