module RestClient
Constants
- RACK_APP
Attributes
components[R]
Public Class Methods
disable(component)
click to toggle source
Disable a component
RestClient.disable Rack::Cache => array of remaining components
# File lib/restclient/components.rb, line 69 def self.disable(component) @components.delete_if{|(existing_component, options)| component == existing_component} end
enable(component, *args)
click to toggle source
Enable a Rack
component. You may enable as many components as you want.
Examples:
Transparent HTTP caching:
RestClient.enable Rack::Cache, :verbose => true, :metastore => 'file:/var/cache/rack/meta' :entitystore => 'file:/var/cache/rack/body'
Transparent logging of HTTP requests (commonlog format):
RestClient.enable Rack::CommonLogger, STDOUT
Please refer to the documentation of each rack component for the list of available options.
# File lib/restclient/components.rb, line 55 def self.enable(component, *args) # remove any existing component of the same class disable(component) if component == RestClient::Rack::Compatibility @components.push [component, args] else @components.unshift [component, args] end end
enabled?(component)
click to toggle source
Returns true if the given component is enabled, false otherwise.
RestClient.enable Rack::Cache RestClient.enabled?(Rack::Cache) => true
# File lib/restclient/components.rb, line 78 def self.enabled?(component) !@components.detect{|(existing_component, options)| component == existing_component}.nil? end
reset()
click to toggle source
# File lib/restclient/components.rb, line 82 def self.reset # hash of the enabled components @components = [[RestClient::Rack::Compatibility]] end