Class: Albacore::Solution
- Inherits:
-
Object
- Object
- Albacore::Solution
- Includes:
- Logging
- Defined in:
- lib/albacore/solution.rb
Overview
a solution encapsulates the properties from a sln file.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#path_base ⇒ Object
readonly
Returns the value of attribute path_base.
Instance Method Summary collapse
-
#initialize(path) ⇒ Solution
constructor
A new instance of Solution.
-
#path ⇒ Object
get the path of the solution file.
- #project_paths ⇒ Object
- #projects ⇒ Object
-
#to_s ⇒ Object
Gets the path of the solution file.
Methods included from Logging
#debug, #err, #error, #fatal, #info, #puts, #trace, #warn
Constructor Details
#initialize(path) ⇒ Solution
Returns a new instance of Solution.
11 12 13 14 15 16 |
# File 'lib/albacore/solution.rb', line 11 def initialize path raise ArgumentError, 'solution path does not exist' unless File.exists? path.to_s path = path.to_s unless path.is_a? String @content = open(path) @path_base, @filename = File.split path end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/albacore/solution.rb', line 9 def content @content end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
9 10 11 |
# File 'lib/albacore/solution.rb', line 9 def filename @filename end |
#path_base ⇒ Object (readonly)
Returns the value of attribute path_base.
9 10 11 |
# File 'lib/albacore/solution.rb', line 9 def path_base @path_base end |
Instance Method Details
#path ⇒ Object
get the path of the solution file
31 32 33 |
# File 'lib/albacore/solution.rb', line 31 def path File.join @path_base, @filename end |
#project_paths ⇒ Object
24 25 26 27 28 |
# File 'lib/albacore/solution.rb', line 24 def project_paths project_matches.map { |matches| matches[:location] } .select { |path| File.extname(path).end_with? 'proj' } end |
#projects ⇒ Object
18 19 20 21 22 |
# File 'lib/albacore/solution.rb', line 18 def projects project_paths.map { |path| File.join(@path_base, path) } .select { |path| File.file?(path) } .map {|path| Albacore::Project.new(File.absolute_path(path)) } end |
#to_s ⇒ Object
Gets the path of the solution file
36 37 38 |
# File 'lib/albacore/solution.rb', line 36 def to_s path end |