thinreports 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +11 -1
  4. data/Gemfile +2 -9
  5. data/MIT-LICENSE +1 -1
  6. data/README.rdoc +25 -26
  7. data/lib/thinreports/core/format/base.rb +0 -5
  8. data/lib/thinreports/core/format/builder.rb +5 -5
  9. data/lib/thinreports/core/page.rb +5 -3
  10. data/lib/thinreports/core/shape.rb +2 -0
  11. data/lib/thinreports/core/shape/basic/internal.rb +5 -1
  12. data/lib/thinreports/core/shape/list/configuration.rb +9 -3
  13. data/lib/thinreports/core/shape/list/manager.rb +11 -4
  14. data/lib/thinreports/core/shape/list/page.rb +3 -1
  15. data/lib/thinreports/core/shape/list/page_state.rb +4 -1
  16. data/lib/thinreports/core/shape/manager/internal.rb +1 -1
  17. data/lib/thinreports/core/shape/page_number.rb +15 -0
  18. data/lib/thinreports/core/shape/page_number/format.rb +25 -0
  19. data/lib/thinreports/core/shape/page_number/interface.rb +27 -0
  20. data/lib/thinreports/core/shape/page_number/internal.rb +57 -0
  21. data/lib/thinreports/core/shape/style/text.rb +6 -2
  22. data/lib/thinreports/core/shape/text_block/format.rb +1 -0
  23. data/lib/thinreports/generator/pdf.rb +1 -1
  24. data/lib/thinreports/generator/pdf/document/draw_shape.rb +14 -4
  25. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +9 -0
  26. data/lib/thinreports/generator/pdf/document/graphics/text.rb +4 -1
  27. data/lib/thinreports/generator/pdf/document/page.rb +18 -3
  28. data/lib/thinreports/generator/pdf/drawer/base.rb +3 -8
  29. data/lib/thinreports/generator/pdf/drawer/list.rb +31 -12
  30. data/lib/thinreports/generator/pdf/drawer/list_section.rb +5 -5
  31. data/lib/thinreports/generator/pdf/drawer/page.rb +22 -10
  32. data/lib/thinreports/generator/pdf/prawn_ext.rb +18 -1
  33. data/lib/thinreports/layout/base.rb +4 -2
  34. data/lib/thinreports/layout/format.rb +1 -5
  35. data/lib/thinreports/report/base.rb +36 -6
  36. data/lib/thinreports/report/internal.rb +7 -5
  37. data/lib/thinreports/version.rb +1 -1
  38. data/tasks/doc.rake +0 -1
  39. data/test/case/character_spacing/character_spacing.rb +4 -3
  40. data/test/case/dynamic_image/dynamic_image.rb +34 -34
  41. data/test/case/dynamic_style/dynamic_style.rb +141 -141
  42. data/test/case/eudc/eudc.rb +16 -16
  43. data/test/case/helper.rb +39 -20
  44. data/test/case/hidden_shapes/hidden_shapes.rb +4 -8
  45. data/test/case/list_events/list_events.rb +26 -26
  46. data/test/case/list_manual_generation/list_manual_generation.rb +16 -16
  47. data/test/case/list_page_number/list_page_number.rb +17 -0
  48. data/test/case/list_page_number/list_page_number.tlf +1 -0
  49. data/test/case/page_number/page_number.rb +33 -0
  50. data/test/case/page_number/page_number.tlf +1 -0
  51. data/test/case/password_setting/password_setting.rb +10 -0
  52. data/test/case/password_setting/password_setting.tlf +1 -0
  53. data/test/case/single_line_tblock/single_line_tblock.rb +10 -12
  54. data/test/case/tblock_overflow/tblock_overflow.rb +16 -16
  55. data/test/case/tblock_styles/tblock_styles.rb +24 -24
  56. data/test/case/text_align/text_align.rb +5 -6
  57. data/test/case/typeB_page_size/B4_ISO.tlf +1 -0
  58. data/test/case/typeB_page_size/B4_JIS.tlf +1 -0
  59. data/test/case/typeB_page_size/typeB_page_size.rb +17 -0
  60. data/test/case/word_wrap/word_wrap.rb +26 -0
  61. data/test/case/word_wrap/word_wrap.tlf +1 -0
  62. data/test/unit/core/format/test_builder.rb +1 -2
  63. data/test/unit/core/shape/basic/test_internal.rb +9 -1
  64. data/test/unit/core/shape/list/test_configuration.rb +6 -1
  65. data/test/unit/core/shape/list/test_manager.rb +10 -0
  66. data/test/unit/core/shape/list/test_page_state.rb +1 -1
  67. data/test/unit/core/shape/page_number/test_format.rb +73 -0
  68. data/test/unit/core/shape/page_number/test_interface.rb +30 -0
  69. data/test/unit/core/shape/page_number/test_internal.rb +81 -0
  70. data/test/unit/core/shape/styles/test_text.rb +12 -1
  71. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +19 -17
  72. data/test/unit/core/shape/text_block/test_format.rb +5 -0
  73. data/test/unit/core/test_events.rb +5 -3
  74. data/test/unit/core/test_shape.rb +5 -1
  75. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +6 -0
  76. data/test/unit/generator/pdf/document/test_draw_shape.rb +6 -0
  77. data/test/unit/generator/pdf/document/test_page.rb +29 -3
  78. data/test/unit/generator/test_pdf.rb +1 -10
  79. data/test/unit/helper.rb +33 -11
  80. data/test/unit/layout/test_base.rb +1 -1
  81. data/test/unit/report/test_base.rb +47 -0
  82. data/test/unit/report/test_internal.rb +22 -0
  83. data/test/unit/tmp/.gitkeep +0 -0
  84. data/thinreports.gemspec +14 -13
  85. metadata +89 -53
  86. data/.yardopts +0 -1
  87. data/test/case/list_header_inheriting/list_header_inheriting.rb +0 -17
  88. data/test/case/list_header_inheriting/list_header_inheriting.tlf +0 -1
@@ -98,9 +98,13 @@ module ThinReports
98
98
 
99
99
  private
100
100
 
101
- # @return [Symbol]
101
+ # @return [Symbol, nil]
102
102
  def default_valign
103
- @format.valign.blank? ? :top : @format.valign.to_sym
103
+ if accessible_styles.include?(:valign)
104
+ @format.valign.blank? ? :top : @format.valign.to_sym
105
+ else
106
+ :top
107
+ end
104
108
  end
105
109
 
106
110
  # @param [Symbol] align The interface align name.
@@ -15,6 +15,7 @@ module ThinReports
15
15
  :format_number_precision => %w( format number precision ),
16
16
  :format_padding_char => %w( format padding char ),
17
17
  :format_padding_dir => %w( format padding direction )
18
+ config_reader :word_wrap => %w( word-wrap )
18
19
 
19
20
  config_checker 'true', :multiple
20
21
  config_checker 'R', :format_padding_rdir => %w( format padding direction )
@@ -51,7 +51,7 @@ module ThinReports
51
51
  format = page.layout.format
52
52
  @pdf.start_new_page(format)
53
53
 
54
- drawer(format).draw(page.manager)
54
+ drawer(format).draw(page)
55
55
  end
56
56
 
57
57
  def drawer(format)
@@ -20,6 +20,13 @@ module ThinReports
20
20
  text_box(content, x, y, w, h, attrs)
21
21
  end
22
22
  end
23
+
24
+ def draw_shape_pageno(shape, page_no, page_count)
25
+ x, y, w, h = shape.box.values_at('x', 'y', 'width', 'height')
26
+
27
+ text_box(shape.build_format(page_no, page_count), x, y, w, h,
28
+ common_text_attrs(shape.style.svg_attrs))
29
+ end
23
30
 
24
31
  # @param [ThinReports::Core::Shape::Basic::Internal] shape
25
32
  def draw_shape_image(shape)
@@ -83,12 +90,15 @@ module ThinReports
83
90
  attrs[:line_height] = format.line_height unless format.line_height.blank?
84
91
  # Set the :valign option.
85
92
  attrs[:valign] = shape.style.valign
86
-
87
- # Set the :overflow option.
88
- attrs[:overflow] = text_overflow(format.overflow) if shape.type_of?(:tblock)
93
+
94
+ if shape.type_of?(:tblock)
95
+ # Set the :overflow option.
96
+ attrs[:overflow] = text_overflow(format.overflow)
97
+ # Set the :word_wrap option
98
+ attrs[:word_wrap] = text_word_wrap(format.word_wrap)
99
+ end
89
100
  end
