Class: Refi::Template
- Inherits:
-
Object
- Object
- Refi::Template
- Defined in:
- lib/template_refi.rb
Constant Summary collapse
- @@parser =
TemplateGrammarParser.new
Class Method Summary collapse
Instance Method Summary collapse
- #get_chunks ⇒ Object
-
#initialize(template_str) ⇒ Template
constructor
A new instance of Template.
- #is_valid ⇒ Object
Constructor Details
#initialize(template_str) ⇒ Template
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/template_refi.rb', line 16 def initialize(template_str) @str = template_str @parse_result = @@parser.parse(template_str) unless is_valid # TODO puts "template string not valid:" pp @str puts "errors:" Template.simple_report_errors puts "invalid template string" #dperr(1004,"invalid template string") end end |
Class Method Details
.simple_report_errors ⇒ Object
38 39 40 41 42 |
# File 'lib/template_refi.rb', line 38 def self.simple_report_errors puts @@parser.failure_reason puts @@parser.failure_line puts @@parser.failure_column end |
Instance Method Details
#get_chunks ⇒ Object
44 45 46 |
# File 'lib/template_refi.rb', line 44 def get_chunks @val = @parse_result.content end |
#is_valid ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/template_refi.rb', line 30 def is_valid if @parse_result return true else return false end end |