Class: Logirel::VS::Solution
- Inherits:
-
Object
- Object
- Logirel::VS::Solution
- Defined in:
- lib/logirel/vs/solution.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#projects ⇒ Object
readonly
Returns the value of attribute projects.
Instance Method Summary collapse
- #find_project(defaults = nil) ⇒ Object
- #has_test_projects? ⇒ Boolean
- #has_web_projects? ⇒ Boolean
-
#initialize(slfile) ⇒ Solution
constructor
A new instance of Solution.
- #test_projects ⇒ Object
- #web_projects ⇒ Object
Constructor Details
#initialize(slfile) ⇒ Solution
Returns a new instance of Solution.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/logirel/vs/solution.rb', line 71 def initialize(slfile) @file = File.("#{slfile}") throw "Solution #{@file} must exist." unless File.exist?(@file) @name = File.basename(@file, ".sln") @path = File.dirname(@file) @projects = [] populate_projects File.read(@file) end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
66 67 68 |
# File 'lib/logirel/vs/solution.rb', line 66 def file @file end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
67 68 69 |
# File 'lib/logirel/vs/solution.rb', line 67 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
68 69 70 |
# File 'lib/logirel/vs/solution.rb', line 68 def path @path end |
#projects ⇒ Object (readonly)
Returns the value of attribute projects.
69 70 71 |
# File 'lib/logirel/vs/solution.rb', line 69 def projects @projects end |
Instance Method Details
#find_project(defaults = nil) ⇒ Object
82 83 84 |
# File 'lib/logirel/vs/solution.rb', line 82 def find_project(defaults=nil) projects.find{|p| yield p} || OpenStruct.new(defaults) end |
#has_test_projects? ⇒ Boolean
86 87 88 |
# File 'lib/logirel/vs/solution.rb', line 86 def has_test_projects? test_projects.count > 0 end |
#has_web_projects? ⇒ Boolean
94 95 96 |
# File 'lib/logirel/vs/solution.rb', line 94 def has_web_projects? web_projects.count > 0 end |
#test_projects ⇒ Object
90 91 92 |
# File 'lib/logirel/vs/solution.rb', line 90 def test_projects projects.select { |p| p.test? || p.name =~ /(Test|Tests)$/ } end |
#web_projects ⇒ Object
98 99 100 |
# File 'lib/logirel/vs/solution.rb', line 98 def web_projects projects.select {|p| p.web? } end |