Class: Emb::MultiProxy
- Inherits:
-
Object
- Object
- Emb::MultiProxy
- Defined in:
- lib/emb/multi.rb
Defined Under Namespace
Classes: PairCollector
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(client) ⇒ MultiProxy
constructor
A new instance of MultiProxy.
- #run ⇒ Object
Constructor Details
#initialize(client) ⇒ MultiProxy
Returns a new instance of MultiProxy.
5 6 7 8 |
# File 'lib/emb/multi.rb', line 5 def initialize(client) @client = client @pairs = [] end |
Instance Method Details
#[](name) ⇒ Object
10 11 12 |
# File 'lib/emb/multi.rb', line 10 def [](name) PairCollector.new(@pairs, name.to_sym) end |
#run ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/emb/multi.rb', line 14 def run args = @pairs.flat_map { |pair| [pair[:model].to_s, pair[:text]] } @client .send_command('EMB.MULTI', *args) .map { |entry| entry.unpack('e*') } end |