Sha256: 0bc384979c1cb288088118cbf0f4de002197a3a99948954ebd18ff80aea37fac
Contents?: true
Size: 915 Bytes
Versions: 6
Compression:
Stored size: 915 Bytes
Contents
require 'sms_broker/setup' require 'sms_broker/exceptions/invalid_setup' module SmsBroker module Configuration extend self @configuration = nil def default_service configuration[:default_service] end def clear_setup @configuration = nil end def configuration exception = \ Exceptions::InvalidSetup.new('setup does not exists') @configuration || (raise exception) end def setup setup = Setup.new yield setup if block_given? @configuration = setup.options setup end 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.options setup end end end
Version data entries
6 entries across 6 versions & 1 rubygems