class Reportier::Defaults

Attributes

persister[RW]
reporters[RW]
reporting_vars[RW]
trackers[RW]

Public Class Methods

global() click to toggle source
# File lib/reportier/defaults.rb, line 6
def self.global
  @global ||= new
end
new(opts={}) click to toggle source
# File lib/reportier/defaults.rb, line 10
def initialize(opts={})
  initialize_defaults
  @reporting_vars.merge! Hash(opts[:reporting_vars])
end

Public Instance Methods

configure() { |self| ... } click to toggle source
# File lib/reportier/defaults.rb, line 15
def configure
  yield self
end
reporters=(opts) click to toggle source
# File lib/reportier/defaults.rb, line 28
def reporters=(opts)
  @reporters = opts
  _require_reporter_libraries
end
trackers=(opts) click to toggle source
# File lib/reportier/defaults.rb, line 23
def trackers=(opts)
  @trackers = Hash.new(0)
  @trackers.merge! opts
end
update_reporting_vars(hash) click to toggle source
# File lib/reportier/defaults.rb, line 19
def update_reporting_vars(hash)
  @reporting_vars.merge!(hash)
end

Private Instance Methods

_require_reporter_libraries() click to toggle source
# File lib/reportier/defaults.rb, line 43
def _require_reporter_libraries
  @reporters.each do |name, lib|
    require lib if lib
  end
end
initialize_defaults() click to toggle source
# File lib/reportier/defaults.rb, line 36
def initialize_defaults
  @trackers          = Hash.new(0)
  @reporting_vars = Hash.new
  @reporters      = { console: nil, logger: 'logger' }
  @persister      = :memory
end