class FakePipe::TextBlock
Blocks are considered between the start_text?
and end_text?
Any lines in between the start and end are passed to parse
@start_match is available in case there's information in there parse
could find interesting.
Attributes
delegate[RW]
start_match[RW]
table[RW]
Public Class Methods
new(delegate:)
click to toggle source
# File lib/fake_pipe/text_block.rb, line 14 def initialize(delegate:) self.delegate = delegate end
Public Instance Methods
end_text?(line)
click to toggle source
# File lib/fake_pipe/text_block.rb, line 26 def end_text?(line) end_pattern && !!end_pattern.match(line) end
match_start_text(line)
click to toggle source
# File lib/fake_pipe/text_block.rb, line 18 def match_start_text(line) start_pattern && (self.start_match = start_pattern.match(line)) end
on_start_text(_match, _line)
click to toggle source
Override to do something interesting with the initial match or line
# File lib/fake_pipe/text_block.rb, line 31 def on_start_text(_match, _line) end
parse(_line)
click to toggle source
# File lib/fake_pipe/text_block.rb, line 34 def parse(_line) raise NotImplementedError, "#{self} doesn't implement `parse`." end
start_text?()
click to toggle source
# File lib/fake_pipe/text_block.rb, line 22 def start_text? !start_match.nil? end