prawn-grouping 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5692a85c43374a5de24dac64509274378aa5c72b
4
- data.tar.gz: 79786b0fde6e1651615a4c09c5e6694618de1673
3
+ metadata.gz: edbb74b3d883deb5f4c93d595265253f98635aa5
4
+ data.tar.gz: 3e142422f61347f6b98aeb3bab1590748926c816
5
5
  SHA512:
6
- metadata.gz: f714a85cc2fa8ef6d28201d306595bc7327d505d7e465c5ee94fbc28c9161797db9489efbca23cb892f7018607b08d91c8dcbb49f9edccd8ee0e26fb89aa40ab
7
- data.tar.gz: ddeb45661c67e8a377ecf8b8c8baa8e7f27bcf934fb6c277ac6fda5ba12382adc64a942e2bcbe9c5933ef66f3546ef1a25392bda68d01c3e57e707e1eee97305
6
+ metadata.gz: 8733b32e99044a0a70faa3ebbdd4a99fdcdd70b8711fd38ac535f550c44c344bc66c18bd8c2461009f277bd422569e1dfef16b2d0c5868d2f0a4836ba46ad9af
7
+ data.tar.gz: 2a76aef33d15346be91de76fd408e74fbee24e0fd0229fe99cba441fae62f715dda77691c44369e71085c10f48933f31ca3505e07a58e3f4b63b99f7586292c8
data/.gitignore CHANGED
@@ -17,3 +17,5 @@ test/version_tmp
17
17
  tmp
18
18
 
19
19
  /bin/
20
+
21
+ /.DS_Store
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Prawn::Grouping
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/prawn-grouping.png)](http://badge.fury.io/rb/prawn-grouping)
3
4
  [![Build Status](https://travis-ci.org/ddengler/prawn-grouping.png?branch=master)](https://travis-ci.org/ddengler/prawn-grouping)
4
5
  [![Code Climate](https://codeclimate.com/github/ddengler/prawn-grouping.png)](https://codeclimate.com/github/ddengler/prawn-grouping)
5
6
 
@@ -69,6 +70,19 @@ end
69
70
  The example above starts a new page if the content is too tall for a single page. Default behavior would be to just append the content.
70
71
 
71
72
 
73
+ ## Troubleshooting
74
+
75
+ When using JRuby a block parameter has to be supplied. For the other tested Interpreters this is optional.
76
+
77
+ ```ruby
78
+ Prawn::Document.new do
79
+ 5.times { text "Regular text" }
80
+
81
+ group do |g|
82
+ 15.times { g.text "Paragraphs not separated unless neccessary" }
83
+ end
84
+ end
85
+ ```
72
86
 
73
87
  ## Contributing
74
88
 
@@ -1,5 +1,5 @@
1
1
  module Prawn
2
2
  module Grouping
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.required_ruby_version = '>= 1.9.3'
20
20
  spec.required_rubygems_version = ">= 1.3.6"
21
21
 
22
- spec.add_dependency "prawn", "~> 0.15.0"
22
+ spec.add_dependency "prawn", "~> 1.0.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
25
25
  spec.add_development_dependency "rake"
@@ -2,15 +2,6 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
2
2
 
3
3
  describe "Prawn::Grouping" do
4
4
  it "returns true if the content fits in the current context" do
5
- pdf = Prawn::Document.new do
6
- val = group { text "FooBar" }
7
- (!!val).should == true
8
- end
9
- pages = PDF::Inspector::Page.analyze(pdf.render).pages
10
- pages.size.should == 1
11
- end
12
-
13
- it "can be called with a block argument" do
14
5
  pdf = Prawn::Document.new
15
6
  val = pdf.group do |pdf|
16
7
  pdf.text "FooBar"
@@ -24,18 +15,18 @@ describe "Prawn::Grouping" do
24
15
  it "calls callbacks according to content length" do
25
16
  called = 0
26
17
  pdf = Prawn::Document.new do
27
- group :fits_current_context => lambda { called = 1 } do
28
- 20.times { text "FooBar 1" }
18
+ group :fits_current_context => lambda { called = 1 } do |pdf|
19
+ 20.times { pdf.text "FooBar 1" }
29
20
  end
30
21
  called.should == 1
31
22
 
32
- group :fits_new_context => lambda { called = 2 } do
33
- 40.times { text "FooBar 2" }
23
+ group :fits_new_context => lambda { called = 2 } do |pdf|
24
+ 40.times { pdf.text "FooBar 2" }
34
25
  end
35
26
  called.should == 2
36
27
 
37
- group :too_tall => lambda { called = 3 } do
38
- 100.times { text "FooBar 3" }
28
+ group :too_tall => lambda { called = 3 } do |pdf|
29
+ 100.times { pdf.text "FooBar 3" }
39
30
  end
40
31
  called.should == 3
41
32
  end
@@ -44,13 +35,13 @@ describe "Prawn::Grouping" do
44
35
  it "should allow nesting of groups" do
45
36
  pdf = Prawn::Document.new do
46
37
  5.times { text "1" }
47
- group do
48
- 10.times { text "1.1" }
38
+ group do |pdf|
39
+ 10.times { pdf.text "1.1" }
49
40
  end
50
- group do
51
- 15.times { text "1.2" }
52
- group do
53
- 30.times { text "1.2.1" }
41
+ group do |pdf|
42
+ 15.times { pdf.text "1.2" }
43
+ pdf.group do |pdf|
44
+ 30.times { pdf.text "1.2.1" }
54
45
  end
55
46
  end
56
47
  end
@@ -63,9 +54,9 @@ describe "Prawn::Grouping" do
63
54
  it "should group a simple block on a single page" do
64
55
  pdf = Prawn::Document.new do
65
56
  self.y = 50
66
- val = group do
67
- text "Hello"
68
- text "World"
57
+ val = group do |pdf|
58
+ pdf.text "Hello"
59
+ pdf.text "World"
69
60
  end
70
61
 
71
62
  # group should return a false value since a new page was started
@@ -86,7 +77,7 @@ describe "Prawn::Grouping" do
86
77
  # group (every column should start with zero).
87
78
  column_box([0, bounds.top], :width => bounds.width, :columns => 7) do
88
79
  10.times do
89
- group { 50.times { |i| text(i.to_s) } }
80
+ group { |pdf| 50.times { |i| pdf.text(i.to_s) } }
90
81
  end
91
82
  end
92
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-grouping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Dengler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-09 00:00:00.000000000 Z
11
+ date: 2014-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prawn
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.15.0
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.15.0
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement