Class: BinderCore::Console
- Inherits:
-
Object
- Object
- BinderCore::Console
- Defined in:
- lib/binder_core/console.rb
Overview
TODO: Document this
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
- #continue? ⇒ Boolean
- #defaults(param) ⇒ Object
- #error(message) ⇒ Object
- #errors ⇒ Object
-
#halt ⇒ Object
Stop the compilation process NB: it cannot be restarted.
-
#initialize(settings) ⇒ Console
constructor
A new instance of Console.
- #log(message = nil) ⇒ Object
- #warn(message) ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize(settings) ⇒ Console
Returns a new instance of Console.
8 9 10 11 12 |
# File 'lib/binder_core/console.rb', line 8 def initialize(settings) @settings = settings @continue = true @stack = Debug::Stack.new end |
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
6 7 8 |
# File 'lib/binder_core/console.rb', line 6 def stack @stack end |
Instance Method Details
#continue? ⇒ Boolean
46 47 48 |
# File 'lib/binder_core/console.rb', line 46 def continue? @continue end |
#defaults(param) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/binder_core/console.rb', line 14 def defaults(param) if param.is_a? String or param.is_a? Symbol then return @settings.send(param) if @settings.prop_list.include? param.to_sym end param.keys.each do |key| @settings.send "#{key}=", param[key] if @settings.prop_list.include? "#{key}=".to_sym end end |
#error(message) ⇒ Object
37 38 39 40 |
# File 'lib/binder_core/console.rb', line 37 def error() self.errors.insert 0, :message => , :stack => stack.trace halt end |
#errors ⇒ Object
42 43 44 |
# File 'lib/binder_core/console.rb', line 42 def errors @errors ||= [] end |
#halt ⇒ Object
Stop the compilation process NB: it cannot be restarted
59 60 61 |
# File 'lib/binder_core/console.rb', line 59 def halt @continue = false end |
#log(message = nil) ⇒ Object
23 24 25 26 27 |
# File 'lib/binder_core/console.rb', line 23 def log( = nil) @log ||= [] return @log if .nil? @log.insert 0, end |
#warn(message) ⇒ Object
29 30 31 |
# File 'lib/binder_core/console.rb', line 29 def warn() self.warnings.insert 0, end |
#warnings ⇒ Object
33 34 35 |
# File 'lib/binder_core/console.rb', line 33 def warnings @warnings ||= [] end |