Class: MetaParse::MetaScanner
- Defined in:
- lib/meta_parse.rb
Overview
End Interface
Instance Attribute Summary collapse
-
#parser ⇒ Object
Returns the value of attribute parser.
Instance Method Summary collapse
-
#initialize(string, parser = nil) ⇒ MetaScanner
constructor
A new instance of MetaScanner.
-
#match_char(char) ⇒ Object
This is a special case and could actually be handled by match_string if necessary.
- #match_string(str, position2 = 0) ⇒ Object
- #scan(spec) ⇒ Object
Constructor Details
#initialize(string, parser = nil) ⇒ MetaScanner
Returns a new instance of MetaScanner.
64 65 66 67 |
# File 'lib/meta_parse.rb', line 64 def initialize(string, parser=nil) super string @parser = parser end |
Instance Attribute Details
#parser ⇒ Object
Returns the value of attribute parser.
62 63 64 |
# File 'lib/meta_parse.rb', line 62 def parser @parser end |
Instance Method Details
#match_char(char) ⇒ Object
This is a special case and could actually be handled by match_string if necessary.
70 71 72 73 74 75 76 |
# File 'lib/meta_parse.rb', line 70 def match_char(char) c = peek(1) if c == char self.pos += 1 c end end |
#match_string(str, position2 = 0) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/meta_parse.rb', line 78 def match_string(str, position2=0) if (string.equal_at(pos, str, position2)) self.pos += str.length str end end |