90
101
  end
91
-
92
102
  end
93
103
 
94
104
  end
@@ -105,6 +105,15 @@ module ThinReports
105
105
  else :truncate
106
106
  end
107
107
  end
108
+
109
+ # @param [String] word_wrap
110
+ # @return [Symbol]
111
+ def text_word_wrap(word_wrap)
112
+ case word_wrap
113
+ when 'break-word' then :break_word
114
+ else :none
115
+ end
116
+ end
108
117
 
109
118
  # @param [String] xlink
110
119
  # @return [String]
@@ -21,13 +21,16 @@ module ThinReports
21
21
  # @option attrs [Numeric, String] :letter_spacing
22
22
  # @option attrs [Boolean] :single (false)
23
23
  # @option attrs [:trancate, :shrink_to_fit, :expand] :overflow (:trancate)
24
+ # @option attrs [:none, :break_word] :word_wrap (:none)
24
25
  def text_box(content, x, y, w, h, attrs = {})
25
26
  w, h = s2f(w, h)
26
27
  box_attrs = text_box_attrs(x, y, w, h, :single => attrs.delete(:single),
27
28
  :overflow => attrs[:overflow])
29
+ # Do not break by word unless :word_wrap is :break_word
30
+ content = text_without_line_wrap(content) if attrs[:word_wrap] == :none
28
31
 
29
32
  with_text_styles(attrs) do |built_attrs, font_styles|
