thinreports 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +41 -0
  3. data/.travis.yml +4 -6
  4. data/CHANGELOG.md +21 -2
  5. data/Gemfile +2 -4
  6. data/README.md +4 -5
  7. data/Rakefile +7 -8
  8. data/examples/character_spacing/character_spacing.rb +1 -1
  9. data/examples/dynamic_image/dynamic_image.rb +3 -3
  10. data/examples/dynamic_style/dynamic_style.rb +1 -1
  11. data/examples/eudc/eudc.rb +1 -1
  12. data/examples/helper.rb +2 -2
  13. data/examples/hidden_shapes/hidden_shapes.rb +1 -1
  14. data/examples/list_events/list_events.rb +1 -1
  15. data/examples/list_manual_generation/list_manual_generation.rb +1 -1
  16. data/examples/list_page_number/list_page_number.rb +1 -1
  17. data/examples/page_number/page_number.rb +1 -1
  18. data/examples/palleted_png/palleted_png.rb +1 -3
  19. data/examples/password_setting/password_setting.rb +1 -1
  20. data/examples/report_callbacks/report_callbacks.rb +1 -1
  21. data/examples/single_line_tblock/single_line_tblock.rb +1 -1
  22. data/examples/tblock_overflow/tblock_overflow.rb +1 -1
  23. data/examples/tblock_styles/tblock_styles.rb +1 -1
  24. data/examples/text_align/text_align.rb +1 -1
  25. data/examples/typeB_page_size/typeB_page_size.rb +1 -1
  26. data/examples/word_wrap/word_wrap.rb +1 -1
  27. data/lib/thinreports.rb +16 -15
  28. data/lib/thinreports/config.rb +2 -24
  29. data/lib/thinreports/core/errors.rb +6 -17
  30. data/lib/thinreports/core/format/base.rb +62 -61
  31. data/lib/thinreports/core/shape.rb +13 -14
  32. data/lib/thinreports/core/shape/base.rb +3 -12
  33. data/lib/thinreports/core/shape/base/interface.rb +35 -32
  34. data/lib/thinreports/core/shape/base/internal.rb +45 -43
  35. data/lib/thinreports/core/shape/basic.rb +12 -12
  36. data/lib/thinreports/core/shape/basic/block_format.rb +8 -6
  37. data/lib/thinreports/core/shape/basic/block_interface.rb +24 -22
  38. data/lib/thinreports/core/shape/basic/block_internal.rb +28 -26
  39. data/lib/thinreports/core/shape/basic/format.rb +11 -9
  40. data/lib/thinreports/core/shape/basic/interface.rb +79 -77
  41. data/lib/thinreports/core/shape/basic/internal.rb +17 -14
  42. data/lib/thinreports/core/shape/image_block.rb +9 -9
  43. data/lib/thinreports/core/shape/image_block/format.rb +7 -5
  44. data/lib/thinreports/core/shape/image_block/interface.rb +15 -13
  45. data/lib/thinreports/core/shape/image_block/internal.rb +10 -8
  46. data/lib/thinreports/core/shape/list.rb +13 -13
  47. data/lib/thinreports/core/shape/list/format.rb +83 -77
  48. data/lib/thinreports/core/shape/list/manager.rb +182 -176
  49. data/lib/thinreports/core/shape/list/page.rb +94 -93
  50. data/lib/thinreports/core/shape/list/page_state.rb +42 -40
  51. data/lib/thinreports/core/shape/list/section_format.rb +28 -26
  52. data/lib/thinreports/core/shape/list/section_interface.rb +42 -40
  53. data/lib/thinreports/core/shape/list/section_internal.rb +21 -19
  54. data/lib/thinreports/core/shape/manager.rb +4 -13
  55. data/lib/thinreports/core/shape/manager/format.rb +21 -19
  56. data/lib/thinreports/core/shape/manager/internal.rb +88 -84
  57. data/lib/thinreports/core/shape/manager/target.rb +93 -95
  58. data/lib/thinreports/core/shape/page_number.rb +9 -9
  59. data/lib/thinreports/core/shape/page_number/format.rb +20 -18
  60. data/lib/thinreports/core/shape/page_number/interface.rb +20 -18
  61. data/lib/thinreports/core/shape/page_number/internal.rb +47 -44
  62. data/lib/thinreports/core/shape/style.rb +5 -14
  63. data/lib/thinreports/core/shape/style/base.rb +121 -120
  64. data/lib/thinreports/core/shape/style/basic.rb +12 -10
  65. data/lib/thinreports/core/shape/style/graphic.rb +35 -33
  66. data/lib/thinreports/core/shape/style/text.rb +113 -107
  67. data/lib/thinreports/core/shape/text.rb +9 -9
  68. data/lib/thinreports/core/shape/text/format.rb +10 -9
  69. data/lib/thinreports/core/shape/text/interface.rb +13 -11
  70. data/lib/thinreports/core/shape/text/internal.rb +14 -12
  71. data/lib/thinreports/core/shape/text_block.rb +10 -10
  72. data/lib/thinreports/core/shape/text_block/format.rb +35 -33
  73. data/lib/thinreports/core/shape/text_block/formatter.rb +26 -24
  74. data/lib/thinreports/core/shape/text_block/formatter/basic.rb +25 -25
  75. data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +15 -12
  76. data/lib/thinreports/core/shape/text_block/formatter/number.rb +45 -39
  77. data/lib/thinreports/core/shape/text_block/formatter/padding.rb +17 -14
  78. data/lib/thinreports/core/shape/text_block/interface.rb +25 -23
  79. data/lib/thinreports/core/shape/text_block/internal.rb +68 -68
  80. data/lib/thinreports/core/utils.rb +4 -3
  81. data/lib/thinreports/generator/pdf.rb +24 -25
  82. data/lib/thinreports/generator/pdf/document.rb +109 -110
  83. data/lib/thinreports/generator/pdf/document/draw_shape.rb +58 -51
  84. data/lib/thinreports/generator/pdf/document/draw_template_items.rb +51 -47
  85. data/lib/thinreports/generator/pdf/document/font.rb +62 -59
  86. data/lib/thinreports/generator/pdf/document/graphics.rb +32 -33
  87. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +122 -121
  88. data/lib/thinreports/generator/pdf/document/graphics/basic.rb +113 -114
  89. data/lib/thinreports/generator/pdf/document/graphics/image.rb +58 -150
  90. data/lib/thinreports/generator/pdf/document/graphics/text.rb +152 -137
  91. data/lib/thinreports/generator/pdf/document/page.rb +63 -64
  92. data/lib/thinreports/generator/pdf/document/parse_color.rb +37 -37
  93. data/lib/thinreports/generator/pdf/drawer/base.rb +41 -41
  94. data/lib/thinreports/generator/pdf/drawer/list.rb +48 -45
  95. data/lib/thinreports/generator/pdf/drawer/list_section.rb +42 -40
  96. data/lib/thinreports/generator/pdf/drawer/page.rb +101 -96
  97. data/lib/thinreports/generator/pdf/prawn_ext.rb +4 -30
  98. data/lib/thinreports/generator/pdf/prawn_ext/calc_image_dimensions.rb +34 -0
  99. data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +29 -0
  100. data/lib/thinreports/layout.rb +5 -7
  101. data/lib/thinreports/layout/base.rb +5 -7
  102. data/lib/thinreports/layout/format.rb +18 -13
  103. data/lib/thinreports/layout/legacy_schema.rb +18 -10
  104. data/lib/thinreports/layout/version.rb +22 -25
  105. data/lib/thinreports/report.rb +4 -6
  106. data/lib/thinreports/report/base.rb +24 -51
  107. data/lib/thinreports/report/internal.rb +9 -11
  108. data/lib/thinreports/report/page.rb +5 -6
  109. data/lib/thinreports/version.rb +2 -2
  110. data/test/schema_helper.rb +4 -3
  111. data/test/test_helper.rb +9 -3
  112. data/test/unit/core/format/test_base.rb +1 -1
  113. data/test/unit/core/shape/base/test_internal.rb +1 -1
  114. data/test/unit/core/shape/basic/test_block_format.rb +1 -1
  115. data/test/unit/core/shape/basic/test_block_interface.rb +1 -1
  116. data/test/unit/core/shape/basic/test_block_internal.rb +1 -1
  117. data/test/unit/core/shape/basic/test_format.rb +1 -1
  118. data/test/unit/core/shape/basic/test_interface.rb +1 -1
  119. data/test/unit/core/shape/basic/test_internal.rb +1 -1
  120. data/test/unit/core/shape/image_block/test_interface.rb +1 -1
  121. data/test/unit/core/shape/image_block/test_internal.rb +1 -1
  122. data/test/unit/core/shape/list/test_format.rb +1 -1
  123. data/test/unit/core/shape/list/test_manager.rb +4 -4
  124. data/test/unit/core/shape/list/test_page.rb +1 -1
  125. data/test/unit/core/shape/list/test_page_state.rb +1 -1
  126. data/test/unit/core/shape/list/test_section_format.rb +1 -1
  127. data/test/unit/core/shape/list/test_section_interface.rb +2 -2
  128. data/test/unit/core/shape/list/test_section_internal.rb +1 -1
  129. data/test/unit/core/shape/manager/test_format.rb +2 -2
  130. data/test/unit/core/shape/manager/test_internal.rb +3 -3
  131. data/test/unit/core/shape/manager/test_target.rb +1 -1
  132. data/test/unit/core/shape/page_number/test_format.rb +1 -1
  133. data/test/unit/core/shape/page_number/test_interface.rb +1 -1
  134. data/test/unit/core/shape/page_number/test_internal.rb +1 -1
  135. data/test/unit/core/shape/styles/test_base.rb +1 -1
  136. data/test/unit/core/shape/styles/test_basic.rb +1 -1
  137. data/test/unit/core/shape/styles/test_graphic.rb +1 -1
  138. data/test/unit/core/shape/styles/test_text.rb +1 -1
  139. data/test/unit/core/shape/text/test_format.rb +1 -1
  140. data/test/unit/core/shape/text/test_internal.rb +1 -1
  141. data/test/unit/core/shape/text_block/formatter/test_basic.rb +1 -1
  142. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +1 -1
  143. data/test/unit/core/shape/text_block/formatter/test_number.rb +1 -1
  144. data/test/unit/core/shape/text_block/formatter/test_padding.rb +2 -2
  145. data/test/unit/core/shape/text_block/test_format.rb +1 -1
  146. data/test/unit/core/shape/text_block/test_formatter.rb +1 -1
  147. data/test/unit/core/shape/text_block/test_interface.rb +1 -1
  148. data/test/unit/core/shape/text_block/test_internal.rb +3 -3
  149. data/test/unit/core/test_shape.rb +1 -1
  150. data/test/unit/core/test_utils.rb +2 -2
  151. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +1 -1
  152. data/test/unit/generator/pdf/document/graphics/test_basic.rb +2 -1
  153. data/test/unit/generator/pdf/document/graphics/test_image.rb +27 -131
  154. data/test/unit/generator/pdf/document/graphics/test_text.rb +1 -1
  155. data/test/unit/generator/pdf/document/test_font.rb +2 -2
  156. data/test/unit/generator/pdf/document/test_graphics.rb +1 -1
  157. data/test/unit/generator/pdf/document/test_page.rb +7 -7
  158. data/test/unit/generator/pdf/document/test_parse_color.rb +1 -1
  159. data/test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +41 -0
  160. data/test/unit/generator/pdf/prawn_ext/test_width_of.rb +22 -0
  161. data/test/unit/generator/pdf/test_document.rb +8 -6
  162. data/test/unit/generator/test_pdf.rb +12 -10
  163. data/test/unit/layout/test_base.rb +1 -1
  164. data/test/unit/layout/test_format.rb +2 -2
  165. data/test/unit/layout/test_legacy_schema.rb +4 -4
  166. data/test/unit/layout/test_version.rb +11 -80
  167. data/test/unit/report/test_base.rb +45 -59
  168. data/test/unit/report/test_internal.rb +1 -1
  169. data/test/unit/test_config.rb +1 -16
  170. data/test/unit/test_layout.rb +1 -1
  171. data/test/unit/test_report.rb +1 -1
  172. data/thinreports.gemspec +11 -14
  173. metadata +42 -103
  174. data/lib/thinreports/generator.rb +0 -29
  175. data/lib/thinreports/generator/base.rb +0 -40
  176. data/lib/thinreports/generator/configuration.rb +0 -31
  177. data/lib/thinreports/report/events.rb +0 -32
  178. data/test/unit/generator/test_base.rb +0 -40
  179. data/test/unit/generator/test_configuration.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c93b3357d3d5cf6c1b61a01e9426482712d918da
