prawn_commander 0.1.1 → 0.1.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/VERSION +1 -1
- data/lib/prawn_commander.rb +8 -0
- data/prawn_commander.gemspec +1 -1
- data/spec/prawn_commander_spec.rb +4 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/prawn_commander.rb
CHANGED
@@ -7,6 +7,14 @@ module Prawn
|
|
7
7
|
@prawn_commands = []
|
8
8
|
@options = options
|
9
9
|
end
|
10
|
+
|
11
|
+
def prawn_commands(&block)
|
12
|
+
ctx = @prawn_commands
|
13
|
+
if block
|
14
|
+
block.arity < 1 ? ctx.instance_eval(&block) : block.call(ctx)
|
15
|
+
end
|
16
|
+
ctx
|
17
|
+
end
|
10
18
|
|
11
19
|
def raw_prawn_commands
|
12
20
|
raw_commands = []
|
data/prawn_commander.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
2
|
|
3
3
|
describe Prawn::Commander do
|
4
|
-
let (:doc) { Prawn::Document.new
|
4
|
+
let (:doc) { Prawn::Document.new }
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
@commander = Prawn::Commander.new
|
@@ -17,6 +17,9 @@ describe Prawn::Commander do
|
|
17
17
|
it "should add 'move_down' to command stack" do
|
18
18
|
@commander.prawn_command(:move_down, 10)
|
19
19
|
@commander.prawn_commands.first.should be_command(:move_down, 10)
|
20
|
+
@commander.prawn_commands do |c|
|
21
|
+
c.first.should be_command(:move_down, 10)
|
22
|
+
end
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|