Class: Model::Installation
- Inherits:
-
Object
- Object
- Model::Installation
- Defined in:
- lib/models/installation.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #category ⇒ Object
- #description ⇒ Object
-
#initialize(node, repository) ⇒ Installation
constructor
A new instance of Installation.
- #name ⇒ Object
- #properties ⇒ Object
- #questions ⇒ Object
- #type ⇒ Object
- #used_devices ⇒ Object
Constructor Details
#initialize(node, repository) ⇒ Installation
Returns a new instance of Installation.
5 6 7 |
# File 'lib/models/installation.rb', line 5 def initialize(node, repository) @query = NodeQuery.new(node, repository) end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
3 4 5 |
# File 'lib/models/installation.rb', line 3 def query @query end |
Instance Method Details
#category ⇒ Object
21 22 23 24 25 26 |
# File 'lib/models/installation.rb', line 21 def category value = query.value(LV.category) return nil if value.nil? t = value.to_s.remove LV.prefix Helper.underscore(t).to_sym end |
#description ⇒ Object
17 18 19 |
# File 'lib/models/installation.rb', line 17 def description query.value(LV.description) end |
#name ⇒ Object
13 14 15 |
# File 'lib/models/installation.rb', line 13 def name query.value(LV.name) end |
#properties ⇒ Object
40 41 42 43 44 |
# File 'lib/models/installation.rb', line 40 def properties query.values(LV.property).map do |node| Property.new(node, query.repository) end end |
#questions ⇒ Object
34 35 36 37 38 |
# File 'lib/models/installation.rb', line 34 def questions query.values(LV.question).map do |node| Question.new(node, query.repository) end end |
#type ⇒ Object
9 10 11 |
# File 'lib/models/installation.rb', line 9 def type query.value(LV.type).to_s end |
#used_devices ⇒ Object
28 29 30 31 32 |
# File 'lib/models/installation.rb', line 28 def used_devices query.values(LV.uses).map do |node| InstallationUsedDevice.new(node, query.repository) end end |