Module: SmsBroker::Configuration
- Extended by:
- Configuration
- Included in:
- SmsBroker, Configuration
- Defined in:
- lib/sms_broker/configuration.rb
Instance Method Summary collapse
- #clear_setup ⇒ Object
- #configuration ⇒ Object
- #default_service ⇒ Object
- #setup {|setup| ... } ⇒ Object
- #setup! {|setup| ... } ⇒ Object
Instance Method Details
#clear_setup ⇒ Object
14 15 16 |
# File 'lib/sms_broker/configuration.rb', line 14 def clear_setup @configuration = nil end |
#configuration ⇒ Object
18 19 20 21 22 23 |
# File 'lib/sms_broker/configuration.rb', line 18 def configuration exception = \ Exceptions::InvalidSetup.new('setup does not exists') @configuration || (raise exception) end |
#default_service ⇒ Object
10 11 12 |
# File 'lib/sms_broker/configuration.rb', line 10 def default_service configuration[:default_service] end |
#setup {|setup| ... } ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/sms_broker/configuration.rb', line 25 def setup setup = Setup.new yield setup if block_given? @configuration = setup. setup end |
#setup! {|setup| ... } ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sms_broker/configuration.rb', line 34 def setup! setup = Setup.new yield setup if block_given? unless setup.valid? exception = \ Exceptions::InvalidSetup.new("setup is invalid, #{setup.errors}") exception.errors = setup.errors raise exception end @configuration = setup. setup end |