Class: Fare::Configuration
- Inherits:
-
Object
- Object
- Fare::Configuration
- Defined in:
- lib/fare/configuration.rb
Defined Under Namespace
Classes: SubscriberConfiguration
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#app_version ⇒ Object
Returns the value of attribute app_version.
-
#default_version ⇒ Object
Returns the value of attribute default_version.
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#publish_topics ⇒ Object
readonly
Returns the value of attribute publish_topics.
-
#subscribers ⇒ Object
readonly
Returns the value of attribute subscribers.
Instance Method Summary collapse
- #backup! ⇒ Object
- #backup? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_environment(environment) ⇒ Object
- #subscribe_topics ⇒ Object
- #subscriber(name) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 |
# File 'lib/fare/configuration.rb', line 7 def initialize @publish_topics = [] @environments = {} @subscribers = {} @default_version = "0.0" @backup = false end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
5 6 7 |
# File 'lib/fare/configuration.rb', line 5 def app_name @app_name end |
#app_version ⇒ Object
Returns the value of attribute app_version.
5 6 7 |
# File 'lib/fare/configuration.rb', line 5 def app_version @app_version end |
#default_version ⇒ Object
Returns the value of attribute default_version.
5 6 7 |
# File 'lib/fare/configuration.rb', line 5 def default_version @default_version end |
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
4 5 6 |
# File 'lib/fare/configuration.rb', line 4 def environments @environments end |
#publish_topics ⇒ Object (readonly)
Returns the value of attribute publish_topics.
4 5 6 |
# File 'lib/fare/configuration.rb', line 4 def publish_topics @publish_topics end |
#subscribers ⇒ Object (readonly)
Returns the value of attribute subscribers.
4 5 6 |
# File 'lib/fare/configuration.rb', line 4 def subscribers @subscribers end |
Instance Method Details
#backup! ⇒ Object
31 32 33 |
# File 'lib/fare/configuration.rb', line 31 def backup! @backup = true end |
#backup? ⇒ Boolean
27 28 29 |
# File 'lib/fare/configuration.rb', line 27 def backup? @backup end |
#load_environment(environment) ⇒ Object
15 16 17 |
# File 'lib/fare/configuration.rb', line 15 def load_environment(environment) environments.fetch(environment) { Proc.new {} }.call end |
#subscribe_topics ⇒ Object
19 20 21 |
# File 'lib/fare/configuration.rb', line 19 def subscribe_topics subscribers.map { |name, config| config.topics }.flatten end |
#subscriber(name) ⇒ Object
23 24 25 |
# File 'lib/fare/configuration.rb', line 23 def subscriber(name) subscribers[name.to_s] ||= SubscriberConfiguration.new(name.to_s) end |