Class: Metaphor

Inherits:
Object
  • Object
show all
Defined in:
lib/metaphor.rb,
lib/metaphor/processor/detour.rb,
lib/metaphor/input/stdin_input.rb,
lib/metaphor/processor/wiretap.rb,
lib/metaphor/processor/print_message.rb

Defined Under Namespace

Modules: Input, Processor

Constant Summary collapse

VERSION =
'0.2.1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMetaphor

Returns a new instance of Metaphor.



5
6
7
# File 'lib/metaphor.rb', line 5

def initialize
  self.processors = []
end

Instance Attribute Details

#processorsObject

Returns the value of attribute processors.



3
4
5
# File 'lib/metaphor.rb', line 3

def processors
  @processors
end

Instance Method Details

#call(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/metaphor.rb', line 9

def call(*args)
  case args.size
  when 1
    while message = args.first.get
      process_message(*message)
    end
  when 2
    process_message(*args)
  end
end