Class: Outpost::ScoutConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/outpost/scout_config.rb

Overview

Provides the DSL used to configure Scouts in Outposts.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScoutConfig

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

Parameters:

  • args (Object) (defaults to: nil)

    Any argument that will be passed to the Scout.



14
15
16
# File 'lib/outpost/scout_config.rb', line 14

def options
  @options
end

#reportsObject (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