30
- pdf.formatted_text_box([{:text => text_without_line_wrap(content),
33
+ pdf.formatted_text_box([{:text => content,
31
34
  :styles => font_styles}],
32
35
  built_attrs.merge(box_attrs))
33
36
  end
@@ -5,6 +5,11 @@ module ThinReports
5
5
 
6
6
  # @private
7
7
  module PDF::Page
8
+ # Add JIS-B4,B5 page geometry
9
+ Prawn::Document::PageGeometry::SIZES.update(
10
+ 'B4_JIS' => [728.5, 1031.8],
11
+ 'B5_JIS' => [515.9, 728.5]
12
+ )
8
13
 
9
14
  # @param [ThinReports::Layout::Format] format
10
15
  def start_new_page(format)
@@ -32,7 +37,7 @@ module ThinReports
32
37
 
33
38
  # @return [ThinReports::Layout::Format]
34
39
  attr_reader :current_page_format
35
-
40
+
36
41
  # @param [ThinReports::Layout::Format] new_format
37
42
  # @return [Boolean]
38
43
  def change_page_format?(new_format)
@@ -57,14 +62,24 @@ module ThinReports
57
62
  # @return [Hash]
58
63
  def new_basic_page_options(format)
59
64
  options = {:layout => format.page_orientation.to_sym}
65
+
60
66
  options[:size] = if format.user_paper_type?
61
67
  [format.page_width.to_f, format.page_height.to_f]
62
68
  else
63
- format.page_paper_type
69
+ case format.page_paper_type
70
+ # Convert B4(5)_ISO to B4(5)
71
+ when 'B4_ISO', 'B5_ISO'
72
+ format.page_paper_type.delete('_ISO')
73
+ # Convert B4(5) to B4(5)_JIS
74
+ when 'B4', 'B5'
75
+ "#{format.page_paper_type}_JIS"
76
+ else
77
+ format.page_paper_type
78
+ end
64
79
  end
65
80
  options
66
81
  end
67
82
  end
68
83
 
69
84
  end
70
- end
85
+ end
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module ThinReports
4
- module Generator
4
+ module Generator::PDF::Drawer
5
5
 
6
6
  # @abstract
7
7
  # @private
8
- class PDF::Drawer::Base
8
+ class Base
9
9
  # @param [ThinReports::Generator::PDF::Document] pdf
10
10
  # @param [ThinReports::Core::Shape::Manager::Format] format
11
11
  def initialize(pdf, format)
@@ -25,12 +25,7 @@ module ThinReports
25
25
  # @param [ThinReports::Core::Shape::Base::Internal] shape
26
26
  # @return [String]
27
27
  def pdf_stamp_id(shape)
28
- "#{@format.identifier}#{shape_stamp_id(shape)}"
29
- end
30
-
31
- # @see #pdf_stamp_id
32
- def shape_stamp_id(shape)
33
- "#{shape.id}#{shape.style.identifier}"
28
+ "#{@format.identifier}#{shape.identifier}"
34
29
  end
35
30
 
36
31
  # @overload pdf_stamp(shape_id)
@@ -1,37 +1,56 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module ThinReports
4
- module Generator
4
+ module Generator::PDF::Drawer
5
5
 
6
6
  # @private
7
- class PDF::Drawer::List < PDF::Drawer::Base
7
+ class List < Base
8
8
  # @param (see PDF::Drawer::Base#initialize)
9
9
  def initialize(pdf, format)
10
10
  super
11
11
  @sections = {}
12
12
  end
13
13
 
14
- # @param [ThinReports::Core::Shape::List::PageState] list
15
- def draw(list)
16
- draw_section(list.header) if list.header
17
- list.rows.each do |row|
14
+ # @param [ThinReports::Core::Shape::List::PageState] list_page
15
+ def draw(list_page)
16
+ draw_section(list_page.header) if list_page.header
17
+ list_page.rows.each do |row|
18
18
  draw_section(row)
19
19
  end
20
+
21
+ # Returns ThinReports::Core::Page object
22
+ manager = list_page.parent.manager
23
+
24
+ list_id = list_page.id.to_s
25
+ manager.format.shapes.each do |id, shape|
26
+ next unless list_pageno?(list_id, shape)
27
+
28
+ shape = manager.final_shape(id)
29
+ @pdf.draw_shape_pageno(shape.internal,
30
+ list_page.no, list_page.manager.page_count)
31
+ end
20
32
  end
21
-
22
- private
23
-
33
+
34
+ private
35
+
36
+ # @param [String] list_id
37
+ # @param [ThinReports::Core::Shape::Base::Format] shape
38
+ # @return [Boolean]
39
+ def list_pageno?(list_id, shape)
40
+ shape.type == ThinReports::Core::Shape::PageNumber::TYPE_NAME &&
41
+ shape.target == list_id
42
+ end
43
+
24
44
  # @param [ThinReports::Core::Shape::List::SectionInterface] section
25
45
  def draw_section(section)
26
46
  internal = section.internal
27
- drawer(internal).draw(section.manager, internal.relative_position)
47
+ drawer(internal).draw(section, internal.relative_position)
28
48
  end
29
49
 
30
50
  # @param [ThinReports::Core::Shape::List::SectionInternal] section
31
51
  # @return [ThinReports::Generator::PDF::Drawer::ListSection]
32
52
  def drawer(section)
33
- @sections[section.section_name] ||=
34
- PDF::Drawer::ListSection.new(@pdf, section)
53
+ @sections[section.section_name] ||= ListSection.new(@pdf, section)
35
54
  end
36
55
  end
37
56
 
@@ -1,10 +1,10 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module ThinReports
4
- module Generator
4
+ module Generator::PDF::Drawer
5
5
 
6
6
  # @private
7
- class PDF::Drawer::ListSection < PDF::Drawer::Page
7
+ class ListSection < Page
8
8
  # @param pdf (see PDF::Drawer::Page#initialize)
9
9
  # @param section [ThinReports::Core::Shape::List::SectionInternal] section
10
10
  def initialize(pdf, section)
@@ -13,12 +13,12 @@ module ThinReports
13
13
  @stamp_created = false
14
14
  end
15
15
 
16
- # @param [ThinReports::Core::Shape::Manager::Internal] manager
16
+ # @param [ThinReports::Core::Shape::List::SectionInternal] section
17
17
  # @param [Array<Numeric>] at
18
- def draw(manager, at)
18
+ def draw(section, at)
19
19
  @draw_at = at
20
20
  draw_section
21
- super(manager)
21
+ super(section)
22
22
  end
23
23
 
24
24
  private
@@ -1,28 +1,36 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module ThinReports
4
- module Generator
4
+ module Generator::PDF::Drawer
5
5
 
6
6
  # @private
7
- class PDF::Drawer::Page < PDF::Drawer::Base
7
+ class Page < Base
8
8
  # @param (see PDF::Drawer::Base#initialize)
9
9
  def initialize(pdf, format)
10
10
  super
11
11
  @lists = {}
12
12
  end
13
13
 
14
- # @param [ThinReports::Core::Shape::Manager::Internal] manager
15
- def draw(manager)
14
+ # @param [ThinReports::Core::Page] page
15
+ def draw(page)
16
+ manager = page.manager
17
+
16
18
  manager.format.shapes.each_key do |id|
17
- if shape = manager.final_shape(id)
18
- draw_shape(shape.internal)
19
+ next unless shape = manager.final_shape(id)
20
+
21
+ shape = shape.internal
22
+
23
+ if shape.type_of?(:pageno)
24
+ # Do not draw pageno if is not for Report
25
+ draw_pageno_shape(shape, page) if page.count? && shape.for_report?
26
+ else
27
+ draw_shape(shape)
19
28
  end
20
29
  end
21
30
  end
22
31
 
23
32
  private
24
-
25
- # @param [ThinReports::Core::Shape::Base::Internal] shape
33
+
26
34
  def draw_shape(shape)
27
35
  case
28
36
  when shape.type_of?(:tblock)
@@ -32,7 +40,7 @@ module ThinReports
32
40
  when shape.type_of?(:iblock)
33
41
  draw_iblock_shape(shape)
34
42
  else
35
- id = shape_stamp_id(shape)
43
+ id = shape.identifier
36
44
  unless @stamps.include?(id)
37
45
  create_basic_shape_stamp(shape)
38
46
  @stamps << id
@@ -41,9 +49,13 @@ module ThinReports
41
49
  end
42
50
  end
43
51
 
52
+ def draw_pageno_shape(shape, page)
53
+ @pdf.draw_shape_pageno(shape, page.no, page.report.page_count)
54
+ end
55
+
44
56
  # @see #draw_shape
45
57
  def draw_list_shape(shape)
46
- drawer = @lists[shape.id] ||= PDF::Drawer::List.new(@pdf, shape.format)
58
+ drawer = @lists[shape.id] ||= List.new(@pdf, shape.format)
47
59
  drawer.draw(shape)
48
60
  end
49
61
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  # @private
4
4
  module Prawn
5
- # @private
6
5
  class Document
7
6
  # Create around alias.
8
7
  alias_method :original_width_of, :width_of
@@ -28,4 +27,22 @@ module Prawn
28
27
  original_calc_image_dimensions(info, options)
29
28
  end
30
29
  end
30
+
31
+ # Patch: https://github.com/prawnpdf/prawn/commit/34039d13b7886692debca11e85b9a572a20d57ee
32
+ module Core
33
+ class Reference
34
+ def <<(data)
35
+ (@stream ||= "") << data
36
+ @data[:Length] = @stream.length
37
+ @stream
38
+ end
39
+
40
+ def compress_stream
41
+ @stream = Zlib::Deflate.deflate(@stream)
42
+ @data[:Filter] = :FlateDecode
43
+ @data[:Length] = @stream.length
44
+ @compressed = true
45
+ end
46
+ end
47
+ end
31
48
  end
@@ -67,10 +67,12 @@ module ThinReports
67
67
  end
68
68
 
69
69
  # @param [ThinReports::Report::Base] parent
70
+ # @param [Hash] options ({})
71
+ # @option option [Boolean] :count (true)
70
72
  # @return [Page]
71
73
  # @private
72
- def init_new_page(parent)
73
- self.class.Page.new(parent, self)
74
+ def init_new_page(parent, options = {})
75
+ self.class.Page.new(parent, self, options)
74
76
  end
75
77
  end
76
78
 
@@ -12,11 +12,7 @@ module ThinReports
12
12
  config_reader :page_paper_type => %w( config page paper-type ),
13
13
  :page_width => %w( config page width ),
14
14
  :page_height => %w( config page height ),
15
- :page_orientation => %w( config page orientation ),
16
- :page_margin_top => %w( config page margin-top ),
17
- :page_margin_bottom => %w( config page margin-bottom ),
18
- :page_margin_left => %w( config page margin-left ),
19
- :page_margin_left => %w( config page margin-right )
15
+ :page_orientation => %w( config page orientation )
20
16
 
21
17
  config_checker 'user', :user_paper_type => %w( config page paper-type )
22
18
 
@@ -7,6 +7,9 @@ module ThinReports
7
7
  # @return [ThinReports::Report::Internal]
8
8
  # @private
9
9
  attr_reader :internal
10
+
11
+ # @return [Integer]
12
+ attr_reader :start_page_number
10
13
 
11
14
  class << self
12
15
  # @param options (see #initialize)
@@ -52,10 +55,11 @@ module ThinReports
52
55
  # @yield (see .create)
53
56
  # @yieldparam (see .create)
54
57
  # @see .generate
58
+ # @deprecated Please use the #generate method with :filename option instead.
55
59
  # @return [void]
56
60
  def generate_file(*args, &block)
57
61
  raise ArgumentError, '#generate_file requires a block' unless block_given?
58
-
62
+
59
63
  report_opts, generator_opts = extract_options!(args)
60
64
 
61
65
  report = create(report_opts, &block)
@@ -87,6 +91,12 @@ module ThinReports
87
91
  # @option options [String, nil] :layout (nil)
88
92
  def initialize(options = {})
89
93
  @internal = Report::Internal.new(self, options)
94
+ @start_page_number = 1
95
+ end
96
+
97
+ # @param [Integer] page_number
98
+ def start_page_number_from(page_number)
99
+ @start_page_number = page_number
90
100
  end
91
101
 
92
102
  # @param [String] layout path to layout-file.
@@ -102,15 +112,16 @@ module ThinReports
102
112
 
103
113
  # @param [Hash] options
104
114
  # @option options [String, Symbol] :layout (nil)
115
+ # @option options [Boolean] :count (true)
105
116
  # @yield [page]
106
117
  # @yieldparam [ThinReports::Core::Page] page
107
118
  # @return [ThinReports::Core::Page]
108
119
  def start_new_page(options = {}, &block)
109
- unless layout = internal.load_layout(options[:layout])
120
+ unless layout = internal.load_layout(options.delete(:layout))
110
121
  raise ThinReports::Errors::NoRegisteredLayoutFound
111
122
  end
112
123
 
113
- page = internal.add_page(layout.init_new_page(self))
124
+ page = internal.add_page(layout.init_new_page(self, options))
114
125
  block_exec_on(page, &block)
115
126
  end
116
127
 
@@ -147,10 +158,24 @@ module ThinReports
147
158
  # Using the default generator type.
148
159
  # @param [Hash] options ({})
149
160
  # @return [String]
161
+ # @example Generate the PDF data
162
+ # report.generate(:pdf) #=> "%PDF-1.4...."
163
+ #
164
+ # # Or, you can omit the type of generator
165
+ # report.generate
166
+ # @example Create the PDF file (Since v0.8)
167
+ # report.generate(:pdf, :filename => 'foo.pdf')
150
168
  def generate(*args)
151
169
  options = args.last.is_a?(::Hash) ? args.pop : {}
152
- type = args.first || ThinReports.config.generator.default
153
- ThinReports::Generator.new(type, self, options).generate
170
+ type = args.first || ThinReports.config.generator.default
171
+ filename = options.delete(:filename)
172
+ generator = ThinReports::Generator.new(type, self, options)
173
+
174
+ if filename
175
+ generator.generate_file(filename)
176
+ else
177
+ generator.generate
178
+ end
154
179
  end
155
180
 
156
181
  # @overload generate_file(type, filename, options = {})
@@ -160,11 +185,16 @@ module ThinReports
160
185
  # @param [String] filename
161
186
  # @param options (see #generate)
162
187
  # @return [void]
188
+ # @deprecated Please use the #generate method with :filename option instead.
163
189
  def generate_file(*args)
190
+ warn '[DEPRECATION] The #generate_file method is deprecated. ' +
191
+ 'Please use the #generate(:filename => "filename") instead.'
192
+
164
193
  options = args.last.is_a?(::Hash) ? args.pop : {}
165
194
  args.unshift(ThinReports.config.generator.default) if args.size == 1
166
195
  type, filename = args
167
- ThinReports::Generator.new(type, self, options).generate_file(filename)
196
+
197
+ generate(type, options.merge(:filename => filename))
168
198
  end
169
199
 
170
200
  # @see ThinReports::Core::Shape::Manager::Target#list