class Bookbinder::Streams::FilterStream

Attributes

matcher_regex[R]
stream[R]

Public Class Methods

new(matcher_regex, stream) click to toggle source
# File lib/bookbinder/streams/filter_stream.rb, line 4
def initialize(matcher_regex, stream)
  @matcher_regex = matcher_regex
  @stream = stream
end

Public Instance Methods

<<(line) click to toggle source
# File lib/bookbinder/streams/filter_stream.rb, line 13
def <<(line)
  stream << line.gsub("\n", '') if line.match(matcher_regex)
end
puts(line) click to toggle source
# File lib/bookbinder/streams/filter_stream.rb, line 9
def puts(line)
  stream.puts(line.gsub("\n", '')) if line.match(matcher_regex)
end