Class: Yun::Connection
- Inherits:
-
Object
- Object
- Yun::Connection
- Defined in:
- lib/yun/model/connection.rb
Instance Method Summary collapse
- #create(attributes = {}) ⇒ Object
- #find(node_name) ⇒ Object
-
#initialize(options) ⇒ Connection
constructor
A new instance of Connection.
- #list ⇒ Object
Constructor Details
#initialize(options) ⇒ Connection
Returns a new instance of Connection.
5 6 7 |
# File 'lib/yun/model/connection.rb', line 5 def initialize @servers = Fog::Compute.new().servers end |
Instance Method Details
#create(attributes = {}) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/yun/model/connection.rb', line 9 def create attributes={} fog_attributes = FogAttributes.new attributes server = @servers.create fog_attributes server.wait_for { ready? } Node.new server end |
#find(node_name) ⇒ Object
22 23 24 25 26 |
# File 'lib/yun/model/connection.rb', line 22 def find node_name list.find do |node| node.name == node_name end end |