Class: Ec2spec::HostResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2spec/host_result.rb

Constant Summary collapse

MONTH_OF_DAYS =
31
NA_VALUE =
'N/A'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, days = nil) ⇒ HostResult



10
11
12
13
14
# File 'lib/ec2spec/host_result.rb', line 10

def initialize(host, days = nil)
  @host = host
  @backend = nil
  @days = days || MONTH_OF_DAYS
end

Instance Attribute Details

#backendObject

Returns the value of attribute backend.



6
7
8
# File 'lib/ec2spec/host_result.rb', line 6

def backend
  @backend
end

#cpuObject

Returns the value of attribute cpu.



6
7
8
# File 'lib/ec2spec/host_result.rb', line 6

def cpu
  @cpu
end

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/ec2spec/host_result.rb', line 6

def host
  @host
end

#instance_idObject

Returns the value of attribute instance_id.



6
7
8
# File 'lib/ec2spec/host_result.rb', line 6

def instance_id
  @instance_id
end

#instance_typeObject

Returns the value of attribute instance_type.



7
8
9
# File 'lib/ec2spec/host_result.rb', line 7

def instance_type
  @instance_type
end

#memoryObject

Returns the value of attribute memory.



6
7
8
# File 'lib/ec2spec/host_result.rb', line 6

def memory
  @memory
end

#price_per_unitObject



32
33
34
# File 'lib/ec2spec/host_result.rb', line 32

def price_per_unit
  @price_per_unit ||= @offer_file.price_per_unit
end

Instance Method Details

#na_valuesObject



16
17
18
19
20
21
22
# File 'lib/ec2spec/host_result.rb', line 16

def na_values
  @instance_type = NA_VALUE
  @instance_id = NA_VALUE
  @memory = NA_VALUE
  @cpu = NA_VALUE
  @price_per_unit = NA_VALUE
end

#price_per_monthObject



36
37
38
39
# File 'lib/ec2spec/host_result.rb', line 36

def price_per_month
  return NA_VALUE if @price_per_unit == NA_VALUE
  @price_per_unit * 24 * @days
end