Class: Infrataster::Resources::ServerResource

Inherits:
Object
  • Object
show all
Defined in:
lib/infrataster/resources/server_resource.rb

Constant Summary collapse

Error =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ServerResource

Returns a new instance of ServerResource.



8
9
10
# File 'lib/infrataster/resources/server_resource.rb', line 8

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/infrataster/resources/server_resource.rb', line 6

def name
  @name
end

Instance Method Details

#serverObject



18
19
20
# File 'lib/infrataster/resources/server_resource.rb', line 18

def server
  Server.find_by_name(@name)
end

#to_sObject



12
13
14
15
16
# File 'lib/infrataster/resources/server_resource.rb', line 12

def to_s
  desc = "server '#{server.name}'"
  desc += " from '#{server.from.name}'" if server.from
  desc
end