Class: Rearview::Configuration
- Inherits:
-
Struct
- Object
- Struct
- Rearview::Configuration
- Defined in:
- lib/rearview/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ default_from: "rearview@localhost", graphite_url: nil, pagerduty_url: "https://events.pagerduty.com/generic/2010-04-15/create_event.json", sandbox_timeout: 5, enable_alerts: true, preload_jobs: true, verify: false, enable_monitor: true }
Instance Attribute Summary collapse
-
#default_from ⇒ Object
Returns the value of attribute default_from.
-
#enable_alerts ⇒ Object
Returns the value of attribute enable_alerts.
-
#enable_monitor ⇒ Object
Returns the value of attribute enable_monitor.
-
#graphite_url ⇒ Object
Returns the value of attribute graphite_url.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#pagerduty_url ⇒ Object
Returns the value of attribute pagerduty_url.
-
#preload_jobs ⇒ Object
Returns the value of attribute preload_jobs.
-
#sandbox_dir ⇒ Object
Returns the value of attribute sandbox_dir.
-
#sandbox_exec ⇒ Object
Returns the value of attribute sandbox_exec.
-
#sandbox_timeout ⇒ Object
Returns the value of attribute sandbox_timeout.
-
#verify ⇒ Object
Returns the value of attribute verify.
Instance Method Summary collapse
- #alerts_enabled? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #monitor_enabled? ⇒ Boolean
- #preload_jobs? ⇒ Boolean
- #set_defaults ⇒ Object
- #to_s ⇒ Object
- #verify? ⇒ Boolean
- #with_argv(argv) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 |
# File 'lib/rearview/configuration.rb', line 18 def initialize super set_defaults end |
Instance Attribute Details
#default_from ⇒ Object
Returns the value of attribute default_from
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def default_from @default_from end |
#enable_alerts ⇒ Object
Returns the value of attribute enable_alerts
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def enable_alerts @enable_alerts end |
#enable_monitor ⇒ Object
Returns the value of attribute enable_monitor
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def enable_monitor @enable_monitor end |
#graphite_url ⇒ Object
Returns the value of attribute graphite_url
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def graphite_url @graphite_url end |
#logger ⇒ Object
Returns the value of attribute logger
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def logger @logger end |
#pagerduty_url ⇒ Object
Returns the value of attribute pagerduty_url
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def pagerduty_url @pagerduty_url end |
#preload_jobs ⇒ Object
Returns the value of attribute preload_jobs
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def preload_jobs @preload_jobs end |
#sandbox_dir ⇒ Object
Returns the value of attribute sandbox_dir
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def sandbox_dir @sandbox_dir end |
#sandbox_exec ⇒ Object
Returns the value of attribute sandbox_exec
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def sandbox_exec @sandbox_exec end |
#sandbox_timeout ⇒ Object
Returns the value of attribute sandbox_timeout
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def sandbox_timeout @sandbox_timeout end |
#verify ⇒ Object
Returns the value of attribute verify
4 5 6 |
# File 'lib/rearview/configuration.rb', line 4 def verify @verify end |
Instance Method Details
#alerts_enabled? ⇒ Boolean
23 24 25 |
# File 'lib/rearview/configuration.rb', line 23 def alerts_enabled? enable_alerts end |
#monitor_enabled? ⇒ Boolean
27 28 29 |
# File 'lib/rearview/configuration.rb', line 27 def monitor_enabled? enable_monitor end |
#preload_jobs? ⇒ Boolean
31 32 33 |
# File 'lib/rearview/configuration.rb', line 31 def preload_jobs? preload_jobs end |
#set_defaults ⇒ Object
48 49 50 |
# File 'lib/rearview/configuration.rb', line 48 def set_defaults members.each { |member| send("#{member}=", DEFAULTS[member.to_sym]) } end |
#to_s ⇒ Object
52 53 54 55 56 |
# File 'lib/rearview/configuration.rb', line 52 def to_s @elems = [] members.each { |m| @elems << "Rearview::Configuration #{m} : #{self[m]}" } @elems.join("\n") end |
#verify? ⇒ Boolean
35 36 37 |
# File 'lib/rearview/configuration.rb', line 35 def verify? verify end |
#with_argv(argv) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/rearview/configuration.rb', line 39 def with_argv(argv) OptionParser.new do |opts| opts.on("--[no-]preload", "Enable/disable job loading") { |v| self.preload_jobs = v } opts.on("--[no-]alerts", "Enable/disable alerts") { |v| self.enable_alerts = v } opts.on("--[no-]monitor", "Enable/disable monitor") { |v| self.enable_monitor = v } opts.on("--[no-]verify", "Enable/disable verification") { |v| self.verify = v } end.parse!(argv) end |