Class: Hawkular::Inventory::ResourceType
- Inherits:
-
Object
- Object
- Hawkular::Inventory::ResourceType
- Defined in:
- lib/hawkular/inventory/entities.rb
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
Id of the resource type.
-
#operations ⇒ List<Operation>
readonly
Operations associated with this type.
-
#properties ⇒ Hash<String,String>
readonly
Properties of this resource type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(hash) ⇒ ResourceType
constructor
A new instance of ResourceType.
-
#to_h ⇒ Hash<String,Object>
Returns a hash representation of the resource type.
Constructor Details
#initialize(hash) ⇒ ResourceType
Returns a new instance of ResourceType.
56 57 58 59 60 61 |
# File 'lib/hawkular/inventory/entities.rb', line 56 def initialize(hash) @id = hash['id'] @properties = hash['properties'] || {} @operations = (hash['operations'] || []).map { |op| Operation.new(op) } @_hash = hash.dup end |
Instance Attribute Details
#id ⇒ String (readonly)
Returns Id of the resource type.
50 51 52 |
# File 'lib/hawkular/inventory/entities.rb', line 50 def id @id end |
#operations ⇒ List<Operation> (readonly)
Returns Operations associated with this type.
54 55 56 |
# File 'lib/hawkular/inventory/entities.rb', line 54 def operations @operations end |
#properties ⇒ Hash<String,String> (readonly)
Returns Properties of this resource type.
52 53 54 |
# File 'lib/hawkular/inventory/entities.rb', line 52 def properties @properties end |
Instance Method Details
#==(other) ⇒ Object
63 64 65 |
# File 'lib/hawkular/inventory/entities.rb', line 63 def ==(other) equal?(other) || other.class == self.class && other.id == @id end |
#to_h ⇒ Hash<String,Object>
Returns a hash representation of the resource type
69 70 71 |
# File 'lib/hawkular/inventory/entities.rb', line 69 def to_h @_hash.dup end |