Class: VagrantPlugins::Cloudstack::Model::CloudstackResource
- Inherits:
-
Object
- Object
- VagrantPlugins::Cloudstack::Model::CloudstackResource
- Defined in:
- lib/vagrant-cloudstack/model/cloudstack_resource.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(id, name, kind) ⇒ CloudstackResource
constructor
A new instance of CloudstackResource.
- #is_id_undefined? ⇒ Boolean
- #is_name_undefined? ⇒ Boolean
- #is_undefined? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(id, name, kind) ⇒ CloudstackResource
Returns a new instance of CloudstackResource.
8 9 10 11 12 13 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 8 def initialize(id, name, kind) raise 'Resource must have a kind' if kind.nil? || kind.empty? @id = id @name = name @kind = kind end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 5 def id @id end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
6 7 8 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 6 def kind @kind end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 5 def name @name end |
Instance Method Details
#is_id_undefined? ⇒ Boolean
19 20 21 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 19 def is_id_undefined? id.nil? || id.empty? end |
#is_name_undefined? ⇒ Boolean
23 24 25 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 23 def is_name_undefined? name.nil? || name.empty? end |
#is_undefined? ⇒ Boolean
15 16 17 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 15 def is_undefined? is_id_undefined? and is_name_undefined? end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/vagrant-cloudstack/model/cloudstack_resource.rb', line 27 def to_s "#{kind} - #{id || '<unknown id>'}:#{name || '<unknown name>'}" end |