Class: RD::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/rd/filter.rb

Defined Under Namespace

Modules: FileInclude

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mode = :target, &block) ⇒ Filter

Returns a new instance of Filter.



10
11
12
13
# File 'lib/rd/filter.rb', line 10

def initialize(mode = :target, &block)
  @mode = mode
  @block = block
end

Instance Attribute Details

#modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/rd/filter.rb', line 8

def mode
  @mode
end

Instance Method Details

#call(inn) ⇒ Object

inn, out: RD::Part



16
17
18
19
20
21
22
23
24
# 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