Class: Belt::CLI::EnvironmentConfig::ConfigEvaluator
- Inherits:
-
Object
- Object
- Belt::CLI::EnvironmentConfig::ConfigEvaluator
- Defined in:
- lib/belt/cli/environment_config.rb
Instance Method Summary collapse
- #evaluate(content, filename) ⇒ Object
-
#initialize(config) ⇒ ConfigEvaluator
constructor
A new instance of ConfigEvaluator.
Constructor Details
#initialize(config) ⇒ ConfigEvaluator
Returns a new instance of ConfigEvaluator.
48 49 50 |
# File 'lib/belt/cli/environment_config.rb', line 48 def initialize(config) @config = config end |
Instance Method Details
#evaluate(content, filename) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/belt/cli/environment_config.rb', line 52 def evaluate(content, filename) config = @config sandbox = Module.new belt_proxy = Module.new do define_singleton_method(:configure) do |&block| block.call(ConfigDSL.new(config)) end end sandbox.const_set(:Belt, belt_proxy) sandbox.module_eval(content, filename) end |