cossincalc 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,3 +16,10 @@ unless :to_proc.respond_to?(:to_proc)
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ # Changes working directory to the directory in which the file of the given path
21
+ # resides, and executes the given block within this directory. Passes the
22
+ # basename of the file (including extension) as an argument to the block.
23
+ def Dir.cd_to(filepath)
24
+ Dir.chdir(File.dirname(filepath)) { yield(File.basename(filepath)) }
25
+ end
@@ -31,7 +31,9 @@ EOT
31
31
  # The filename should be provided without the .png extension.
32
32
  def save_png(filename)
33
33
  save_svg(filename)
34
- system("convert \"#{filename}.svg\" \"#{filename}.png\"") || system("rsvg-convert \"#{filename}.svg\" -o \"#{filename}.png\"")
34
+ Dir.cd_to(filename) do |basename|
35
+ system("convert \"#{basename}.svg\" \"#{basename}.png\"") || system("rsvg-convert \"#{basename}.svg\" -o \"#{basename}.png\"")
36
+ end
35
37
  end
36
38
 
37
39
  # Saves a drawing of the triangle as an SVG file.
@@ -31,7 +31,7 @@ EOT
31
31
  # The filename should be provided without the .pdf extension.
32
32
  def save_pdf(filename)
33
33
  save_tex(filename)
34
- Dir.chdir(File.dirname(filename)) { `pdflatex "#{File.basename(filename)}.tex"` }
34
+ Dir.cd_to(filename) { |basename| `pdflatex "#{basename}.tex"` }
35
35
  end
36
36
 
37
37
  # Returns the content of the LaTeX document.
@@ -1,3 +1,3 @@
1
1
  module CosSinCalc
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cossincalc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 8
10
- version: 1.0.8
9
+ - 9
10
+ version: 1.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Molte Emil Strange Andersen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-20 00:00:00 +02:00
18
+ date: 2011-06-25 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21