Class: SMQueue::StdioLineAdapter

Inherits:
Adapter show all
Defined in:
lib/smqueue/adapters/stdio.rb

Direct Known Subclasses

ReadlineAdapter, StdioAdapter

Defined Under Namespace

Classes: Configuration

Instance Method Summary collapse

Methods inherited from Adapter

#close, create, #open

Methods inherited from Doodle

#to_hash

Instance Method Details

#get(*args, &block) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/smqueue/adapters/stdio.rb', line 11

def get(*args, &block)
  while input = STDIN.gets
    msg = SMQueue::Message.new(:body => input)
    if block_given?
      yield(msg)
    end
  end
end

#put(*args, &block) ⇒ Object



8
9
10
# File 'lib/smqueue/adapters/stdio.rb', line 8

def put(*args, &block)
  STDOUT.puts *args
end