Class: Outpost::ScoutConfig
- Inherits:
-
Object
- Object
- Outpost::ScoutConfig
- Defined in:
- lib/outpost/scout_config.rb
Overview
Provides the DSL used to configure Scouts in Outposts.
Instance Attribute Summary collapse
-
#options(args = nil) ⇒ Object
readonly
Reads/writes any options.
-
#reports ⇒ Object
readonly
Returns the value of attribute reports.
Instance Method Summary collapse
-
#initialize ⇒ ScoutConfig
constructor
A new instance of ScoutConfig.
-
#report(status, params) ⇒ Object
Reads reporting as: report :up, :response_code => 200.
Constructor Details
#initialize ⇒ ScoutConfig
Returns a new instance of ScoutConfig.
6 7 8 9 |
# File 'lib/outpost/scout_config.rb', line 6 def initialize @reports = {} @options = {} end |
Instance Attribute Details
#options(args = nil) ⇒ Object (readonly)
Reads/writes any options. It will passed down to the Scout. Rreturn [Object] The associated option
14 15 16 |
# File 'lib/outpost/scout_config.rb', line 14 def @options end |
#reports ⇒ Object (readonly)
Returns the value of attribute reports.
4 5 6 |
# File 'lib/outpost/scout_config.rb', line 4 def reports @reports end |
Instance Method Details
#report(status, params) ⇒ Object
Reads reporting as:
report :up, :response_code => 200
It reads much better in the DSL, but doesn’t make much sense in terms of code, so it is changed to an inverted approach, so:
status = 200
params = {:response_code => 200}
gets stored as:
{:response_code => 200} = up
30 31 32 |
# File 'lib/outpost/scout_config.rb', line 30 def report(status, params) @reports[params] = status end |