Class: Cartridge
- Inherits:
-
RestApi::Base
- Object
- ActiveResource::Base
- RestApi::Base
- Cartridge
- Includes:
- Comparable
- Defined in:
- app/models/cartridge.rb
Overview
The REST API model object representing a cartridge instance.
Defined Under Namespace
Classes: BuildRelation, ScaleRelation
Instance Attribute Summary collapse
-
#gears ⇒ Object
readonly
Returns the value of attribute gears.
-
#git_url ⇒ Object
Returns the value of attribute git_url.
-
#ssh_string ⇒ Object
Returns the value of attribute ssh_string.
-
#ssh_url ⇒ Object
Returns the value of attribute ssh_url.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#buildable? ⇒ Boolean
The build attributes are used for view manipulation only.
- #builds ⇒ Object
- #builds? ⇒ Boolean
- #builds_with(cart, gear_group) ⇒ Object
- #cartridge_type ⇒ Object
- #collocated_with ⇒ Object
- #gear_count ⇒ Object
- #grouping ⇒ Object
- #runs_on(new_gears) ⇒ Object
-
#scales ⇒ Object
deprecated.
- #scales? ⇒ Boolean
-
#scales_with(*args) ⇒ Object
deprecated with args.
- #supported_scales_from ⇒ Object
- #supported_scales_to ⇒ Object
- #type ⇒ Object
- #type=(type) ⇒ Object
Methods inherited from RestApi::Base
alias_attribute, aliased_attributes, allow_anonymous?, #as, #as=, #assign_attributes, attr_alters, #attributes=, calculated_attributes, #clone, configuration=, connection, custom_id, delete, #dup, #duplicate_errors, element_path, exception_for_code, find, find_one, get, #get, #has_exit_code?, headers, #initialize, #load, #load_remote_errors, on_exit_code, #raise_on_invalid, #reload, remote_errors_for, #remote_results, #save!, #save_with_change_tracking, shared_connection, singleton?, #to_json, translate_api_error, use_patch_on_update?, #valid?
Methods included from ActiveResource::Associations
#belongs_to, #has_many, #has_one
Constructor Details
This class inherits a constructor from RestApi::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RestApi::Base
Instance Attribute Details
#gears ⇒ Object (readonly)
Returns the value of attribute gears.
19 20 21 |
# File 'app/models/cartridge.rb', line 19 def gears @gears end |
#git_url ⇒ Object
Returns the value of attribute git_url.
18 19 20 |
# File 'app/models/cartridge.rb', line 18 def git_url @git_url end |
#ssh_string ⇒ Object
Returns the value of attribute ssh_string.
18 19 20 |
# File 'app/models/cartridge.rb', line 18 def ssh_string @ssh_string end |
#ssh_url ⇒ Object
Returns the value of attribute ssh_url.
18 19 20 |
# File 'app/models/cartridge.rb', line 18 def ssh_url @ssh_url end |
Instance Method Details
#<=>(other) ⇒ Object
94 95 96 97 |
# File 'app/models/cartridge.rb', line 94 def <=>(other) return 0 if name == other.name cartridge_type <=> other.cartridge_type end |
#buildable? ⇒ Boolean
The build attributes are used for view manipulation only
deprecated
77 78 79 |
# File 'app/models/cartridge.rb', line 77 def buildable? git_url.present? and .include? :web_framework end |
#builds ⇒ Object
80 81 82 |
# File 'app/models/cartridge.rb', line 80 def builds @builds || BuildRelation::Null end |
#builds? ⇒ Boolean
83 84 85 |
# File 'app/models/cartridge.rb', line 83 def builds? @builds.present? end |
#builds_with(cart, gear_group) ⇒ Object
86 87 88 |
# File 'app/models/cartridge.rb', line 86 def builds_with(cart, gear_group) @builds = BuildRelation.new cart, gear_group.is_a?(String) ? gear_group : gear_group.name end |
#cartridge_type ⇒ Object
99 100 101 |
# File 'app/models/cartridge.rb', line 99 def cartridge_type @cartridge_type ||= CartridgeType.cached.find(name) end |
#collocated_with ⇒ Object
29 30 31 |
# File 'app/models/cartridge.rb', line 29 def collocated_with @attributes[:collocated_with] ||= [] end |
#gear_count ⇒ Object
53 54 55 |
# File 'app/models/cartridge.rb', line 53 def gear_count @gears.length end |
#grouping ⇒ Object
90 91 92 |
# File 'app/models/cartridge.rb', line 90 def grouping @grouping ||= [name].concat(collocated_with).uniq.sort end |
#runs_on(new_gears) ⇒ Object
47 48 49 |
# File 'app/models/cartridge.rb', line 47 def runs_on(new_gears) gears.concat(new_gears) end |
#scales ⇒ Object
deprecated
58 59 60 |
# File 'app/models/cartridge.rb', line 58 def scales @scales || ScaleRelation::Null end |
#scales? ⇒ Boolean
62 63 64 |
# File 'app/models/cartridge.rb', line 62 def scales? @scales.present? || supported_scales_from != supported_scales_to end |
#scales_with(*args) ⇒ Object
deprecated with args
67 68 69 70 71 |
# File 'app/models/cartridge.rb', line 67 def scales_with(*args) args.length == 0 ? super : begin @scales = ScaleRelation.new args[0], args[1].is_a?(String) ? args[1] : args[1].name, args[2] end end |
#supported_scales_from ⇒ Object
33 34 35 |
# File 'app/models/cartridge.rb', line 33 def supported_scales_from super || 1 end |
#supported_scales_to ⇒ Object
36 37 38 |
# File 'app/models/cartridge.rb', line 36 def supported_scales_to super || 1 end |
#type ⇒ Object
39 40 41 |
# File 'app/models/cartridge.rb', line 39 def type @attributes[:type] end |
#type=(type) ⇒ Object
43 44 45 |
# File 'app/models/cartridge.rb', line 43 def type=(type) @attributes[:type]=type end |