Class: BeamUp::Configuration
- Inherits:
-
Object
- Object
- BeamUp::Configuration
- Defined in:
- lib/beam_up/configuration.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
5 minutes
300
Instance Attribute Summary collapse
-
#after_actions ⇒ Object
Returns the value of attribute after_actions.
-
#before_actions ⇒ Object
Returns the value of attribute before_actions.
-
#path ⇒ Object
Returns the value of attribute path.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #method_missing(method_name, *arguments) ⇒ Object
- #provider_config ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 |
# File 'lib/beam_up/configuration.rb', line 9 def initialize @providers = {} @timeout = DEFAULT_TIMEOUT end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#after_actions ⇒ Object
Returns the value of attribute after_actions.
5 6 7 |
# File 'lib/beam_up/configuration.rb', line 5 def after_actions @after_actions end |
#before_actions ⇒ Object
Returns the value of attribute before_actions.
5 6 7 |
# File 'lib/beam_up/configuration.rb', line 5 def before_actions @before_actions end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/beam_up/configuration.rb', line 5 def path @path end |
#provider ⇒ Object
Returns the value of attribute provider.
5 6 7 |
# File 'lib/beam_up/configuration.rb', line 5 def provider @provider end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/beam_up/configuration.rb', line 5 def timeout @timeout end |
Class Method Details
.with(options) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/beam_up/configuration.rb', line 14 def self.with() new.tap do |config| config.provider = [:provider] config.provider_config.with() end end |
Instance Method Details
#provider_config ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/beam_up/configuration.rb', line 21 def provider_config raise(ConfigurationError, "Provider must be set") if provider.nil? || provider.empty? provider_class = PROVIDERS[provider.to_s] raise(ConfigurationError, "Unknown provider: #{provider}") unless provider_class @providers[provider.to_s] ||= provider_class::Config.new end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
44 45 46 |
# File 'lib/beam_up/configuration.rb', line 44 def respond_to_missing?(method_name, include_private = false) PROVIDERS.key?(method_name.to_s) || super end |
#validate! ⇒ Object
30 31 32 33 34 |
# File 'lib/beam_up/configuration.rb', line 30 def validate! raise ConfigurationError, "Provider must be set" unless provider provider_config.validate! end |