lib/zendesk_api/collection.rb in zendesk_api-1.13.3 vs lib/zendesk_api/collection.rb in zendesk_api-1.13.4

- old
+ new

@@ -280,21 +280,23 @@ @prev_page = nil @query = nil end # @private - def to_ary; nil; end + def to_ary + nil + end - def respond_to?(name) - super || Array.new.respond_to?(name) + def respond_to_missing?(name, include_all) + [].respond_to?(name, include_all) end # Sends methods to underlying array of resources. def method_missing(name, *args, &block) if resource_methods.include?(name) collection_method(name, *args, &block) - elsif Array.new.respond_to?(name) + elsif [].respond_to?(name, false) array_method(name, *args, &block) else next_collection(name, *args, &block) end end @@ -450,10 +452,10 @@ end ## Method missing def array_method(name, *args, &block) - to_a.send(name, *args, &block) + to_a.public_send(name, *args, &block) end def next_collection(name, *args, &block) opts = args.last.is_a?(Hash) ? args.last : {} opts.merge!(:collection_path => @collection_path.dup.push(name))