Method: ASIR::Environment#config_lambda

Defined in:
lib/asir/environment.rb

#config_lambdaObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/asir/environment.rb', line 90

def config_lambda
  @config_lambda ||=
    (
      file = config_rb
      $stderr.puts "#{self.class} loading #{file} ..." if @verbose >= 1
      expr = File.read(file)
      expr = "begin; lambda do | asir |; #{expr}\n end; end"
      cfg = Object.new.send(:eval, expr, binding, file, 1)
      # cfg = load file
      # $stderr.puts "#{self.class} loading #{file} DONE" if @verbose >= 1
      raise "#{file} did not return a Proc, returned a #{cfg.class}" unless Proc === cfg
      cfg
    )
end