Module: DslEvaluator

Extended by:
DslEvaluator, Memoist
Includes:
Printer::Concern
Included in:
DslEvaluator
Defined in:
lib/dsl_evaluator.rb,
lib/dsl_evaluator/app.rb,
lib/dsl_evaluator/logger.rb,
lib/dsl_evaluator/printer.rb,
lib/dsl_evaluator/version.rb,
lib/dsl_evaluator/autoloader.rb

Defined Under Namespace

Classes: App, Autoloader, Error, Logger, Printer

Constant Summary collapse

VERSION =
"0.3.2"

Instance Method Summary collapse

Methods included from Printer::Concern

#check_line_number!, #pretty_home, #pretty_path, #print_code

Instance Method Details

#configObject


43
44
45
# File 'lib/dsl_evaluator.rb', line 43

def config
  App.instance.config
end

#configure(&block) ⇒ Object


39
40
41
# File 'lib/dsl_evaluator.rb', line 39

def configure(&block)
  App.instance.configure(&block)
end

#evaluate_file(path) ⇒ Object


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dsl_evaluator.rb', line 18

def evaluate_file(path)
  return unless path && File.file?(path)
  instance_eval(IO.read(path), path)
rescue Exception => e
  Printer.new(e).print
  case config.on_exception
  when :rescue
    # do nothing
  when :exit
    exit 1
  else # :raise
    raise
  end
end

#loggerObject


35
36
37
# File 'lib/dsl_evaluator.rb', line 35

def logger
  config.logger
end