4
- data.tar.gz: d6947e5e59242e15735d7bb3022dda152ed03d5d
3
+ metadata.gz: 40890b67b0013db37dcab5672e1b3166919adc9c
4
+ data.tar.gz: 00d5a8a495b282c6f6c83864a2550774b09a9995
5
5
  SHA512:
6
- metadata.gz: c05756da8074b034b0747ee7d469086c11348ec9366e2311874230961aa36d82c105453ad0d9079eb6ca0c63b3a05ded8135d8bfb3b17fa41aff330f7c2e2804
7
- data.tar.gz: 10805e8930c437ecc4c2c48fb370c93a450d155af49d783405e0ec2289e1f263b3bd8a29111e6675eac8bf67d426df237ecc5f4831e02dbe477e1696bafac73e
6
+ metadata.gz: 7c84274da336894155c19db3ae9b6ce66f3c69bde20605c74efd841dd318c51d7317553a261cac391b8e5eb9d197d15fd05cfb18d0e87ffdafbf8b0a2ffbe315
7
+ data.tar.gz: f2f4b9e4aa7edeca96bb40f7ceb187fa04dd9bdfcaf6d750af6602077f0d5c25cb19466ae50780cf87d1a433f82ea11f5837263d4f16b35922b0f525b475fd91
@@ -0,0 +1,41 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'examples/**/*'
4
+ - 'test/**/*'
5
+ - 'thinreports.gemspec'
6
+
7
+ Metrics/LineLength:
8
+ Max: 120
9
+
10
+ Metrics/MethodLength:
11
+ Enabled: false
12
+
13
+ Metrics/ParameterLists:
14
+ Max: 6
15
+
16
+ Performance/RedundantBlockCall:
17
+ Enabled: false
18
+
19
+ Performance/RegexpMatch:
20
+ Enabled: false
21
+
22
+ Style/Documentation:
23
+ Enabled: false
24
+
25
+ Style/FormatString:
26
+ Enabled: false
27
+
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: false
30
+
31
+ Style/NumericPredicate:
32
+ Enabled: false
33
+
34
+ Style/PerlBackrefs:
35
+ Enabled: false
36
+
37
+ Style/PredicateName:
38
+ Enabled: false
39
+
40
+ Style/SafeNavigation:
41
+ Enabled: false
@@ -1,13 +1,11 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
4
  - 2.1.10
