Sha256: af6e9a885b9df938705ff2229378afe35bd7d7c533bae424fb25dfb5e56d94b8
Contents?: true
Size: 1.24 KB
Versions: 17
Compression:
Stored size: 1.24 KB
Contents
module FbGraph class Connection < Collection attr_accessor :collection, :connection, :owner, :options delegate :total_count, :unread_count, :updated_time, :to => :collection def initialize(owner, connection, options = {}) @owner = owner @options = options @connection = connection @collection = options.delete(:collection) || Collection.new replace collection end def next(_options_ = {}) if self.collection.next.present? connection_method = if self.owner.respond_to?(self.connection) self.connection else self.owner.public_methods.detect do |method| method.to_s.gsub('_', '') == self.connection.to_s end end self.owner.send( connection_method, self.options.merge( self.collection.next.merge( _options_ ) ) ) else self.class.new(self.owner, self.connection) end end def previous(_options_ = {}) if self.collection.previous.present? self.owner.send(self.connection, self.options.merge(_options_).merge(self.collection.previous)) else self.class.new(self.owner, self.connection) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems