Class: Emb::Proxy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, name) ⇒ Proxy

Returns a new instance of Proxy.



7
8
9
10
# File 'lib/emb/proxy.rb', line 7

def initialize(client, name)
  @client = client
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#[](text, *texts) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/emb/proxy.rb', line 12

def [](text, *texts)
  set = Array(@client.send_command('EMB', @name.to_s, text, *texts))
  result = set.map { |entry| entry.unpack('e*') }

  return result.first if result.size == 1

  result
end

#inspectObject



21
22
23
# File 'lib/emb/proxy.rb', line 21

def inspect
  "#<Emb::Proxy #{@name}>"
end