Class: Tellstick::ProxyIO
- Inherits:
-
Object
- Object
- Tellstick::ProxyIO
show all
- Defined in:
- lib/tellstick/proxy_io.rb
Overview
Proxy between usb dongle and driver
Instance Method Summary
collapse
Constructor Details
#initialize(klass, *args) ⇒ ProxyIO
Returns a new instance of ProxyIO.
21
22
23
24
25
26
|
# File 'lib/tellstick/proxy_io.rb', line 21
def initialize(klass,*args)
@init_args = args
@class_to_proxy = klass
@tio = nil
open
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id) ⇒ Object
28
29
30
|
# File 'lib/tellstick/proxy_io.rb', line 28
def method_missing(method_id)
@tio.send(method_id)
end
|
Instance Method Details
#close ⇒ Object
40
41
42
43
|
# File 'lib/tellstick/proxy_io.rb', line 40
def close
@tio.close unless @tio == nil
@tio = nil
end
|
#gets ⇒ Object
51
52
53
54
|
# File 'lib/tellstick/proxy_io.rb', line 51
def gets
open
@tio.gets
end
|
#open ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/tellstick/proxy_io.rb', line 32
def open
return unless @tio == nil
create_io_instance
attach_connected
return if @tio.private_methods.include?("open")
@tio.open
end
|
#puts(input) ⇒ Object
45
46
47
48
49
|
# File 'lib/tellstick/proxy_io.rb', line 45
def puts(input)
open
@tio.puts(input)
gets
end
|
#to_s ⇒ Object
56
57
58
59
|
# File 'lib/tellstick/proxy_io.rb', line 56
def to_s
open
@tio
end
|