Module: Bulldogger::CollectorEnvironment

Defined in:
lib/bulldogger/collector_environment.rb

Overview

Builds a child environment that loads one collector. Each command remains responsible for its collector-specific variables.

Class Method Summary collapse

Class Method Details

.build(collector_name, variables) ⇒ Object



9
10
11
12
13
14
# File 'lib/bulldogger/collector_environment.rb', line 9

def build(collector_name, variables)
  collector = File.expand_path(collector_name, __dir__)
  option = "-r#{collector}"
  rubyopt = ENV["RUBYOPT"]
  variables.merge("RUBYOPT" => rubyopt.nil? || rubyopt.empty? ? option : "#{rubyopt} #{option}")
end