mack-pdf_writer 0.8.1 → 0.8.2
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/lib/gems/archive-tar-minitar-0.5.2/bin/minitar +27 -0
- data/lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar/command.rb +814 -0
- data/lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb +979 -0
- data/lib/gems/color-1.4.0/lib/color/cmyk.rb +281 -0
- data/lib/gems/color-1.4.0/lib/color/css.rb +30 -0
- data/lib/gems/color-1.4.0/lib/color/grayscale.rb +214 -0
- data/lib/gems/color-1.4.0/lib/color/hsl.rb +223 -0
- data/lib/gems/color-1.4.0/lib/color/palette/adobecolor.rb +274 -0
- data/lib/gems/color-1.4.0/lib/color/palette/gimp.rb +118 -0
- data/lib/gems/color-1.4.0/lib/color/palette/monocontrast.rb +182 -0
- data/lib/gems/color-1.4.0/lib/color/palette.rb +18 -0
- data/lib/gems/color-1.4.0/lib/color/rgb/metallic.rb +45 -0
- data/lib/gems/color-1.4.0/lib/color/rgb-colors.rb +357 -0
- data/lib/gems/color-1.4.0/lib/color/rgb.rb +455 -0
- data/lib/gems/color-1.4.0/lib/color/yiq.rb +86 -0
- data/lib/gems/color-1.4.0/lib/color.rb +147 -0
- data/lib/gems/pdf-writer-1.1.8/bin/techbook +24 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/charts/stddev.rb +430 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/charts.rb +13 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/math.rb +108 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/quickref.rb +332 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/simpletable.rb +947 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/techbook.rb +901 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/arc4.rb +63 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fontmetrics.rb +203 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-Bold.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-BoldOblique.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-Oblique.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-Bold.afm +2827 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-BoldOblique.afm +2827 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-Oblique.afm +3051 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica.afm +3051 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/MustRead.html +19 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Symbol.afm +213 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Bold.afm +2588 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-BoldItalic.afm +2384 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Italic.afm +2667 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Roman.afm +2419 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/ZapfDingbats.afm +225 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics/imageinfo.rb +365 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics.rb +813 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang/en.rb +99 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang.rb +43 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/action.rb +35 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/annotation.rb +42 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/catalog.rb +39 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/contents.rb +65 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/destination.rb +40 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/encryption.rb +53 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/font.rb +72 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontdescriptor.rb +34 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb +40 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/image.rb +304 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/info.rb +51 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outline.rb +30 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb +30 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/page.rb +195 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/pages.rb +115 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/procset.rb +46 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/viewerpreferences.rb +74 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object.rb +23 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/ohash.rb +58 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/oreader.rb +25 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/state.rb +48 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/strokestyle.rb +138 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb +2729 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple/group.rb +146 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe/group.rb +36 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe.rb +68 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple.rb +486 -0
- data/lib/gems.rb +13 -0
- data/lib/mack-pdf_writer.rb +2 -0
- metadata +111 -16
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Transaction::Simple
|
|
3
|
+
# Simple object transaction support for Ruby
|
|
4
|
+
# http://rubyforge.org/projects/trans-simple/
|
|
5
|
+
# Version 1.4.0
|
|
6
|
+
#
|
|
7
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
|
8
|
+
# distribution for full licensing information.
|
|
9
|
+
#
|
|
10
|
+
# Copyright (c) 2003 - 2007 Austin Ziegler
|
|
11
|
+
#
|
|
12
|
+
# $Id: group.rb 47 2007-02-03 15:02:51Z austin $
|
|
13
|
+
#++
|
|
14
|
+
require 'transaction/simple'
|
|
15
|
+
|
|
16
|
+
# A transaction group is an object wrapper that manages a group of objects
|
|
17
|
+
# as if they were a single object for the purpose of transaction
|
|
18
|
+
# management. All transactions for this group of objects should be
|
|
19
|
+
# performed against the transaction group object, not against individual
|
|
20
|
+
# objects in the group.
|
|
21
|
+
#
|
|
22
|
+
# == Transaction Group Usage
|
|
23
|
+
# require 'transaction/simple/group'
|
|
24
|
+
#
|
|
25
|
+
# x = "Hello, you."
|
|
26
|
+
# y = "And you, too."
|
|
27
|
+
#
|
|
28
|
+
# g = Transaction::Simple::Group.new(x, y)
|
|
29
|
+
# g.start_transaction(:first) # -> [ x, y ]
|
|
30
|
+
# g.transaction_open?(:first) # -> true
|
|
31
|
+
# x.transaction_open?(:first) # -> true
|
|
32
|
+
# y.transaction_open?(:first) # -> true
|
|
33
|
+
#
|
|
34
|
+
# x.gsub!(/you/, "world") # -> "Hello, world."
|
|
35
|
+
# y.gsub!(/you/, "me") # -> "And me, too."
|
|
36
|
+
#
|
|
37
|
+
# g.start_transaction(:second) # -> [ x, y ]
|
|
38
|
+
# x.gsub!(/world/, "HAL") # -> "Hello, HAL."
|
|
39
|
+
# y.gsub!(/me/, "Dave") # -> "And Dave, too."
|
|
40
|
+
# g.rewind_transaction(:second) # -> [ x, y ]
|
|
41
|
+
# x # -> "Hello, world."
|
|
42
|
+
# y # -> "And me, too."
|
|
43
|
+
#
|
|
44
|
+
# x.gsub!(/world/, "HAL") # -> "Hello, HAL."
|
|
45
|
+
# y.gsub!(/me/, "Dave") # -> "And Dave, too."
|
|
46
|
+
#
|
|
47
|
+
# g.commit_transaction(:second) # -> [ x, y ]
|
|
48
|
+
# x # -> "Hello, HAL."
|
|
49
|
+
# y # -> "And Dave, too."
|
|
50
|
+
#
|
|
51
|
+
# g.abort_transaction(:first) # -> [ x, y ]
|
|
52
|
+
# x = -> "Hello, you."
|
|
53
|
+
# y = -> "And you, too."
|
|
54
|
+
class Transaction::Simple::Group
|
|
55
|
+
# Creates a transaction group for the provided objects. If a block is
|
|
56
|
+
# provided, the transaction group object is yielded to the block; when
|
|
57
|
+
# the block is finished, the transaction group object will be cleared
|
|
58
|
+
# with #clear.
|
|
59
|
+
def initialize(*objects)
|
|
60
|
+
@objects = objects || []
|
|
61
|
+
@objects.freeze
|
|
62
|
+
@objects.each { |obj| obj.extend(Transaction::Simple) }
|
|
63
|
+
|
|
64
|
+
if block_given?
|
|
65
|
+
begin
|
|
66
|
+
yield self
|
|
67
|
+
ensure
|
|
68
|
+
self.clear
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Returns the objects that are covered by this transaction group.
|
|
74
|
+
attr_reader :objects
|
|
75
|
+
|
|
76
|
+
# Clears the object group. Removes references to the objects so that
|
|
77
|
+
# they can be garbage collected.
|
|
78
|
+
def clear
|
|
79
|
+
@objects = @objects.dup.clear
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Tests to see if all of the objects in the group have an open
|
|
83
|
+
# transaction. See Transaction::Simple#transaction_open? for more
|
|
84
|
+
# information.
|
|
85
|
+
def transaction_open?(name = nil)
|
|
86
|
+
@objects.inject(true) do |val, obj|
|
|
87
|
+
val = val and obj.transaction_open?(name)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Returns the current name of the transaction for the group.
|
|
92
|
+
# Transactions not explicitly named are named +nil+.
|
|
93
|
+
def transaction_name
|
|
94
|
+
@objects[0].transaction_name
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Starts a transaction for the group. Stores the current object state.
|
|
98
|
+
# If a transaction name is specified, the transaction will be named.
|
|
99
|
+
# Transaction names must be unique. Transaction names of +nil+ will be
|
|
100
|
+
# treated as unnamed transactions.
|
|
101
|
+
def start_transaction(name = nil)
|
|
102
|
+
@objects.each { |obj| obj.start_transaction(name) }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Rewinds the transaction. If +name+ is specified, then the intervening
|
|
106
|
+
# transactions will be aborted and the named transaction will be
|
|
107
|
+
# rewound. Otherwise, only the current transaction is rewound.
|
|
108
|
+
def rewind_transaction(name = nil)
|
|
109
|
+
@objects.each { |obj| obj.rewind_transaction(name) }
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Aborts the transaction. Resets the object state to what it was before
|
|
113
|
+
# the transaction was started and closes the transaction. If +name+ is
|
|
114
|
+
# specified, then the intervening transactions and the named transaction
|
|
115
|
+
# will be aborted. Otherwise, only the current transaction is aborted.
|
|
116
|
+
#
|
|
117
|
+
# If the current or named transaction has been started by a block
|
|
118
|
+
# (Transaction::Simple.start), then the execution of the block will be
|
|
119
|
+
# halted with +break+ +self+.
|
|
120
|
+
def abort_transaction(name = nil)
|
|
121
|
+
@objects.each { |obj| obj.abort_transaction(name) }
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# If +name+ is +nil+ (default), the current transaction level is closed
|
|
125
|
+
# out and the changes are committed.
|
|
126
|
+
#
|
|
127
|
+
# If +name+ is specified and +name+ is in the list of named
|
|
128
|
+
# transactions, then all transactions are closed and committed until the
|
|
129
|
+
# named transaction is reached.
|
|
130
|
+
def commit_transaction(name = nil)
|
|
131
|
+
@objects.each { |obj| obj.commit_transaction(name) }
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Alternative method for calling the transaction methods. An optional
|
|
135
|
+
# name can be specified for named transaction support.
|
|
136
|
+
#
|
|
137
|
+
# #transaction(:start):: #start_transaction
|
|
138
|
+
# #transaction(:rewind):: #rewind_transaction
|
|
139
|
+
# #transaction(:abort):: #abort_transaction
|
|
140
|
+
# #transaction(:commit):: #commit_transaction
|
|
141
|
+
# #transaction(:name):: #transaction_name
|
|
142
|
+
# #transaction:: #transaction_open?
|
|
143
|
+
def transaction(action = nil, name = nil)
|
|
144
|
+
@objects.each { |obj| obj.transaction(action, name) }
|
|
145
|
+
end
|
|
146
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Transaction::Simple
|
|
3
|
+
# Simple object transaction support for Ruby
|
|
4
|
+
# http://rubyforge.org/projects/trans-simple/
|
|
5
|
+
# Version 1.4.0
|
|
6
|
+
#
|
|
7
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
|
8
|
+
# distribution for full licensing information.
|
|
9
|
+
#
|
|
10
|
+
# Copyright (c) 2003 - 2007 Austin Ziegler
|
|
11
|
+
#
|
|
12
|
+
# $Id: group.rb 47 2007-02-03 15:02:51Z austin $
|
|
13
|
+
#++
|
|
14
|
+
require 'transaction/simple/threadsafe'
|
|
15
|
+
|
|
16
|
+
# A transaction group is an object wrapper that manages a group of objects
|
|
17
|
+
# as if they were a single object for the purpose of transaction
|
|
18
|
+
# management. All transactions for this group of objects should be
|
|
19
|
+
# performed against the transaction group object, not against individual
|
|
20
|
+
# objects in the group. This is the threadsafe version of a transaction
|
|
21
|
+
# group.
|
|
22
|
+
class Transaction::Simple::ThreadSafe::Group < Transaction::Simple::Group
|
|
23
|
+
def initialize(*objects)
|
|
24
|
+
@objects = objects || []
|
|
25
|
+
@objects.freeze
|
|
26
|
+
@objects.each { |obj| obj.extend(Transaction::Simple::ThreadSafe) }
|
|
27
|
+
|
|
28
|
+
if block_given?
|
|
29
|
+
begin
|
|
30
|
+
yield self
|
|
31
|
+
ensure
|
|
32
|
+
self.clear
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Transaction::Simple
|
|
3
|
+
# Simple object transaction support for Ruby
|
|
4
|
+
# http://rubyforge.org/projects/trans-simple/
|
|
5
|
+
# Version 1.4.0
|
|
6
|
+
#
|
|
7
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
|
8
|
+
# distribution for full licensing information.
|
|
9
|
+
#
|
|
10
|
+
# Copyright (c) 2003 - 2007 Austin Ziegler
|
|
11
|
+
#
|
|
12
|
+
# $Id: threadsafe.rb 50 2007-02-03 20:26:19Z austin $
|
|
13
|
+
#++
|
|
14
|
+
require 'transaction/simple'
|
|
15
|
+
require 'thread'
|
|
16
|
+
|
|
17
|
+
module Transaction
|
|
18
|
+
# A standard exception for transaction errors involving threadsafe
|
|
19
|
+
# transactions.
|
|
20
|
+
class TransactionThreadError < TransactionError; end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# = Transaction::Simple::ThreadSafe
|
|
24
|
+
# Thread-safe simple object transaction support for Ruby.
|
|
25
|
+
# Transaction::Simple::ThreadSafe is used in the same way as
|
|
26
|
+
# Transaction::Simple. Transaction::Simple::ThreadSafe uses a Mutex object
|
|
27
|
+
# to ensure atomicity at the cost of performance in threaded applications.
|
|
28
|
+
#
|
|
29
|
+
# Transaction::Simple::ThreadSafe will not wait to obtain a lock; if the
|
|
30
|
+
# lock cannot be obtained immediately, a
|
|
31
|
+
# Transaction::TransactionThreadError will be raised.
|
|
32
|
+
#
|
|
33
|
+
# Thanks to Mauricio Fernandez for help with getting this part working.
|
|
34
|
+
#
|
|
35
|
+
# Threadsafe transactions can be used in any place that normal
|
|
36
|
+
# transactions would. The main difference would be in setup:
|
|
37
|
+
#
|
|
38
|
+
# require 'transaction/simple/threadsafe'
|
|
39
|
+
#
|
|
40
|
+
# x = "Hello, you."
|
|
41
|
+
# x.extend(Transaction::Simple::ThreadSafe) # Threadsafe
|
|
42
|
+
#
|
|
43
|
+
# y = "Hello, you."
|
|
44
|
+
# y.extend(Transaction::Simple) # Not threadsafe
|
|
45
|
+
module Transaction::Simple::ThreadSafe
|
|
46
|
+
include Transaction::Simple
|
|
47
|
+
|
|
48
|
+
SKIP_TRANSACTION_VARS = Transaction::Simple::SKIP_TRANSACTION_VARS.dup #:nodoc:
|
|
49
|
+
SKIP_TRANSACTION_VARS << "@__transaction_mutex__"
|
|
50
|
+
|
|
51
|
+
Transaction::Simple.instance_methods(false) do |meth|
|
|
52
|
+
next if meth == "transaction"
|
|
53
|
+
arg = "(name = nil)" unless meth == "transaction_name"
|
|
54
|
+
module_eval <<-EOS
|
|
55
|
+
def #{meth}#{arg}
|
|
56
|
+
if (@__transaction_mutex__ ||= Mutex.new).try_lock
|
|
57
|
+
result = super
|
|
58
|
+
@__transaction_mutex__.unlock
|
|
59
|
+
return result
|
|
60
|
+
else
|
|
61
|
+
raise TransactionThreadError, Messages[:cannot_obtain_transaction_lock] % meth
|
|
62
|
+
end
|
|
63
|
+
ensure
|
|
64
|
+
@__transaction_mutex__.unlock
|
|
65
|
+
end
|
|
66
|
+
EOS
|
|
67
|
+
end
|
|
68
|
+
end
|