Sha256: 812e48e362cec05de257f1ddf7abb08b5cc7d6fa33838608a852ef1c0b44f04d
Contents?: true
Size: 850 Bytes
Versions: 3
Compression:
Stored size: 850 Bytes
Contents
module OpConnect module Configurable attr_accessor :access_token, :adapter, :stubs, :user_agent attr_writer :api_endpoint class << self def keys @keys ||= [ :access_token, :adapter, :api_endpoint, :stubs, :user_agent ] end end def configure yield self end def reset! OpConnect::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", OpConnect::Default.options[key]) end self end alias_method :setup, :reset! def same_options?(opts) opts.hash == options.hash end def api_endpoint ::File.join(@api_endpoint, "") end private def options OpConnect::Configurable.keys.map { |key| [key, instance_variable_get(:"@#{key}")] }.to_h end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
op_connect-0.1.3 | lib/op_connect/configurable.rb |
op_connect-0.1.2 | lib/op_connect/configurable.rb |
op_connect-0.1.1 | lib/op_connect/configurable.rb |