Sha256: 394e8a08c8411d1ab164f9d062a7da10884515b218b50d0960b94054aecdfbdc
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'forwardable' require 'wayback/error/configuration_error' module Wayback module Configurable extend Forwardable attr_accessor :endpoint, :endpoint_path, :connection_options, :identity_map, :middleware def_delegator :options, :hash class << self def keys @keys ||= [ :endpoint, :endpoint_path, :connection_options, :identity_map, :middleware ] end end # Convenience method to allow configuration options to be set in a block # # @raise [Wayback::Error::ConfigurationError] Error is raised when supplied # wayback credentials are not a String or Symbol. def configure yield self self end def reset! Wayback::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Wayback::Default.options[key]) end self end alias setup reset! private # @return [Hash] def options Hash[Wayback::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wayback-0.2.1 | lib/wayback/configurable.rb |
wayback-0.2.0 | lib/wayback/configurable.rb |