Class: Bob::Compiler::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bob/compiler/base.rb

Direct Known Subclasses

Template, Walker

Instance Method Summary collapse

Constructor Details

#initializeBase

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

#errorsObject



20
21
22
# File 'lib/bob/compiler/base.rb', line 20

def errors
  ensure_compiled { @errors }
end

#errors?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/bob/compiler/base.rb', line 32

def errors?
  ensure_compiled { @errors.present? }
end

#resultObject 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

Returns:

  • (Boolean)


36
37
38
# File 'lib/bob/compiler/base.rb', line 36

def valid?
  ensure_compiled { @errors.blank? }
end

#warningsObject



16
17
18
# File 'lib/bob/compiler/base.rb', line 16

def warnings
  ensure_compiled { @warnings }
end

#warnings?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/bob/compiler/base.rb', line 24

def warnings?
  ensure_compiled { @warnings.present? }
end

#well_formed?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/bob/compiler/base.rb', line 28

def well_formed?
  ensure_compiled { valid? && @warnings.blank? }
end