Class: Plot

Inherits:
Object
  • Object
show all
Defined in:
lib/artemo/plot.rb

Overview

Note:

This class plots file to pdf

Class Method Summary collapse

Class Method Details

.call(path, hash) ⇒ Object

Note:

This method is plotting data to pdf.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/artemo/plot.rb', line 7

def self.call(path, hash)
  begin
    name = File.basename(path, '.txt')
    Prawn::Document.generate "#{name}.pdf" do
      data = {views: hash}
      chart data, legend: false, label: true, format: :percentage 
    end
    puts "#{name}.pdf"
  rescue
    nil
  end
end