Module: Evostream::Configuration
- Included in:
- Evostream
- Defined in:
- lib/evostream/configuration.rb
Constant Summary collapse
- VALID_CONFIG_KEYS =
[:host, :port, :path_prefix].freeze
- OPTIONAL_CONFIG_KEYS =
VALID_CONFIG_KEYS - [:host]
- DEFAULT_PORT =
80
- DEFAULT_PATH_PREFIX =
''
Class Method Summary collapse
-
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
config/initializers/evostream.rb (for instance).
- #options ⇒ Object
- #reset ⇒ Object
Class Method Details
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’
15 16 17 |
# File 'lib/evostream/configuration.rb', line 15 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
config/initializers/evostream.rb (for instance)
Evostream.configure do |config|
config.host = 'evostream.example.com'
config.port = 80
config.path_prefix = '/evo'
end
elsewhere
client = Evostream::Client.new
36 37 38 39 |
# File 'lib/evostream/configuration.rb', line 36 def configure yield self true end |
#options ⇒ Object
41 42 43 |
# File 'lib/evostream/configuration.rb', line 41 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
19 20 21 22 |
# File 'lib/evostream/configuration.rb', line 19 def reset self.port = DEFAULT_PORT self.path_prefix = DEFAULT_PATH_PREFIX end |