Class: StatusPage::Configuration
- Inherits:
-
Object
- Object
- StatusPage::Configuration
- Defined in:
- lib/status-page/configuration.rb
Instance Attribute Summary collapse
-
#basic_auth_credentials ⇒ Object
Returns the value of attribute basic_auth_credentials.
-
#error_callback ⇒ Object
Returns the value of attribute error_callback.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
Instance Method Summary collapse
- #add_custom_service(custom_service_class) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #use(service_name, opts = {}) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 |
# File 'lib/status-page/configuration.rb', line 6 def initialize @providers = Set.new @interval = 10 end |
Instance Attribute Details
#basic_auth_credentials ⇒ Object
Returns the value of attribute basic_auth_credentials.
3 4 5 |
# File 'lib/status-page/configuration.rb', line 3 def basic_auth_credentials @basic_auth_credentials end |
#error_callback ⇒ Object
Returns the value of attribute error_callback.
3 4 5 |
# File 'lib/status-page/configuration.rb', line 3 def error_callback @error_callback end |
#interval ⇒ Object
Returns the value of attribute interval.
3 4 5 |
# File 'lib/status-page/configuration.rb', line 3 def interval @interval end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
4 5 6 |
# File 'lib/status-page/configuration.rb', line 4 def providers @providers end |
Instance Method Details
#add_custom_service(custom_service_class) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/status-page/configuration.rb', line 22 def add_custom_service(custom_service_class) unless custom_service_class < StatusPage::Services::Base raise ArgumentError.new 'custom provider class must implement '\ 'StatusPage::Services::Base' end add_service(custom_service_class) end |
#use(service_name, opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/status-page/configuration.rb', line 11 def use(service_name, opts = {}) require "status-page/services/#{service_name}" klass = "StatusPage::Services::#{service_name.capitalize}".constantize if klass.respond_to?(:configurable?) && klass.configurable? opts.each_key do |key| klass.config.send("#{key}=", opts[key]) end end add_service(klass) end |