Class: PVN::TextLines
- Inherits:
-
Object
- Object
- PVN::TextLines
- Includes:
- Logue::Loggable
- Defined in:
- lib/pvn/util/textlines.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
Instance Method Summary collapse
- #advance_line(offset = 1) ⇒ Object
- #has_line? ⇒ Boolean
-
#initialize(lines) ⇒ TextLines
constructor
A new instance of TextLines.
- #line(offset = 0) ⇒ Object
- #match_line(re, offset = 0) ⇒ Object
Constructor Details
#initialize(lines) ⇒ TextLines
Returns a new instance of TextLines.
13 14 15 16 |
# File 'lib/pvn/util/textlines.rb', line 13 def initialize lines @lines = lines @lidx = 0 end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
11 12 13 |
# File 'lib/pvn/util/textlines.rb', line 11 def lines @lines end |
Instance Method Details
#advance_line(offset = 1) ⇒ Object
30 31 32 |
# File 'lib/pvn/util/textlines.rb', line 30 def advance_line offset = 1 @lidx += offset end |
#has_line? ⇒ Boolean
26 27 28 |
# File 'lib/pvn/util/textlines.rb', line 26 def has_line? @lidx < @lines.length end |
#line(offset = 0) ⇒ Object
22 23 24 |
# File 'lib/pvn/util/textlines.rb', line 22 def line offset = 0 @lines[@lidx + offset] end |
#match_line(re, offset = 0) ⇒ Object
18 19 20 |
# File 'lib/pvn/util/textlines.rb', line 18 def match_line re, offset = 0 re.match line(offset) end |