Class: BetterHtml::Tokenizer::BaseErb
- Inherits:
-
Erubi::Engine
- Object
- Erubi::Engine
- BetterHtml::Tokenizer::BaseErb
- Defined in:
- lib/better_html/tokenizer/base_erb.rb
Direct Known Subclasses
Constant Summary collapse
- REGEXP_WITHOUT_TRIM =
/<%(={1,2})?(.*?)()?%>([ \t]*\r?\n)?/m
- STMT_TRIM_MATCHER =
/\A(-|#)?(.*?)([-=])?\z/m
- EXPR_TRIM_MATCHER =
/\A(.*?)([-=])?\z/m
Instance Attribute Summary collapse
-
#current_position ⇒ Object
readonly
Returns the value of attribute current_position.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(buffer) ⇒ BaseErb
constructor
A new instance of BaseErb.
Constructor Details
#initialize(buffer) ⇒ BaseErb
Returns a new instance of BaseErb.
18 19 20 21 22 23 24 25 26 |
# File 'lib/better_html/tokenizer/base_erb.rb', line 18 def initialize(buffer) raise ArgumentError, "first argument must be Parser::Source::Buffer" unless buffer.is_a?(::Parser::Source::Buffer) @buffer = buffer @tokens = [] @current_position = 0 super(buffer.source, regexp: REGEXP_WITHOUT_TRIM, trim: false) end |
Instance Attribute Details
#current_position ⇒ Object (readonly)
Returns the value of attribute current_position.
16 17 18 |
# File 'lib/better_html/tokenizer/base_erb.rb', line 16 def current_position @current_position end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
15 16 17 |
# File 'lib/better_html/tokenizer/base_erb.rb', line 15 def tokens @tokens end |