paperize 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b8425d78f7d14ba3257c15405389ae32adaf7a2
4
- data.tar.gz: 48f6ea1b52ce7d7a7b03c2cdc830f89dada80d75
3
+ metadata.gz: fb126aa6a5d94c0f992c8863fd58ac41664a9cfe
4
+ data.tar.gz: 7e421019109955d6076c96cd412f3d7388e94922
5
5
  SHA512:
6
- metadata.gz: 4cf09af044092401a2bf4fe3b3989f3ab0ee70ed3c00b91d2228c0eaffc8a25775542ea392ab8d143257c34a684bfccfe6dae0571e632fdf974070ae283bec3c
7
- data.tar.gz: 5d72aefb5e1fe8a99834a102c11f823b8872a8bf51d473712e8ae481fd179e888c6499dfc269803cbaf956a0900b2e8d624144357a6b434342f8ce7b7ae8edd0
6
+ metadata.gz: 9057d0bdff7625d6bf18103b1dbb02a0c0a610bfc3099be94f7a3b6b0d01c106f99894e5d1bf19b173b8d28ba42ec7ab8090ed7bb6e8e74c6129159f63f8c6b0
7
+ data.tar.gz: a5167f9a7ddc1ab109e72d6f9d654a529ec90bb5f1682cdafd1c7d0c7e499b8ad55363cc40e9d604913f449ae1c23e16a6ef211eb93948f5ca4dd29abed25f16
@@ -15,9 +15,20 @@ module Paperize
15
15
  class << self
16
16
  attr_accessor :source
17
17
 
18
- def render!(filename, card_items, layout)
19
- layout.layout_cards(card_items)
20
- layout.document.render_file(filename)
18
+ def render!(filename, items_and_layouts)
19
+ document = Prawn::Document.new(
20
+ skip_page_creation: true,
21
+ page_size: 'LETTER',
22
+ page_layout: :portrait
23
+ )
24
+
25
+ items_and_layouts.each do |item_and_layout|
26
+ layout = item_and_layout[:layout]
27
+ layout.document = document
28
+ layout.layout_cards item_and_layout[:items]
29
+ end
30
+
31
+ document.render_file(filename)
21
32
  end
22
33
  end
23
34
  end
@@ -4,7 +4,7 @@ module Paperize
4
4
  attr_accessor :document
5
5
 
6
6
  def initialize(options={})
7
- @layout = options[:layout]
7
+ @layout = options[:layout] || '3x3'
8
8
  @orientation = options[:orientation] || :portrait
9
9
 
10
10
  if layout == :card_per_page
@@ -16,12 +16,12 @@ module Paperize
16
16
  end
17
17
  @template = options[:template]
18
18
 
19
- page_size = layout == :card_per_page ? [2.5.in, 3.5.in] : 'LETTER'
20
- @document = Prawn::Document.new(
21
- skip_page_creation: true,
22
- page_size: page_size,
23
- page_layout: @orientation
24
- )
19
+ # page_size = layout == :card_per_page ? [2.5.in, 3.5.in] : 'LETTER'
20
+ # @document = Prawn::Document.new(
21
+ # skip_page_creation: true,
22
+ # page_size: page_size,
23
+ # page_layout: @orientation
24
+ # )
25
25
  end
26
26
 
27
27
  def shrink_bounds(margin, &block)
@@ -34,7 +34,7 @@ module Paperize
34
34
  end
35
35
 
36
36
  def layout_cards(cards)
37
- card_margin = 15
37
+ card_margin = 0
38
38
  cards.each do |card|
39
39
  next_cell do
40
40
  shrink_bounds(2) do
@@ -1,3 +1,3 @@
1
1
  module Paperize
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Norman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-05 00:00:00.000000000 Z
11
+ date: 2014-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv