caracal_the_curve 1.4.4 → 1.4.5

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
  SHA256:
3
- metadata.gz: 600531d46b2480547a2b7aac3996e0120798923c08dded9877ca689efb14b1f9
4
- data.tar.gz: a7d3df9f734a6d6da8625f0905ca6d3fdda622c7f0f938e44cbbb3adea8b4c4f
3
+ metadata.gz: 45e42709e5e6dd37c33347d099b56c90db0dfff8309539fe75da327279f34065
4
+ data.tar.gz: 9c6d77453283e2a10e66f9224606bf2f445307143cf20395fa815b5ab1da71a9
5
5
  SHA512:
6
- metadata.gz: b91eac309b0ee55811d30448da5e297979d321ac4543263f2d96a4276b22674862b7b638f03d30753c685ac1d979c302b16c6598698ff1cf2cd52ff6bb14b469
7
- data.tar.gz: 43d6d97a9e3ff4ae85f810555e9f1e9138b90e4d85798a3db8bf6360cc10147934f4d0455bec7169e2ac36346aeda094c2b40df8b8c28c0be92f279ccacc0a5e
6
+ metadata.gz: 006140646a3c87366f118d25b3e62fc72386d849c57a9a5858253b4543b5a75e6978dda390d2ae547d1f3bfc4472c4e4fbf3f6364333ac96967bd628e1ff7c7a
7
+ data.tar.gz: cb58b0fecf147183b867ebae009e972a95583a76094a30716751833383d3c9e0388f300b8b97ecbffcb0c27afb35cf1f448718c6a9f5c0c91170bfb94a9fb5f4
@@ -13,6 +13,11 @@ module Caracal
13
13
  # Configuration
14
14
  #-------------------------------------------------------------
15
15
 
16
+ # accessors
17
+ attr_reader :page_width
18
+ attr_reader :page_margin_left
19
+ attr_reader :page_margin_right
20
+
16
21
  # initialization
17
22
  def initialize(options={}, &block)
18
23
  super options, &block
@@ -21,6 +26,15 @@ module Caracal
21
26
  #-------------------------------------------------------------
22
27
  # Public Methods
23
28
  #-------------------------------------------------------------
29
+
30
+ #========== SETTERS ===============================
31
+
32
+ # integers
33
+ [:width, :margin_left, :margin_right].each do |m|
34
+ define_method "#{ m }" do |value|
35
+ instance_variable_set("@page_#{ m }", value.to_i)
36
+ end
37
+ end
24
38
 
25
39
  #=============== DATA ACCESSORS =======================
26
40
 
@@ -35,6 +49,15 @@ module Caracal
35
49
  def valid?
36
50
  contents.size > 0
37
51
  end
52
+
53
+ #--------------------------------------------------
54
+ # Private Instance Methods
55
+ #--------------------------------------------------
56
+ private
57
+
58
+ def option_keys
59
+ [:width, :margin_left, :margin_right]
60
+ end
38
61
  end
39
62
  end
40
63
  end
@@ -19,6 +19,15 @@ module Caracal
19
19
  def page_flip(*args, &block)
20
20
  options = Caracal::Utilities.extract_options!(args)
21
21
 
22
+ # Pass through the page dimensions from the parent document,
23
+ # using the page height as the page width, due to it using
24
+ # the inverse dimensions.
25
+ options.merge!({
26
+ width: page_height,
27
+ margin_left: page_margin_left,
28
+ margin_right: page_margin_right
29
+ })
30
+
22
31
  model = Caracal::Core::Models::PageFlipModel.new(options, &block)
23
32
 
24
33
  if model.valid?
@@ -1,3 +1,3 @@
1
1
  module Caracal
2
- VERSION = '1.4.4'
2
+ VERSION = '1.4.5'
3
3
  end
@@ -18,8 +18,21 @@ describe Caracal::Core::Tables do
18
18
 
19
19
  it { expect(subject.contents.size).to eq size + 1 }
20
20
  it { expect(subject.contents.last).to be_a(Caracal::Core::Models::TableModel) }
21
+ it { expect(subject.contents.last.table_width).to be(9360) }
22
+ end
23
+
24
+ describe '.table within a page-flip' do
25
+ let!(:size) { subject.contents.size }
26
+
27
+ before do
28
+ subject.page_flip do |x|
29
+ x.table [['Sample Text']]
30
+ end
31
+ end
32
+
33
+ it { expect(subject.contents.size).to eq size + 1 }
34
+ it { expect(subject.contents.last.contents.first).to be_a(Caracal::Core::Models::TableModel) }
35
+ it { expect(subject.contents.last.contents.first.table_width).to be(12960) }
21
36
  end
22
-
23
37
  end
24
-
25
- end
38
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caracal_the_curve
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trade Infomatics