Class: Model::Application
- Inherits:
-
Object
- Object
- Model::Application
- Defined in:
- lib/models/application.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #category ⇒ Object
- #deployment_plan_with_description(description) ⇒ Object
- #deployment_plans ⇒ Object
- #description ⇒ Object
-
#initialize(node, repository) ⇒ Application
constructor
A new instance of Application.
- #name ⇒ Object
- #open_questions ⇒ Object
- #question_with_text(text) ⇒ Object
- #questions ⇒ Object
- #requirement_with_description(description) ⇒ Object
- #requirements ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(node, repository) ⇒ Application
Returns a new instance of Application.
5 6 7 |
# File 'lib/models/application.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/application.rb', line 3 def query @query end |
Instance Method Details
#category ⇒ Object
57 58 59 60 61 62 |
# File 'lib/models/application.rb', line 57 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 |
#deployment_plan_with_description(description) ⇒ Object
53 54 55 |
# File 'lib/models/application.rb', line 53 def deployment_plan_with_description(description) deployment_plans.find { |a| a.description == description } end |
#deployment_plans ⇒ Object
47 48 49 50 51 |
# File 'lib/models/application.rb', line 47 def deployment_plans query.values(LV.hasDeploymentPlan).map do |node| DeploymentPlan.new(node, repo) end end |
#description ⇒ Object
21 22 23 |
# File 'lib/models/application.rb', line 21 def description query.value(LV.description) end |
#name ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/models/application.rb', line 13 def name if query.value_exists?(RDF::Vocab::FOAF.name) query.value(RDF::Vocab::FOAF.name) else query.value(LV.name) end end |
#open_questions ⇒ Object
30 31 32 |
# File 'lib/models/application.rb', line 30 def open_questions questions.select { |q| not q.has_answer? } end |
#question_with_text(text) ⇒ Object
34 35 36 |
# File 'lib/models/application.rb', line 34 def question_with_text(text) questions.find { |q| q.text == text } end |
#questions ⇒ Object
25 26 27 28 |
# File 'lib/models/application.rb', line 25 def questions list = repo.query([nil, RDF.type, QV.Question]).map { |s| s.subject } list.map { |node| Question.new(node, repo) } end |
#requirement_with_description(description) ⇒ Object
43 44 45 |
# File 'lib/models/application.rb', line 43 def requirement_with_description(description) requirements.find { |r| r.description == description } end |
#requirements ⇒ Object
38 39 40 41 |
# File 'lib/models/application.rb', line 38 def requirements list = repo.query([nil, RDF.type, QV.Requirement]).map { |s| s.subject } list.map { |node| Requirement.new(node, repo) } end |
#uri ⇒ Object
9 10 11 |
# File 'lib/models/application.rb', line 9 def uri query.node_uri end |