class RD::Filter

Attributes

mode[RW]

Public Class Methods

new(mode = :target, &block) click to toggle source
# File lib/rd/filter.rb, line 10
def initialize(mode = :target, &block)
  @mode = mode
  @block = block
end

Public Instance Methods

call(inn) click to toggle source

inn, out: RD::Part

# File lib/rd/filter.rb, line 16
def call(inn)
  out = RD::Part.new("", nil, "w")
  result = @block.call(inn, out)
  if out.empty?
    result
  else
    out.to_s
  end
end