Class: Peg::Parser::Input
- Inherits:
-
Object
- Object
- Peg::Parser::Input
- Defined in:
- lib/peg.backup/parser/input.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
6 7 8 |
# File 'lib/peg.backup/parser/input.rb', line 6 def content @content end |
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
6 7 8 |
# File 'lib/peg.backup/parser/input.rb', line 6 def pos @pos end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 25 |
# File 'lib/peg.backup/parser/input.rb', line 21 def ==(other) self.class === other && other.content == content && other.pos == pos end |
#advance(by = 1) ⇒ Object
8 9 10 |
# File 'lib/peg.backup/parser/input.rb', line 8 def advance(by=1) self.class.new(content.drop(by), pos+by) end |
#empty? ⇒ Boolean
12 |
# File 'lib/peg.backup/parser/input.rb', line 12 def empty? = content.empty? |
#show(count) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/peg.backup/parser/input.rb', line 14 def show(count) raise ArgumentError, "count must be an integer > 5" unless Integer === count && count > 5 return content.join("") if content.length < count "#{content.take(count-3).join}..." end |