Sha256: b9931fd7bb2918e16337a74571314dd0478c3c5318a067b7be1fdc118c71307d

Contents?: true

Size: 908 Bytes

Versions: 2

Compression:

Stored size: 908 Bytes

Contents

require 'active_support'
require 'active_support/core_ext/class'
require 'active_support/core_ext/hash'
require 'active_support/core_ext/string'
require 'dsl_evaluator/version'
require 'memoist'
require 'rainbow/ext/string'

require "dsl_evaluator/autoloader"
DslEvaluator::Autoloader.setup

module DslEvaluator
  extend Memoist
  include Printer::Concern

  class Error < StandardError; end

  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

  mattr_accessor :backtrace_reject

  def logger
    config.logger
  end

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

  def config
    App.instance.config
  end
  memoize :config

  extend self
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dsl_evaluator-0.3.1 lib/dsl_evaluator.rb
dsl_evaluator-0.3.0 lib/dsl_evaluator.rb