7
- - 2.2.5
8
- - 2.3.1
9
- - jruby
10
- script: rake test
5
+ - 2.2.7
6
+ - 2.3.4
7
+ - 2.4.1
8
+ - jruby-9.1.8.0
11
9
 
12
10
  branches:
13
11
  only:
@@ -1,3 +1,21 @@
1
+ ## 0.10.0
2
+
3
+ * Thinreports requires Prawn 2.2
4
+ * Dropped Ruby 1.9.3 and 2.0.0 support
5
+ * Fixed a bug line-height of a text line-wrapped is broken #36 [@tkobayashi0330]
6
+ * Remove deprecated top-module `ThinReports`
7
+ * Remove `config.convert_palleted_transparency_png` option
8
+ * Remove `config.generator.default` option
9
+ * Deprecate `:report` and `:generator` argument of `Thinreports::Report.generate`
10
+
11
+ ### Remove config.convert_palleted_transparency_png option
12
+
13
+ PNG image with indexed transparency has been supported since Prawn version 2.0. And now, thinreports requires Prawn 2.2+, so the unique support in thinreports is no longer needed.
14
+
15
+ ### Remove deprecated top-module ThinReports
16
+
17
+ Please use `Thinreports` instead.
18
+
1
19
  ## 0.9.1
2
20
 
