Class: DslEvaluator::App
- Inherits:
-
Object
- Object
- DslEvaluator::App
- Extended by:
- Memoist
- Includes:
- Singleton
- Defined in:
- lib/dsl_evaluator/app.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #configure {|@config| ... } ⇒ Object
- #default_logger ⇒ Object
- #defaults ⇒ Object
-
#initialize ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize ⇒ App
Returns a new instance of App.
9 10 11 |
# File 'lib/dsl_evaluator/app.rb', line 9 def initialize @config = defaults end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/dsl_evaluator/app.rb', line 8 def config @config end |
Instance Method Details
#configure {|@config| ... } ⇒ Object
36 37 38 |
# File 'lib/dsl_evaluator/app.rb', line 36 def configure yield(@config) end |
#default_logger ⇒ Object
31 32 33 |
# File 'lib/dsl_evaluator/app.rb', line 31 def default_logger Logger.new(ENV["DSL_EVALUATOR_LOG_PATH"] || $stderr) end |
#defaults ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dsl_evaluator/app.rb', line 13 def defaults config = ActiveSupport::OrderedOptions.new config.logger = default_logger config.logger.formatter = Logger::Formatter.new config.logger.level = ENV["DSL_EVALUATOR_LOG_LEVEL"] || :info config.on_exception = :raise config.root = Dir.pwd config.backtrace = ActiveSupport::OrderedOptions.new config.backtrace.reject_pattern = nil # dont use .reject. Seems its used internally by ActiveSupport::OrderedOptions config.backtrace.select_pattern = nil config end |