Class: Model::Capability
- Inherits:
-
Object
- Object
- Model::Capability
- Defined in:
- lib/models/capability.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #actuators ⇒ Object
- #description ⇒ Object
- #device ⇒ Object
-
#initialize(node, repository) ⇒ Capability
constructor
A new instance of Capability.
- #property ⇒ Object
- #question ⇒ Object
- #sensors ⇒ Object
- #type ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(node, repository) ⇒ Capability
Returns a new instance of Capability.
5 6 7 |
# File 'lib/models/capability.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/capability.rb', line 3 def query @query end |
Instance Method Details
#actuators ⇒ Object
39 40 41 42 43 |
# File 'lib/models/capability.rb', line 39 def actuators query.values(LV.actuator).map do |node| Device.new node, query.repository end end |
#description ⇒ Object
9 10 11 |
# File 'lib/models/capability.rb', line 9 def description query.value(LV.description) end |
#device ⇒ Object
24 25 26 27 |
# File 'lib/models/capability.rb', line 24 def device device_node = query.value(LV.device) Device.new device_node, query.repository if device_node end |
#property ⇒ Object
29 30 31 32 |
# File 'lib/models/capability.rb', line 29 def property node = query.value(LV.property) Property.new node, query.repository if node end |
#question ⇒ Object
34 35 36 37 |
# File 'lib/models/capability.rb', line 34 def question node = query.value(LV.question) Question.new node, query.repository if node end |
#sensors ⇒ Object
45 46 47 48 49 |
# File 'lib/models/capability.rb', line 45 def sensors query.values(LV.sensor).map do |node| Device.new node, query.repository end end |
#type ⇒ Object
17 18 19 20 21 22 |
# File 'lib/models/capability.rb', line 17 def type value = query.value(RDF.type) return nil if value.nil? t = value.to_s.remove LV.prefix Helper.underscore(t).to_sym end |