3
21
  * Fixed bug that line-height of text-block is always set to 0 #68
@@ -46,8 +64,9 @@ png_image = StringIO.new(png_data)
46
64
  page.item(:image_block).src(png_image)
47
65
 
48
66
  require 'open-uri'
49
- png_data = open('http://example.com/image.png')
50
- page.item(:image_block).src(image_data)
67
+ open('http://example.com/image.png') do |image_data|
68
+ page.item(:image_block).src(image_data)
69
+ end
51
70
  ```
52
71
 
53
72
  ### Remove old way to define callback of list
data/Gemfile CHANGED
@@ -1,7 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  gemspec
4
-
5
- group :example do
6
- gem 'pdf-inspector'
7
- end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Thinreports Generator [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
+ # Thinreports Generator
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/thinreports.svg)](http://badge.fury.io/rb/thinreports)
4
4
  [![](http://img.shields.io/travis/thinreports/thinreports-generator.svg?style=flat)](http://travis-ci.org/thinreports/thinreports-generator)
@@ -15,15 +15,14 @@
15
15
  * [Installation Guide](http://www.thinreports.org/documentation/getting-started/installation.html)
16
16
  * [Quick Start Guide](http://www.thinreports.org/documentation/getting-started/quickstart.html)
17
17
  * [Examples](https://github.com/thinreports/thinreports-examples)
18
- * [Rails4 Example](https://github.com/thinreports/thinreports-rails4-example)
18
+ * [Rails5 Example](https://github.com/thinreports/thinreports-rails5-example)
19
19
  * [Changelog](https://github.com/thinreports/thinreports-generator/blob/master/CHANGELOG.md)
20
20
  * [Discussion Group](https://groups.google.com/forum/#!forum/thinreports)
21
- * [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
22
21
 
23
22
  ## Supported versions
24
23
 
25
- * Ruby 1.9.3, 2.0, 2.1, 2.2, 2.3
26
- * JRuby 1.7.0+ (1.9 mode)
24
+ * Ruby 2.1, 2.2, 2.3, 2.4
25
+ * JRuby 9.1.8.0
27
26
 
28
27
  ## Quick Reference
29
28
 
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
- # coding: utf-8
2
-
3
1
  require 'rake/testtask'
2
+ require 'rubocop/rake_task'
4
3
  require 'yard'
5
4
 
5
+ task default: %i[test rubocop]
6
+
6
7
  Rake::TestTask.new do |t|
7
8
  t.libs << 'test'
8
9
  t.test_files = Dir['test/unit/**/test_*.rb']
@@ -10,9 +11,9 @@ end
10
11
 
11
12
  namespace :examples do
12
13
  desc 'Run all examples'
13
- task all: :_init do
14
+ task :all do
14
15
  require_relative 'examples/helper'
15
- Dir['examples/*/*.rb'].each {|f| require_relative f }
16
+ Dir['examples/*/*.rb'].each { |f| require_relative f }
16
17
  end
17
18
 
18
19
  Dir['examples/*/*.rb'].each do |f|
@@ -24,10 +25,6 @@ namespace :examples do
24
25
  require_relative "examples/#{casename}/#{casename}"
25
26
  end
26
27
  end
27
-
28
- task :_init do
29
- $:.push File.expand_path('../lib', __FILE__)
30
- end
31
28
  end
32
29
 
33
30
  desc 'Run all examples'
@@ -37,3 +34,5 @@ YARD::Rake::YardocTask.new :doc do |yard|
37
34
  yard.files = Dir['lib/**/*.rb']
38
35
  yard.options = ['--readme', 'README.md']
39
36
  end
37
+
38
+ RuboCop::RakeTask.new
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :character_spacing, 'Sets the character spacing in the Editor' do
4
4
  report = Thinreports::Report.new layout: layout_filename
@@ -1,10 +1,10 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'open-uri'
4
4
 
5
5
  example :dynamic_image, 'Show images dynamically' do
6
- image50x50 = resource('img50x50.png')
7
- image200x100 = resource('img200x100.png')
6
+ image50x50 = resource('img50x50.png')
7
+ image200x100 = resource('img200x100.png')
8
8
 
9
9
  Thinreports::Report.generate filename: output_filename do |r|
10
10
  r.use_layout(layout_filename)
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :dynamic_style, 'Change styles of the object dynamically' do |t|
4
4
  image = t.resource('image.png')
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :eudc, 'Show External Characters' do |t|
4
4
  Thinreports.configure do |config|
@@ -1,7 +1,7 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'pathname'
4
- require 'thinreports'
4
+ require_relative '../lib/thinreports'
5
5
 
6
6
  class Thinreports::Example
7
7
  ROOT = Pathname.new File.expand_path('..', __FILE__)
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :hidden_shapes, 'Generate PDF that contains hidden shapes' do |t|
4
4
  Thinreports::Report.generate(filename: t.output_filename) do
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :list_events, 'Basic list events' do |t|
4
4
  Thinreports::Report.generate filename: t.output_filename do |report|
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :list_manual_generation, 'Generate list manually' do |t|
4
4
  Thinreports::Report.generate(filename: t.output_filename) do
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :list_page_number, 'Draw page-number automatically each list' do |t|
4
4
  report = Thinreports::Report.new layout: t.layout_filename
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :page_number, 'Draw page-number automatically each pages' do |t|
4
4
  # Basic PageNumber
@@ -1,8 +1,6 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :palleted_png, 'Rendering a palleted PNG with transparency' do |t|
4
- Thinreports.config.convert_palleted_transparency_png = true
5
-
6
4
  report = Thinreports::Report.new layout: t.layout_filename
7
5
  report.start_new_page do |page|
8
6
  page.item(:image).src = t.resource('palleted_png.png')
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :password_setting, 'Set password to open' do |t|
4
4
  report = Thinreports::Report.new layout: t.layout_filename
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :report_callbacks, 'Callbacks of Report' do |t|
4
4
  report = Thinreports::Report.new layout: t.layout_filename
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :single_line_tblock, 'Show a single-line Tblock' do |t|
4
4
  Thinreports::Report.generate filename: t.output_filename do
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :tblock_overflow, 'Control overflowing the Tblock' do
4
4
  report = Thinreports::Report.new layout: layout_filename
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :tblock_styles, 'Set the styles of Tblock in the Editor' do |t|
4
4
  Thinreports::Report.generate filename: t.output_filename do |report|
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :text_align, 'Sets the text-align style to Text' do |t|
4
4
  Thinreports::Report.generate filename: t.output_filename do
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'pdf/inspector'
4
4
 
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  example :word_wrap, 'Word-wrap property of TextBlock' do |t|
4
4
  Thinreports::Report.generate filename: t.output_filename do
@@ -1,19 +1,20 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
2
4
 
3
5
  module Thinreports
4
- ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
6
+ def self.root
7
+ @root ||= Pathname.new(__FILE__).join('..', '..')
8
+ end
5
9
  end
6
10
 
7
- require 'thinreports/version'
8
- require 'thinreports/config'
9
- require 'thinreports/core/utils'
10
- require 'thinreports/core/errors'
11
- require 'thinreports/core/format/base'
12
- require 'thinreports/core/shape'
13
- require 'thinreports/core/utils'
14
- require 'thinreports/report'
15
- require 'thinreports/layout'
16
- require 'thinreports/generator'
17
-
18
- # Alias for Thinreports
19
- ThinReports = Thinreports
11
+ require_relative 'thinreports/version'
12
+ require_relative 'thinreports/config'
13
+ require_relative 'thinreports/core/utils'
14
+ require_relative 'thinreports/core/errors'
15
+ require_relative 'thinreports/core/format/base'
16
+ require_relative 'thinreports/core/shape'
17
+ require_relative 'thinreports/core/utils'
18
+ require_relative 'thinreports/report'
19
+ require_relative 'thinreports/layout'
20
+ require_relative 'thinreports/generator/pdf'
@@ -1,10 +1,10 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
4
  # @yield [config]
5
5
  # @yieldparam [Thinreports::Configuration] config
6
6
  def self.configure(&block)
7
- Thinreports.call_block_in(self.config, &block)
7
+ Thinreports.call_block_in(config, &block)
8
8
  end
9
9
 
10
10
  # @return [Thinreports::Configuration]
@@ -15,7 +15,6 @@ module Thinreports
15
15
  class Configuration
16
16
  def initialize
17
17
  @fallback_fonts = []
18
- @convert_palleted_transparency_png = false
19
18
  end
20
19
 
21
20
  # @return [Array<String>]
@@ -33,26 +32,5 @@ module Thinreports
33
32
  def fallback_fonts=(font_names)
34
33
  @fallback_fonts = font_names.is_a?(Array) ? font_names : [font_names]
35
34
  end
36
-
37
- # @return [Boolean]
38
- # @see https://github.com/thinreports/thinreports-generator/pull/32
39
- attr_reader :convert_palleted_transparency_png
40
-
41
- # @param [Boolean]
42
- # @example
43
- # config.convert_palleted_transparency_png = true
44
- # config.convert_palleted_transparency_png = false # default
45
- # @see https://github.com/thinreports/thinreports-generator/pull/32
46
- # @deprecated convert_palleted_transparency_png is deprecated and will be removed in thinreports-generator 1.0 with no replacement
47
- def convert_palleted_transparency_png=(enable)
48
- warn '[DEPRECATION] convert_palleted_transparency_png is deprecated' \
49
- ' and will be removed in thinreports-generator 1.0 with no replacement.' if enable
50
- @convert_palleted_transparency_png = enable
51
- end
52
-
53
- # @return [Thinreports::Generator::Configuration]
54
- def generator
55
- @generator ||= Thinreports::Generator::Configuration.new
56
- end
57
35
  end
58
36
  end
@@ -1,15 +1,14 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
-
5
4
  module Errors
6
5
  class Basic < ::StandardError
7
6
  end
8
7
 
9
8
  class UnknownShapeStyleName < Basic
10
9
  def initialize(style, availables)
11
- super("The specified style name, '#{style}', cannot be used. " +
12
- "The available styles are #{availables.map{|s| ":#{s}"}.join(', ')}.")
10
+ super("The specified style name, '#{style}', cannot be used. " \
11
+ "The available styles are #{availables.map { |s| ":#{s}" }.join(', ')}.")
13
12
  end
14
13
  end
15
14
 
@@ -40,18 +39,9 @@ module Thinreports
40
39
  end
41
40
  end
42
41
 
43
- class UnknownEventType < Basic
44
- end
45
-
46
42
  class UnknownLayoutId < Basic
47
43
  end
48
44
 
49
- class UnknownGeneratorType < Basic
50
- def initialize(type)
51
- super("The specified generator type, '#{type}', was not found.")
52
- end
53
- end
54
-
55
45
  class UnsupportedColorName < Basic
56
46
  end
57
47
 
@@ -60,12 +50,11 @@ module Thinreports
60
50
 
61
51
  class IncompatibleLayoutFormat < Basic
62
52
  def initialize(filename, fileversion, required_rules)
63
- super("Generator #{Thinreports::VERSION} can not be built this file, " +
64
- "'#{File.basename(filename)}'. " +
65
- "This file is updated in the Editor of version '#{fileversion}', " +
53
+ super("Generator #{Thinreports::VERSION} can not be built this file, " \
54
+ "'#{File.basename(filename)}'. " \
55
+ "This file is updated in the Editor of version '#{fileversion}', " \
66
56
  "but Generator requires version #{required_rules}.")
67
57
  end
68
58
  end
69
59
  end
70
-
71
60
  end