Class: Auger::Connection
- Inherits:
-
Object
- Object
- Auger::Connection
- Defined in:
- lib/auger/connection.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#options ⇒ Object
Returns the value of attribute options.
-
#requests ⇒ Object
Returns the value of attribute requests.
-
#response ⇒ Object
Returns the value of attribute response.
-
#roles(*names) ⇒ Object
Returns the value of attribute roles.
Class Method Summary collapse
Instance Method Summary collapse
-
#do_open(server) ⇒ Object
call plugin open() and return plugin-specific connection object, or exception.
-
#initialize(port) ⇒ Connection
constructor
A new instance of Connection.
- #method_missing(method, arg) ⇒ Object
Constructor Details
#initialize(port) ⇒ Connection
Returns a new instance of Connection.
12 13 14 15 16 |
# File 'lib/auger/connection.rb', line 12 def initialize(port) @options = {:port => port} @roles = [] @requests = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, arg) ⇒ Object
23 24 25 |
# File 'lib/auger/connection.rb', line 23 def method_missing(method, arg) @options[method] = arg end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/auger/connection.rb', line 4 def connection @connection end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/auger/connection.rb', line 4 def @options end |
#requests ⇒ Object
Returns the value of attribute requests.
4 5 6 |
# File 'lib/auger/connection.rb', line 4 def requests @requests end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/auger/connection.rb', line 4 def response @response end |
#roles(*names) ⇒ Object
Returns the value of attribute roles.
4 5 6 |
# File 'lib/auger/connection.rb', line 4 def roles @roles end |
Class Method Details
.load(port, &block) ⇒ Object
6 7 8 9 10 |
# File 'lib/auger/connection.rb', line 6 def self.load(port, &block) connection = new(port) connection.instance_eval(&block) connection end |
Instance Method Details
#do_open(server) ⇒ Object
call plugin open() and return plugin-specific connection object, or exception
28 29 30 31 32 33 34 35 |
# File 'lib/auger/connection.rb', line 28 def do_open(server) = @options.merge(server.) begin self.open(server.name, ) rescue => e e end end |