Class: FastHaml::LineParser
- Inherits:
-
Object
- Object
- FastHaml::LineParser
- Defined in:
- lib/fast_haml/line_parser.rb
Instance Attribute Summary collapse
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
Instance Method Summary collapse
- #has_next? ⇒ Boolean
-
#initialize(template_str) ⇒ LineParser
constructor
A new instance of LineParser.
- #next_line ⇒ Object
Constructor Details
#initialize(template_str) ⇒ LineParser
Returns a new instance of LineParser.
5 6 7 8 |
# File 'lib/fast_haml/line_parser.rb', line 5 def initialize(template_str) @lines = template_str.each_line.map { |line| line.chomp.rstrip } @lineno = 0 end |
Instance Attribute Details
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
3 4 5 |
# File 'lib/fast_haml/line_parser.rb', line 3 def lineno @lineno end |
Instance Method Details
#has_next? ⇒ Boolean
19 20 21 |
# File 'lib/fast_haml/line_parser.rb', line 19 def has_next? @lineno < @lines.size end |
#next_line ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/fast_haml/line_parser.rb', line 10 def next_line line = move_next if is_multiline?(line) next_multiline(line) else line end end |