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(name) ⇒ Proxy

Returns a new instance of Proxy.



19
20
21
# File 'lib/emb/proxy.rb', line 19

def initialize(name)
  @name = name
end

Instance Attribute Details

#name ⇒ Object (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/emb/proxy.rb', line 17

def name
  @name
end

Instance Method Details

#[](text, *texts) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/emb/proxy.rb', line 23

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

  return result.first if result.size == 1

  result
end

#inspect ⇒ Object



32
33
34
# File 'lib/emb/proxy.rb', line 32

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