4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/old_sql/report_design/chart_parser.rb', line 4
def self.read_file file_to_read
raise ArgumentError, 'Argument file is null.' unless !file_to_read.nil?
full_path = "#{report_design_path}/#{file_to_read}"
raise ArgumentError, "File #{full_path} not found." unless File.exists?(full_path)
@chart = Chart.new
template = File.read("#{report_design_path}/#{file_to_read}")
design_template = YAML.load(Erubis::Eruby.new(template).result)
design_template.each do |type, i|
@chart.type = type
i.each do |slice|
@chart.add(slice)
end
end
@chart
end
|