prawn 0.1.2 → 0.2.0
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.
- data/README +16 -2
- data/Rakefile +3 -3
- data/data/images/arrow.png +0 -0
- data/data/images/arrow2.png +0 -0
- data/data/images/barcode_issue.png +0 -0
- data/data/images/ruport_type0.png +0 -0
- data/examples/cell.rb +14 -3
- data/examples/chinese_text_wrapping.rb +17 -0
- data/examples/family_based_styling.rb +21 -0
- data/examples/fancy_table.rb +4 -4
- data/examples/flowing_text_with_header_and_footer.rb +72 -0
- data/examples/font_size.rb +2 -2
- data/examples/lazy_bounding_boxes.rb +19 -0
- data/examples/table.rb +13 -11
- data/examples/text_flow.rb +1 -1
- data/lib/prawn.rb +44 -15
- data/lib/prawn/compatibility.rb +20 -7
- data/lib/prawn/document.rb +72 -122
- data/lib/prawn/document/bounding_box.rb +124 -24
- data/lib/prawn/document/internals.rb +107 -0
- data/lib/prawn/document/table.rb +99 -70
- data/lib/prawn/document/text.rb +92 -314
- data/lib/prawn/errors.rb +13 -2
- data/lib/prawn/font.rb +312 -1
- data/lib/prawn/font/cmap.rb +1 -1
- data/lib/prawn/font/metrics.rb +52 -49
- data/lib/prawn/font/wrapping.rb +14 -12
- data/lib/prawn/graphics.rb +23 -74
- data/lib/prawn/graphics/cell.rb +30 -25
- data/lib/prawn/graphics/color.rb +132 -0
- data/lib/prawn/images.rb +37 -16
- data/lib/prawn/images/png.rb +29 -24
- data/lib/prawn/pdf_object.rb +3 -1
- data/spec/bounding_box_spec.rb +12 -3
- data/spec/document_spec.rb +40 -72
- data/spec/font_spec.rb +97 -0
- data/spec/graphics_spec.rb +46 -99
- data/spec/images_spec.rb +4 -21
- data/spec/pdf_object_spec.rb +8 -8
- data/spec/png_spec.rb +47 -12
- data/spec/spec_helper.rb +5 -24
- data/spec/table_spec.rb +53 -59
- data/spec/text_spec.rb +28 -93
- data/vendor/pdf-inspector/README +18 -0
- data/vendor/pdf-inspector/lib/pdf/inspector.rb +25 -0
- data/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +80 -0
- data/vendor/pdf-inspector/lib/pdf/inspector/page.rb +16 -0
- data/vendor/pdf-inspector/lib/pdf/inspector/text.rb +31 -0
- data/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +19 -0
- metadata +63 -38
- data/examples/on_page_start.rb +0 -17
- data/examples/table_bench.rb +0 -92
- data/spec/box_calculation_spec.rb +0 -17
data/README
CHANGED
@@ -4,7 +4,7 @@ just like the majestic sea creature.
|
|
4
4
|
Development on this library is made possible thanks to the many people who
|
5
5
|
donated to the Ruby Mendicant project:
|
6
6
|
|
7
|
-
http://rubymendicant.wikidot.com
|
7
|
+
http://rubymendicant.wikidot.com
|
8
8
|
|
9
9
|
RESOURCES:
|
10
10
|
|
@@ -26,5 +26,19 @@ http://groups.google.com/group/prawn-ruby
|
|
26
26
|
|
27
27
|
IRC:
|
28
28
|
|
29
|
-
|
29
|
+
Find us in #prawn on irc.freenode.net
|
30
|
+
Gregory Brown: <sandal>
|
31
|
+
James Healy: <yob>
|
32
|
+
|
33
|
+
NOTES TO DEVELOPERS:
|
30
34
|
|
35
|
+
You will need the pdf-reader and test-spec gems to run Prawn. Be sure to run
|
36
|
+
the specs on both Ruby 1.8.6 and the latest Ruby 1.9 snapshot, as both versions
|
37
|
+
are supported. 1.8.7 is *not* officially supported.
|
38
|
+
|
39
|
+
Prawn relies on PDF::Inspector, a collection of PDF::Reader backed classes
|
40
|
+
for analyzing PDF output. This is provided as a submodule in Prawn's git
|
41
|
+
repository, so be sure to do the following before running the specs:
|
42
|
+
|
43
|
+
git submodule init
|
44
|
+
git submodule update
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
|
|
4
4
|
require "rake/rdoctask"
|
5
5
|
require "rake/gempackagetask"
|
6
6
|
|
7
|
-
PRAWN_VERSION = "0.
|
7
|
+
PRAWN_VERSION = "0.2.0"
|
8
8
|
|
9
9
|
task :default => [:test]
|
10
10
|
|
@@ -35,9 +35,9 @@ end
|
|
35
35
|
desc "run all examples, and then diff them against reference PDFs"
|
36
36
|
task :examples do
|
37
37
|
mkdir_p "output"
|
38
|
-
examples = Dir["examples/*.rb"]
|
38
|
+
examples = Dir["examples/*.rb"]
|
39
39
|
t = Time.now
|
40
|
-
puts "Running Examples
|
40
|
+
puts "Running Examples"
|
41
41
|
examples.each { |file| `ruby -Ilib #{file}` }
|
42
42
|
puts "Ran in #{Time.now - t} s"
|
43
43
|
`mv *.pdf output`
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/examples/cell.rb
CHANGED
@@ -8,13 +8,13 @@ require "prawn"
|
|
8
8
|
# stuff )
|
9
9
|
Prawn::Document.generate("cell.pdf") do
|
10
10
|
cell = Prawn::Graphics::Cell.new(
|
11
|
-
:
|
11
|
+
:border_width => 3, :padding => 10, :width => 75,
|
12
12
|
:text => "You know that kittens are made of mud!", :document => self)
|
13
13
|
cell2 = Prawn::Graphics::Cell.new(
|
14
|
-
:
|
14
|
+
:border_width => 3, :padding => 10,
|
15
15
|
:text => "And that puppies are made of gravy", :document => self)
|
16
16
|
cell3 = Prawn::Graphics::Cell.new(
|
17
|
-
:
|
17
|
+
:border_width => 3, :padding => 10, :width => 100,
|
18
18
|
:text => "This is simply the way of the world", :document => self)
|
19
19
|
|
20
20
|
3.times do
|
@@ -22,6 +22,17 @@ Prawn::Document.generate("cell.pdf") do
|
|
22
22
|
cellblock << cell << cell2 << cell3
|
23
23
|
cellblock.draw
|
24
24
|
end
|
25
|
+
|
26
|
+
move_down(20)
|
27
|
+
|
28
|
+
cellblock = Prawn::Graphics::CellBlock.new(self)
|
29
|
+
cellblock << Prawn::Graphics::Cell.new(
|
30
|
+
:border_width => 3,
|
31
|
+
:padding => 10,
|
32
|
+
:borders => [:left, :top],
|
33
|
+
:width => 100,
|
34
|
+
:text => "This is simply the way of the world", :document => self)
|
35
|
+
cellblock.draw
|
25
36
|
|
26
37
|
stroke_line [100,100], [200,200]
|
27
38
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
4
|
+
require "prawn"
|
5
|
+
|
6
|
+
start = Time.now
|
7
|
+
Prawn::Document.generate("chinese_flow.pdf") do
|
8
|
+
font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
|
9
|
+
text_options.update(:wrap => :character, :size => 16)
|
10
|
+
long_text = "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事"
|
11
|
+
text long_text
|
12
|
+
|
13
|
+
# be sure to restore space based wrapping when dealing with latin scripts
|
14
|
+
text_options.update(:wrap => :spaces)
|
15
|
+
long_text = "Text with some spaces " * 25
|
16
|
+
text long_text
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
4
|
+
require "prawn"
|
5
|
+
|
6
|
+
Prawn::Document.generate("family_style.pdf") do
|
7
|
+
["Courier","Helvetica","Times-Roman"].each do |f|
|
8
|
+
[:bold,:bold_italic,:italic,:normal].each do |s|
|
9
|
+
font f, :style => s
|
10
|
+
text "I'm writing in #{f} (#{s})"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
font "Helvetica"
|
15
|
+
|
16
|
+
text "Normal"
|
17
|
+
text "Bold", :style => :bold
|
18
|
+
text "Bold Italic", :style => :bold_italic
|
19
|
+
text "Italic", :style => :italic
|
20
|
+
text "Normal"
|
21
|
+
end
|
data/examples/fancy_table.rb
CHANGED
@@ -30,7 +30,7 @@ Prawn::Document.generate("fancy_table.pdf", :page_layout => :landscape) do
|
|
30
30
|
"Drawn Side"], ["By side", "and stuff" ]],
|
31
31
|
:position => 600,
|
32
32
|
:headers => ["Col A", "Col B"],
|
33
|
-
:
|
33
|
+
:border_width => 1,
|
34
34
|
:vertical_padding => 5,
|
35
35
|
:horizontal_padding => 3,
|
36
36
|
:font_size => 10,
|
@@ -41,7 +41,7 @@ Prawn::Document.generate("fancy_table.pdf", :page_layout => :landscape) do
|
|
41
41
|
|
42
42
|
table [%w[1 2 3],%w[4 5 6],%w[7 8 9]],
|
43
43
|
:position => :center,
|
44
|
-
:
|
44
|
+
:border_width => 0,
|
45
45
|
:font_size => 40
|
46
46
|
|
47
47
|
cell [500,300],
|
@@ -49,9 +49,9 @@ Prawn::Document.generate("fancy_table.pdf", :page_layout => :landscape) do
|
|
49
49
|
"cells outside of a table with ease. Think of a 'cell' as " +
|
50
50
|
"simply a limited purpose bounding box that is meant for laying " +
|
51
51
|
"out blocks of text and optionally placing a border around it",
|
52
|
-
:width => 225, :padding => 10, :
|
52
|
+
:width => 225, :padding => 10, :border_width => 2
|
53
53
|
|
54
|
-
|
54
|
+
font.size = 24
|
55
55
|
cell [50,75],
|
56
56
|
:text => "This document demonstrates a number of Prawn's table features",
|
57
57
|
:border_style => :no_top, # :all, :no_bottom, :sides
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
4
|
+
require "prawn"
|
5
|
+
|
6
|
+
Prawn::Document.generate("flow_with_headers_and_footers.pdf") do
|
7
|
+
|
8
|
+
header margin_box.top_left do
|
9
|
+
text "Here's My Fancy Header", :size => 25, :align => :center
|
10
|
+
stroke_horizontal_rule
|
11
|
+
end
|
12
|
+
|
13
|
+
footer [margin_box.left, margin_box.bottom + 25] do
|
14
|
+
stroke_horizontal_rule
|
15
|
+
text "And here's a sexy footer", :size => 16
|
16
|
+
end
|
17
|
+
|
18
|
+
bounding_box([bounds.left, bounds.top - 50],
|
19
|
+
:width => bounds.width, :height => bounds.height - 100) do
|
20
|
+
text "this is some flowing text " * 200
|
21
|
+
|
22
|
+
move_down(20)
|
23
|
+
|
24
|
+
font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
|
25
|
+
table [["ὕαλον ϕαγεῖν", "baaar", "1" ],
|
26
|
+
["This is","a sample", "2" ],
|
27
|
+
["Table", "dont\ncha\nknow?", "3" ],
|
28
|
+
[ "It", "Rules", "4" ],
|
29
|
+
[ "It", "Rules", "4" ],
|
30
|
+
[ "It", "Rules", "4" ],
|
31
|
+
[ "It", "Rules", "4" ],
|
32
|
+
[ "It", "Rules", "4" ],
|
33
|
+
[ "It", "Rules", "4" ],
|
34
|
+
[ "It", "Rules", "4" ],
|
35
|
+
[ "It", "Rules", "4" ],
|
36
|
+
[ "It", "Rules", "4" ],
|
37
|
+
[ "It", "Rules\nwith an iron fist", "x" ],
|
38
|
+
[ "It", "Rules", "4" ],
|
39
|
+
[ "It", "Rules", "4" ],
|
40
|
+
[ "It", "Rules", "4" ],
|
41
|
+
[ "It", "Rules", "4" ],
|
42
|
+
[ "It", "Rules", "4" ],
|
43
|
+
[ "It", "Rules", "4" ],
|
44
|
+
[ "It", "Rules", "4" ],
|
45
|
+
[ "It", "Rules", "4" ],
|
46
|
+
[ "It", "Rules", "4" ],
|
47
|
+
[ "It", "Rules", "4" ],
|
48
|
+
[ "It", "Rules", "4" ],
|
49
|
+
[ "It", "Rules", "4" ],
|
50
|
+
[ "It", "Rules", "4" ],
|
51
|
+
[ "It", "Rules", "4" ],
|
52
|
+
[ "It", "Rules", "4" ],
|
53
|
+
[ "It", "Rules", "4" ],
|
54
|
+
[ "It", "Rules", "4" ],
|
55
|
+
[ "It", "Rules", "4" ],
|
56
|
+
[ "It", "Rules", "4" ],
|
57
|
+
[ "It", "Rules", "4" ],
|
58
|
+
[ "It", "Rules", "4" ],
|
59
|
+
[ "It", "Rules", "4" ],
|
60
|
+
[ "It", "Rules", "4" ]],
|
61
|
+
|
62
|
+
:font_size => 24,
|
63
|
+
:horizontal_padding => 10,
|
64
|
+
:vertical_padding => 3,
|
65
|
+
:border_width => 2,
|
66
|
+
:position => :center,
|
67
|
+
:headers => ["Column A","Column B","#"]
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
data/examples/font_size.rb
CHANGED
@@ -5,11 +5,11 @@ require "prawn"
|
|
5
5
|
|
6
6
|
Prawn::Document.generate "font_size.pdf", :page_size => "A4" do
|
7
7
|
font 'Helvetica'
|
8
|
-
|
8
|
+
font.size = 16
|
9
9
|
|
10
10
|
text 'Font at 16 point'
|
11
11
|
|
12
|
-
|
12
|
+
font.size 9 do
|
13
13
|
text 'Font at 9 point'
|
14
14
|
text 'Font at manual override 20 point', :size => 20
|
15
15
|
text 'Font at 9 point'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
require "prawn"
|
3
|
+
|
4
|
+
file = "lazy_bounding_boxes.pdf"
|
5
|
+
Prawn::Document.generate(file, :skip_page_creation => true) do
|
6
|
+
point = [bounds.right-50, bounds.bottom + 25]
|
7
|
+
page_counter = lazy_bounding_box(point, :width => 50) do
|
8
|
+
text "Page: #{page_count}"
|
9
|
+
end
|
10
|
+
|
11
|
+
10.times do
|
12
|
+
start_new_page
|
13
|
+
text "Some text"
|
14
|
+
page_counter.draw
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
data/examples/table.rb
CHANGED
@@ -5,13 +5,13 @@ require "prawn"
|
|
5
5
|
|
6
6
|
Prawn::Document.generate("table.pdf") do
|
7
7
|
font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
|
8
|
-
table [["ὕαλον ϕαγεῖν", "baaar",
|
8
|
+
table [["ὕαλον ϕαγεῖν", "baaar", "1" ],
|
9
9
|
["This is","a sample", "2" ],
|
10
10
|
["Table", "dont\ncha\nknow?", "3" ],
|
11
11
|
[ "It", "Rules", "4" ],
|
12
12
|
[ "It", "Rules", "4" ],
|
13
|
-
[ "It", "Rules", "
|
14
|
-
[ "It", "Rules", "
|
13
|
+
[ "It", "Rules", "4123231" ],
|
14
|
+
[ "It", "Rules", "22.5" ],
|
15
15
|
[ "It", "Rules", "4" ],
|
16
16
|
[ "It", "Rules", "4" ],
|
17
17
|
[ "It", "Rules", "4" ],
|
@@ -30,14 +30,16 @@ Prawn::Document.generate("table.pdf") do
|
|
30
30
|
|
31
31
|
:font_size => 24,
|
32
32
|
:horizontal_padding => 10,
|
33
|
-
:vertical_padding
|
34
|
-
:
|
35
|
-
:position
|
36
|
-
:headers
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
:vertical_padding => 3,
|
34
|
+
:border_width => 2,
|
35
|
+
:position => :center,
|
36
|
+
:headers => ["Column A","Column B","#"],
|
37
|
+
:align => {1 => :center},
|
38
|
+
:align_headers => :center
|
39
|
+
|
40
|
+
text "This should appear in the original font size, just below the table"
|
41
|
+
move_down 10
|
42
|
+
|
41
43
|
table [[ "Wide", "columns", "streeetch"],
|
42
44
|
["are","mighty fine", "streeeeeeeech"]],
|
43
45
|
:widths => { 0 => 200, 1 => 250 }, :position => 5
|
data/examples/text_flow.rb
CHANGED
@@ -54,7 +54,7 @@ Prawn::Document.generate("flow.pdf") do |pdf|
|
|
54
54
|
|
55
55
|
pdf.text "Hooray! We've conquered the evil PDF gods", :size => 36
|
56
56
|
|
57
|
-
pdf.bounding_box([100,
|
57
|
+
pdf.bounding_box([100,450], :width => 300) do
|
58
58
|
pdf.stroke_line [pdf.bounds.left, pdf.bounds.top],
|
59
59
|
[pdf.bounds.right, pdf.bounds.top]
|
60
60
|
pdf.text poem, :size => 12, :spacing => 5
|
data/lib/prawn.rb
CHANGED
@@ -6,29 +6,58 @@
|
|
6
6
|
#
|
7
7
|
# This is free software. Please see the LICENSE and COPYING files for details.
|
8
8
|
|
9
|
-
require "prawn/compatibility"
|
10
|
-
require "prawn/errors"
|
11
|
-
require "prawn/pdf_object"
|
12
|
-
require "prawn/graphics"
|
13
|
-
require "prawn/images"
|
14
|
-
require "prawn/images/jpg"
|
15
|
-
require "prawn/images/png"
|
16
|
-
require "prawn/document"
|
17
|
-
require "prawn/reference"
|
18
|
-
require "prawn/font"
|
19
|
-
|
20
9
|
%w[font_ttf].each do |dep|
|
21
10
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../vendor/#{dep}")
|
22
11
|
end
|
23
12
|
|
24
13
|
require 'ttf'
|
25
14
|
|
26
|
-
module Prawn
|
15
|
+
module Prawn
|
27
16
|
file = __FILE__
|
28
17
|
file = File.readlink(file) if File.symlink?(file)
|
29
18
|
dir = File.dirname(file)
|
30
19
|
|
31
20
|
# The base source directory for Prawn as installed on the system
|
32
|
-
BASEDIR = File.expand_path(File.join(dir, '..'))
|
33
|
-
|
34
|
-
|
21
|
+
BASEDIR = File.expand_path(File.join(dir, '..'))
|
22
|
+
|
23
|
+
VERSION = "0.2.0"
|
24
|
+
|
25
|
+
extend self
|
26
|
+
|
27
|
+
def verify_options(accepted,actual) #:nodoc:
|
28
|
+
require "set"
|
29
|
+
unless (act=Set[*actual.keys]).subset?(acc=Set[*accepted])
|
30
|
+
raise Prawn::Errors::UnknownOption,
|
31
|
+
"\nDetected unknown option(s): #{(act - acc).to_a.inspect}\n" <<
|
32
|
+
"Accepted options are: #{accepted.inspect}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Configurable #:nodoc:
|
37
|
+
def configuration(*args)
|
38
|
+
@config ||= Marshal.load(Marshal.dump(default_configuration))
|
39
|
+
if Hash === args[0]
|
40
|
+
@config.update(args[0])
|
41
|
+
elsif args.length > 1
|
42
|
+
@config.values_at(*args)
|
43
|
+
elsif args.length == 1
|
44
|
+
@config[args[0]]
|
45
|
+
else
|
46
|
+
@config
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
alias_method :C, :configuration
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
require "prawn/compatibility"
|
55
|
+
require "prawn/errors"
|
56
|
+
require "prawn/pdf_object"
|
57
|
+
require "prawn/graphics"
|
58
|
+
require "prawn/images"
|
59
|
+
require "prawn/images/jpg"
|
60
|
+
require "prawn/images/png"
|
61
|
+
require "prawn/document"
|
62
|
+
require "prawn/reference"
|
63
|
+
require "prawn/font"
|
data/lib/prawn/compatibility.rb
CHANGED
@@ -3,30 +3,43 @@
|
|
3
3
|
if RUBY_VERSION < "1.9"
|
4
4
|
require "strscan"
|
5
5
|
|
6
|
-
class String
|
6
|
+
class String #:nodoc:
|
7
7
|
alias_method :lines, :to_a
|
8
8
|
|
9
9
|
def each_char
|
10
10
|
scanner, char = StringScanner.new(self), /./mu
|
11
11
|
loop { yield(scanner.scan(char) || break) }
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
class File #:nodoc:
|
17
|
+
def self.read_binary(file)
|
18
|
+
File.open(file,"rb") { |f| f.read }
|
12
19
|
end
|
13
|
-
end
|
20
|
+
end
|
14
21
|
|
15
|
-
def ruby_18
|
22
|
+
def ruby_18 #:nodoc:
|
16
23
|
yield
|
17
24
|
end
|
18
25
|
|
19
|
-
def ruby_19
|
26
|
+
def ruby_19 #:nodoc:
|
20
27
|
false
|
21
28
|
end
|
22
29
|
|
23
|
-
else
|
30
|
+
else
|
31
|
+
|
32
|
+
class File #:nodoc:
|
33
|
+
def self.read_binary(file)
|
34
|
+
File.open(file,"rb:BINARY") { |f| f.read }
|
35
|
+
end
|
36
|
+
end
|
24
37
|
|
25
|
-
def ruby_18
|
38
|
+
def ruby_18 #:nodoc:
|
26
39
|
false
|
27
40
|
end
|
28
41
|
|
29
|
-
def ruby_19
|
42
|
+
def ruby_19 #:nodoc:
|
30
43
|
yield
|
31
44
|
end
|
32
45
|
|