module ActiveResourceResponse::ResponseMethod::ClassMethods
Public Class Methods
find(*arguments)
click to toggle source
# File lib/active_resource_response/response_method.rb, line 44 def find(*arguments) result = find_without_http_response(*arguments) self.wrap_result(result) end
Also aliased as: find_without_http_response
Public Instance Methods
add_response_method(method_name = :http_response)
click to toggle source
# File lib/active_resource_response/response_method.rb, line 38 def add_response_method(method_name = :http_response) class_attribute :http_response_method self.http_response_method = method_name class << self alias :find_without_http_response :find def find(*arguments) result = find_without_http_response(*arguments) self.wrap_result(result) end end unless methods.include?(:find_without_http_response) end
http_response()
click to toggle source
# File lib/active_resource_response/response_method.rb, line 34 def http_response connection.http_response end
remove_response_method()
click to toggle source
# File lib/active_resource_response/response_method.rb, line 51 def remove_response_method class << self undef :find alias :find :find_without_http_response undef :find_without_http_response undef :http_response_method undef :http_response_method= end end
wrap_result(result)
click to toggle source
# File lib/active_resource_response/response_method.rb, line 61 def wrap_result(result) result = SimpleDelegator.new(result) if result.frozen? result.instance_variable_set(:@http_response, connection.http_response) result.singleton_class.send(:define_method, self.http_response_method) do @http_response end result end