Class: Bob::Compiler::Base
- Inherits:
-
Object
- Object
- Bob::Compiler::Base
- Defined in:
- lib/bob/compiler/base.rb
Instance Method Summary collapse
- #errors ⇒ Object
- #errors? ⇒ Boolean
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #result ⇒ Object (also: #to_s)
- #valid? ⇒ Boolean
- #warnings ⇒ Object
- #warnings? ⇒ Boolean
- #well_formed? ⇒ Boolean
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 |
# File 'lib/bob/compiler/base.rb', line 9 def initialize @buffer = Buffer.new @warnings = [] @errors = [] @compiled = false end |
Instance Method Details
#errors ⇒ Object
20 21 22 |
# File 'lib/bob/compiler/base.rb', line 20 def errors ensure_compiled { @errors } end |
#errors? ⇒ Boolean
32 33 34 |
# File 'lib/bob/compiler/base.rb', line 32 def errors? ensure_compiled { @errors.present? } end |
#result ⇒ Object Also known as: to_s
40 41 42 |
# File 'lib/bob/compiler/base.rb', line 40 def result ensure_compiled { @buffer.string } end |
#valid? ⇒ Boolean
36 37 38 |
# File 'lib/bob/compiler/base.rb', line 36 def valid? ensure_compiled { @errors.blank? } end |
#warnings ⇒ Object
16 17 18 |
# File 'lib/bob/compiler/base.rb', line 16 def warnings ensure_compiled { @warnings } end |
#warnings? ⇒ Boolean
24 25 26 |
# File 'lib/bob/compiler/base.rb', line 24 def warnings? ensure_compiled { @warnings.present? } end |
#well_formed? ⇒ Boolean
28 29 30 |
# File 'lib/bob/compiler/base.rb', line 28 def well_formed? ensure_compiled { valid? && @warnings.blank? } end |