module Pixmatch::Configuration
Defines constants and methods related to configuration.
Constants
- DEFAULT_ENDPOINT
The endpoint that will be used to connect if none is set.
- DEFAULT_PASSWORD
By default, don’t set a password.
- DEFAULT_USERNAME
By default, don’t set a username.
- VALID_OPTIONS_KEYS
An array of valid keys in the options hash when configuring a {Flixated::API}.
Public Class Methods
extended(base)
click to toggle source
When this module is extended, set all configuration options to their default values.
# File lib/pixmatch/configuration.rb, line 26 def self.extended(base) base.reset end
Public Instance Methods
configure() { |self| ... }
click to toggle source
Convenience method to allow configuration options to be set in a block.
# File lib/pixmatch/configuration.rb, line 31 def configure yield self end
options()
click to toggle source
Create a hash of options and their values.
# File lib/pixmatch/configuration.rb, line 36 def options VALID_OPTIONS_KEYS.inject({}) do |option,key| option.merge!(key => send(key)) end end
reset()
click to toggle source
Reset all configuration options to default.
# File lib/pixmatch/configuration.rb, line 43 def reset self.username = DEFAULT_USERNAME self.password = DEFAULT_PASSWORD self.endpoint = DEFAULT_ENDPOINT end