Module: CloudCostTracker::Extensions::FogModel
- Included in:
- Fog::Model
- Defined in:
- lib/cloud_cost_tracker/extensions/fog_model.rb
Overview
Adds convenience methods to Fog::Model instances for tracking billing info
Instance Method Summary collapse
-
#billing_codes ⇒ Array [<String>, <String>]
Returns this resource’s billing codes.
-
#code(key, value) ⇒ Object
Adds a billing code to this cloud computing resource (Has no effect if the identical key is alreay set).
-
#remove_code(key, value) ⇒ Object
Adds a billing code to this cloud computing resource (Has no effect if the identical key is alreay set).
Instance Method Details
#billing_codes ⇒ Array [<String>, <String>]
Returns this resource’s billing codes
28 29 30 31 |
# File 'lib/cloud_cost_tracker/extensions/fog_model.rb', line 28 def billing_codes @_billng_codes ||= Array.new @_billng_codes end |
#code(key, value) ⇒ Object
Adds a billing code to this cloud computing resource (Has no effect if the identical key is alreay set)
10 11 12 13 14 15 |
# File 'lib/cloud_cost_tracker/extensions/fog_model.rb', line 10 def code(key, value) @_billng_codes ||= Array.new if not @_billng_codes.include?([key, value]) @_billng_codes.push [key, value] end end |
#remove_code(key, value) ⇒ Object
Adds a billing code to this cloud computing resource (Has no effect if the identical key is alreay set)
21 22 23 24 |
# File 'lib/cloud_cost_tracker/extensions/fog_model.rb', line 21 def remove_code(key, value) @_billng_codes ||= Array.new @_billng_codes.delete [key, value] end |