File: sample_batch.rb

package info (click to toggle)
ruby-tioga 1.19.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 10,548 kB
  • ctags: 4,349
  • sloc: ansic: 39,885; ruby: 17,303; sh: 79; makefile: 31
file content (43 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# sample.rb

require 'Tioga/FigureMaker'
include Tioga

class MyFigures

    include Tioga
    include FigureConstants

    def t
        @figure_maker
    end

    def initialize
        @figure_maker = FigureMaker.default
        t.def_eval_function { |str| eval(str) }
        t.def_figure("Blue") { blue }
        t.def_figure("Red") { red }
        t.save_dir = 'figures_out'
    end

    def blue
        t.fill_color = Blue
        t.fill_frame
    end

    def red
        t.fill_color = Red
        t.fill_frame
    end
    
   def do_one(figure_name, pdffile)
      t.make_pdf(figure_name)
      syscmd = 'mv ' + t.save_dir + '/' + figure_name + '.pdf ' + pdffile
      puts syscmd
      system(syscmd)
   end

end

MyFigures.new
FigureMaker.default.eval_function("do_one('Blue','Blue.pdf')")