Class: LinodeCluster::Node

Inherits:
Delegator
  • Object
show all
Defined in:
lib/linode_cluster/node.rb

Overview

Node class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj, client) ⇒ Node

Returns a new instance of Node.



6
7
8
9
10
# File 'lib/linode_cluster/node.rb', line 6

def initialize(obj, client)
  super obj # pass obj to Delegator constructor, required
  @delegate_sd_obj = obj # store obj for future use
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/linode_cluster/node.rb', line 4

def client
  @client
end

#ip_addressObject

Returns the value of attribute ip_address.



4
5
6
# File 'lib/linode_cluster/node.rb', line 4

def ip_address
  @ip_address
end

Instance Method Details

#__getobj__Object



12
13
14
# File 'lib/linode_cluster/node.rb', line 12

def __getobj__
  @delegate_sd_obj # return object we are delegating to, required
end

#__setobj__(obj) ⇒ Object



16
17
18
# File 'lib/linode_cluster/node.rb', line 16

def __setobj__(obj)
  @delegate_sd_obj = obj
end

#cost_per_monthObject



37
38
39
# File 'lib/linode_cluster/node.rb', line 37

def cost_per_month
  plan.price
end

#nameObject



29
30
31
# File 'lib/linode_cluster/node.rb', line 29

def name
  label
end

#planObject



33
34
35
# File 'lib/linode_cluster/node.rb', line 33

def plan
  client.find_plan_by_id(planid)
end

#regionObject



20
21
22
# File 'lib/linode_cluster/node.rb', line 20

def region
  client.find_datacenter_by_id(datacenterid).abbr
end

#sizeObject



24
25
26
27
# File 'lib/linode_cluster/node.rb', line 24

def size
  return nil if plan.nil?
  plan.ram
end