Class: Soul::SolutionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/soul/solution_parser.rb

Instance Method Summary collapse

Instance Method Details

#get_project_file(project_line) ⇒ Object



26
27
28
# File 'lib/soul/solution_parser.rb', line 26

def get_project_file(project_line)
  project_line.split("\"")[5]
end

#get_project_name(project_line) ⇒ Object



22
23
24
# File 'lib/soul/solution_parser.rb', line 22

def get_project_name(project_line)
  project_line.split("\"")[3]
end

#parse(filename) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/soul/solution_parser.rb', line 3

def parse(filename)
  solution = Solution.new

  File.open(filename).read().each do |line|
    if line.start_with? "Project" 
      project = parse_line line
      solution.add_project project
    end
  end

  return solution
end

#parse_line(line) ⇒ Object



16
17
18
19
20
# File 'lib/soul/solution_parser.rb', line 16

def parse_line(line)
  name = get_project_name line
  project_file = get_project_file line
  return Project.new(name, project_file)
end