Class: Emb::MultiProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/emb/multi.rb

Defined Under Namespace

Classes: PairCollector

Instance Method Summary collapse

Constructor Details

#initialize ⇒ MultiProxy

Returns a new instance of MultiProxy.



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

def initialize
  @pairs = []
end

Instance Method Details

#[](name) ⇒ Object



9
10
11
# File 'lib/emb/multi.rb', line 9

def [](name)
  PairCollector.new(@pairs, name.to_sym)
end

#run ⇒ Object



13
14
15
16
17
# File 'lib/emb/multi.rb', line 13

def run
  args = @pairs.flat_map { |pair| [pair[:model].to_s, pair[:text]] }

  Emb.send_command("EMB.MULTI", *args)
end