Class: Fuzz::FileObject::LinePointer
- Inherits:
-
Object
- Object
- Fuzz::FileObject::LinePointer
- Defined in:
- lib/fuzz/fzzr.rb
Constant Summary collapse
- FZZR_ENABLE_RE =
/X11_FUZZ\: enable ([^\s]+)/- FZZR_DISABLE_RE =
/X11_FUZZ\: disable ([^\s]+)/
Instance Attribute Summary collapse
-
#err_lines ⇒ Object
readonly
Returns the value of attribute err_lines.
Instance Method Summary collapse
- #bof? ⇒ Boolean
- #eof? ⇒ Boolean
- #fzzr_disabled? ⇒ Boolean
-
#initialize(lines, fzzr_id) ⇒ LinePointer
constructor
A new instance of LinePointer.
- #line_nr ⇒ Object
- #mark_error(ln = nil) ⇒ Object
- #move(offs) ⇒ Object
- #reset ⇒ Object
- #set_text_at(offs, txt) ⇒ Object
- #text ⇒ Object
- #text=(txt) ⇒ Object
- #text_at(offs) ⇒ Object
- #to_eof ⇒ Object
Constructor Details
#initialize(lines, fzzr_id) ⇒ LinePointer
Returns a new instance of LinePointer.
134 135 136 137 138 139 |
# File 'lib/fuzz/fzzr.rb', line 134 def initialize(lines, fzzr_id) @lines = lines @fzzr_id = fzzr_id.to_s @err_lines = [] reset end |
Instance Attribute Details
#err_lines ⇒ Object (readonly)
Returns the value of attribute err_lines.
129 130 131 |
# File 'lib/fuzz/fzzr.rb', line 129 def err_lines @err_lines end |
Instance Method Details
#bof? ⇒ Boolean
185 186 187 |
# File 'lib/fuzz/fzzr.rb', line 185 def bof? @line_nr <= 0 end |
#eof? ⇒ Boolean
182 183 184 |
# File 'lib/fuzz/fzzr.rb', line 182 def eof? @line_nr >= @lines.size end |
#fzzr_disabled? ⇒ Boolean
140 141 142 |
# File 'lib/fuzz/fzzr.rb', line 140 def fzzr_disabled? @fzzr_disabled end |
#line_nr ⇒ Object
143 144 145 |
# File 'lib/fuzz/fzzr.rb', line 143 def line_nr @line_nr+1 end |
#mark_error(ln = nil) ⇒ Object
188 189 190 |
# File 'lib/fuzz/fzzr.rb', line 188 def mark_error(ln = nil) @err_lines << (ln || (@line_nr+1)) end |
#move(offs) ⇒ Object
166 167 168 169 170 171 172 173 |
# File 'lib/fuzz/fzzr.rb', line 166 def move(offs) if offs < 0 _backward(-offs) unless bof? else _forward(offs) unless eof? end self.line_nr end |
#reset ⇒ Object
174 175 176 177 178 |
# File 'lib/fuzz/fzzr.rb', line 174 def reset @line_nr = 0 @fzzr_disabled = false _check_fzzr_escape end |
#set_text_at(offs, txt) ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/fuzz/fzzr.rb', line 153 def set_text_at(offs, txt) ln = @line_nr+offs if ln>=0 && ln<@lines.size return (@lines[ln] = txt) end nil end |
#text ⇒ Object
160 161 162 |
# File 'lib/fuzz/fzzr.rb', line 160 def text text_at(0) end |
#text=(txt) ⇒ Object
163 164 165 |
# File 'lib/fuzz/fzzr.rb', line 163 def text=(txt) set_text_at(0, txt) end |
#text_at(offs) ⇒ Object
146 147 148 149 150 151 152 |
# File 'lib/fuzz/fzzr.rb', line 146 def text_at(offs) ln = @line_nr+offs if ln>=0 && ln<@lines.size return @lines[ln] end nil end |
#to_eof ⇒ Object
179 180 181 |
# File 'lib/fuzz/fzzr.rb', line 179 def to_eof _forward(@lines.size - @line_nr) end |