Sha256: 2ddaf2bb60a20b466464e9d2c4406d4f799d719b2402b66d8348cb956c0e9690

Contents?: true

Size: 947 Bytes

Versions: 49

Compression:

Stored size: 947 Bytes

Contents

module OldSql
  module ReportDesign
    class ChartParser
      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
      
      def self.report_design_path
        app_path = Rails.public_path.split("/")
        app_path.delete_at(-1)
        app_path = app_path.join("/")
        app_path << "/config/old_sql/report_design"
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
old_sql-1.65.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.64.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.63.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.62.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.61.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.60.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.59.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.58.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.57.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.56.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.55.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.54.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.53.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.52.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.51.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.50.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.49.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.48.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.47.0 lib/old_sql/report_design/chart_parser.rb
old_sql-1.46.0 lib/old_sql/report_design/chart_parser.rb