Module: Tioga::IRB_Tioga
- Defined in:
- lib/Tioga/irb_tioga.rb
Instance Method Summary collapse
- #check_have_loaded ⇒ Object
- #cmds ⇒ Object
- #do_figs(fignums, view) ⇒ Object
- #h ⇒ Object
- #l ⇒ Object
- #list_cmds ⇒ Object
- #m(fignums = nil) ⇒ Object
- #o(filename = nil) ⇒ Object
- #p(fignums = nil) ⇒ Object
- #r ⇒ Object
- #s(fignums = nil) ⇒ Object
- #set_figure_num(num) ⇒ Object
Instance Method Details
#check_have_loaded ⇒ Object
10 11 12 13 14 |
# File 'lib/Tioga/irb_tioga.rb', line 10 def check_have_loaded return true unless ($tioga_figure_filename == nil) || ($tioga_figure_filename.length == 0) puts "Must open a file first." return false end |
#cmds ⇒ Object
96 97 98 |
# File 'lib/Tioga/irb_tioga.rb', line 96 def cmds l end |
#do_figs(fignums, view) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/Tioga/irb_tioga.rb', line 27 def do_figs(fignums,view) if fignums.kind_of?String fignums = $tioga_ui.parse_figs(fignums) end if fignums == nil $tioga_ui.make_all_pdfs(view) set_figure_num(0) else if fignums.kind_of?Integer fignums += FigureMaker.default.num_figures if fignums < 0 fignums = [fignums] end $tioga_ui.do_fignums(fignums,view) set_figure_num(fignums[-1]) end return true end |
#h ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/Tioga/irb_tioga.rb', line 111 def h puts '' puts " Command description" puts " o 'filename' opens the named tioga file (with extension .rb)." puts " o opens the current tioga file (i.e., reload)." puts " l lists the defined figures by number and name." puts " m <figs> makes PDFs without showing them in the viewer." puts " s <figs> makes and shows PDFs, each in a separate viewer window." puts " p <figs> makes PDFs and shows the portfolio as a multi-page document." puts " r reloads the current file and reshows the current figure." puts " h helpfully prints this list of commands." puts "\n Since the filename extension is known, you can skip typing it if you like." puts "\n If <figs> is omitted, then tioga does all the figures defined in the file" puts " ordered by their definition index numbers." puts "\n Otherwise, <figs> must be either" puts " a valid ruby array index number for a figure (can be negative), or" puts " an array of index numbers for a set of figures, or" puts " a string with a space-less, comma-separated list of figure indices and ranges, or" puts " a string giving a defined figure name (as supplied to def_figure in the tioga file)." puts '' puts " For example, s 'Plot1' makes and shows the pdf for the figure named Plot1," puts " and p '5,0..3,-1' makes a portfolio with the figure having index 5 on page 1," puts " followed by pages showing the figures with indices 0, 1, 2, 3, and -1." puts "\n The viewer for showing PDFs is specified by the $pdf_viewer variable." puts " The default value can be set by creating a .tiogainit file in your home directory." puts " Your current setting for $pdf_viewer is " + $pdf_viewer + '.' puts " To change it, edit ~/.tiogainit to add the line $pdf_viewer = 'my viewer command'." puts " The command tioga uses to show a pdf is $pdf_viewer + ' ' + full_PDF_filename." puts '' return true end |
#l ⇒ Object
106 107 108 109 |
# File 'lib/Tioga/irb_tioga.rb', line 106 def l $tioga_ui.list_figures return true end |
#list_cmds ⇒ Object
101 102 103 |
# File 'lib/Tioga/irb_tioga.rb', line 101 def list_cmds l end |
#m(fignums = nil) ⇒ Object
51 52 53 54 55 |
# File 'lib/Tioga/irb_tioga.rb', line 51 def m(fignums=nil) return unless check_have_loaded do_figs(fignums,false) return true end |
#o(filename = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/Tioga/irb_tioga.rb', line 16 def o(filename=nil) filename = $tioga_figure_filename if filename == nil return if filename == nil || filename.length == 0 # this happens if just give shell command irb_tioga with no filename filename = $tioga_ui.fix_filename(filename) result = $tioga_ui.setdir_and_load(filename) return false if result == nil $tioga_figure_filename = result $tioga_figure_num = 0 return true end |
#p(fignums = nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/Tioga/irb_tioga.rb', line 62 def p(fignums=nil) return unless check_have_loaded if fignums.kind_of?String fignums = $tioga_ui.parse_figs(fignums) end if fignums == nil $tioga_ui.make_portfolio(true) elsif fignums.kind_of?Integer fignums += FigureMaker.default.num_figures if fignums < 0 $tioga_ui.make_portfolio(true,[fignums]) else $tioga_ui.make_portfolio(true,fignums) end set_figure_num(fignums[-1]) unless fignums == nil return true end |
#r ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/Tioga/irb_tioga.rb', line 79 def r return unless check_have_loaded if $tioga_figure_num != nil figname = FigureMaker.default.figure_names[$tioga_figure_num] else figname = nil end o(nil) if figname != nil num = FigureMaker.default.figure_names.index(figname) if num != nil s(num) end end end |
#s(fignums = nil) ⇒ Object
45 46 47 48 49 |
# File 'lib/Tioga/irb_tioga.rb', line 45 def s(fignums=nil) return unless check_have_loaded do_figs(fignums,true) return true end |
#set_figure_num(num) ⇒ Object
57 58 59 60 |
# File 'lib/Tioga/irb_tioga.rb', line 57 def set_figure_num(num) num = FigureMaker.default.figure_names.index(num) unless num == nil || num.kind_of?(Integer) $tioga_figure_num = num end |