Sha256: c7e2eefec7760b3f1ec786cde0eab5cd2cfb9b23ad47af44b971bc565931212f

Contents?: true

Size: 1.51 KB

Versions: 16

Compression:

Stored size: 1.51 KB

Contents

class ComputationCarrierInstanceClass < ActiveRecord::Base
  set_primary_key :name
  
  belongs_to :computation_carrier, :foreign_key => 'computation_carrier_name'
  
  falls_back_on :name => 'fallback',
                :electricity_intensity => lambda { ComputationCarrierInstanceClass.find_by_name('Amazon m1.small').electricity_intensity },
                :electricity_intensity_units => lambda { ComputationCarrierInstanceClass.find_by_name('Amazon m1.small').electricity_intensity_units }
  
  col :name
  col :computation_carrier_name
  col :instance_class
  col :electricity_intensity, :type => :float
  col :electricity_intensity_units
  
  # FIXME TODO verify that computation carrier name appears in computation_carriers
  
  # verify "Electricity intensity should be more than zero" do
  #   ComputationCarrierInstanceClass.all.each do |instance_class|
  #     unless instance_class.electricity_intensity > 0
  #       raise "Invalid electricity intensity for ComputationCarrierInstanceClass #{instance_class.name}: #{instance_class.electricity_intensity} (should be > 0)"
  #     end
  #   end
  # end
  # 
  # verify "Electricity intensity units should be kilowatts" do
  #   ComputationCarrierInstanceClass.all.each do |instance_class|
  #     unless instance_class.electricity_intensity_units == 'kilowatts'
  #       raise "Invalid electricity intensity units for ComputationCarrierInstanceClass #{instance_class.name}: #{instance_class.electricity_intensity_units} (should be kilowatts)"
  #     end
  #   end
  # end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
earth-0.11.7 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.6 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.5 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.4 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.3 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.2 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.1 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.11.0 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.7.0 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.6 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.5 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.4 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.3 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.2 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.1 lib/earth/computation/computation_carrier_instance_class.rb
earth-0.6.0 lib/earth/computation/computation_carrier_instance_class.rb