Class: Caldecott::Client::Tunnel
- Inherits:
-
Object
- Object
- Caldecott::Client::Tunnel
- Defined in:
- lib/caldecott-client/tunnel/tunnel.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#dst_host ⇒ Object
readonly
Returns the value of attribute dst_host.
-
#dst_port ⇒ Object
readonly
Returns the value of attribute dst_port.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(url, options) ⇒ Tunnel
constructor
A new instance of Tunnel.
- #read ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #write(data) ⇒ Object
Constructor Details
Instance Attribute Details
#dst_host ⇒ Object (readonly)
Returns the value of attribute dst_host.
20 21 22 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 20 def dst_host @dst_host end |
#dst_port ⇒ Object (readonly)
Returns the value of attribute dst_port.
20 21 22 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 20 def dst_port @dst_port end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
20 21 22 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 20 def logger @logger end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
20 21 22 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 20 def token @token end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
20 21 22 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 20 def url @url end |
Class Method Details
.for_url(url, options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 7 def self.for_url(url, ) case url when /^https?/ HttpTunnel.new(url, ) when /^ws/ # TODO: implement raise NotImplemented, "Web Sockets support coming soon" else raise InvalidTunnelUrl, "Invalid tunnel url: #{url}, only HTTP and WS schemas supported" end end |
Instance Method Details
#close ⇒ Object
31 32 33 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 31 def close @closed = true end |
#closed? ⇒ Boolean
35 36 37 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 35 def closed? @closed end |
#read ⇒ Object
47 48 49 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 47 def read raise NotImplemented, "#read not implemented for #{self.class.name}" end |
#start ⇒ Object
39 40 41 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 39 def start raise NotImplemented, "#start not implemented for #{self.class.name}" end |
#stop ⇒ Object
51 52 53 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 51 def stop raise NotImplemented, "#stop not implemented for #{self.class.name}" end |
#write(data) ⇒ Object
43 44 45 |
# File 'lib/caldecott-client/tunnel/tunnel.rb', line 43 def write(data) raise NotImplemented, "#write not implemented for #{self.class.name}" end |