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
@@ -1,88 +1,89 @@
1
- # coding: utf-8
2
- module Thinreports::Core
3
- module Format
1
+ # frozen_string_literal: true
4
2
 
5
- # @abstract
6
- class Base
7
- class << self
8
- def config_reader(*configs, &block)
9
- each_configs(*configs) do |m, location|
10
- define_read_method(m, location, &block)
3
+ module Thinreports
4
+ module Core
5
+ module Format
6
+ # @abstract
7
+ class Base
8
+ class << self
9
+ def config_reader(*configs, &block)
10
+ each_configs(*configs) do |m, location|
11
+ define_read_method(m, location, &block)
12
+ end
11
13
  end
12
- end
13
14
 
14
- def config_checker(check, *configs)
15
- checker = lambda {|val| val == check}
16
- each_configs(*configs) do |m, location|
17
- define_read_method(:"#{m}?", location, &checker)
15
+ def config_checker(check, *configs)
16
+ checker = ->(val) { val == check }
17
+ each_configs(*configs) do |m, location|
18
+ define_read_method(:"#{m}?", location, &checker)
19
+ end
18
20
  end
19
- end
20
21
 
21
- def config_writer(*configs)
22
- each_configs(*configs) do |m, location|
23
- define_write_method(m, location)
22
+ def config_writer(*configs)
23
+ each_configs(*configs) do |m, location|
24
+ define_write_method(m, location)
25
+ end
24
26
  end
25
- end
26
27
 
27
- def config_accessor(*configs, &block)
28
- config_reader(*configs, &block)
29
- config_writer(*configs)
30
- end
28
+ def config_accessor(*configs, &block)
29
+ config_reader(*configs, &block)
30
+ config_writer(*configs)
31
+ end
31
32
 
32
- private
33
+ private
33
34
 
34
- def define_read_method(m, location = nil, &block)
35
- define_method(m) do
36
- read(*location, &block)
35
+ def define_read_method(m, location = nil, &block)
36
+ define_method(m) do
37
+ read(*location, &block)
38
+ end
37
39
  end
38
- end
39
40
 
40
- def define_write_method(m, location = nil)
41
- define_method(:"#{m}=") do |value|
42
- write(value, *location)
41
+ def define_write_method(m, location = nil)
42
+ define_method(:"#{m}=") do |value|
43
+ write(value, *location)
44
+ end
43
45
  end
44
- end
45
46
 
46
- def each_configs(*configs, &block)
47
- c = configs.first.is_a?(::Hash) ? configs.first : (configs || [])
48
- c.each do |m, location|
49
- block.call(m, location || [m.to_s])
47
+ def each_configs(*configs, &block)
48
+ c = configs.first.is_a?(::Hash) ? configs.first : (configs || [])
49
+ c.each do |m, location|
50
+ block.call(m, location || [m.to_s])
51
+ end
50
52
  end
51
53
  end
52
- end
53
54
 
54
- def initialize(config, &block)
55
- @config = config
56
- block.call(self) if ::Kernel.block_given?
57
- end
55
+ def initialize(config, &block)
56
+ @config = config
57
+ block.call(self) if ::Kernel.block_given?
58
+ end
58
59
 
59
- def attributes
60
- @config
61
- end
60
+ def attributes
61
+ @config
62
+ end
62
63
 
63
- private
64
+ private
64
65
 
65
- def find(*keys)
66
- if keys.empty?
67
- @config
68
- else
69
- keys.inject(@config) do |c, k|
70
- c.is_a?(::Hash) ? c[k] : (break c)
66
+ def find(*keys)
67
+ if keys.empty?
68
+ @config
69
+ else
70
+ keys.inject(@config) do |c, k|
71
+ c.is_a?(::Hash) ? c[k] : (break c)
72
+ end
71
73
  end
72
74
  end
73
- end
74
75
 
75
- def write(value, *keys)
76
- key = keys.pop
77
- owner = find(*keys)
78
- owner[key] = value
79
- end
76
+ def write(value, *keys)
77
+ key = keys.pop
78
+ owner = find(*keys)
79
+ owner[key] = value
80
+ end
80
81
 
81
- def read(*keys, &block)
82
- value = find(*keys)
83
- ::Kernel.block_given? ? block.call(value) : value
82
+ def read(*keys, &block)
83
+ value = find(*keys)
84
+ ::Kernel.block_given? ? block.call(value) : value
85
+ end
84
86
  end
85
87
  end
86
-
87
88
  end
88
89
  end
@@ -1,19 +1,19 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
4
  module Core
5
-
6
5
  module Shape
7
- def Interface(parent, format)
6
+ def Interface(parent, format) # rubocop:disable Style/MethodName
8
7
  find_by_type(format.type)::Interface.new(parent, format)
9
8
  end
10
9
 
11
- def Format(type)
10
+ def Format(type) # rubocop:disable Style/MethodName
12
11
  find_by_type(type)::Format
13
12
  end
14
13
 
15
14
  module_function :Interface, :Format
16
15
 
16
+ # rubocop:disable Metrics/CyclomaticComplexity
17
17
  def self.find_by_type(type)
18
18
  case type
19
19
  when TextBlock::TYPE_NAME then TextBlock
@@ -27,16 +27,15 @@ module Thinreports
27
27
  end
28
28
  end
29
29
  end
30
-
31
30
  end
32
31
  end
33
32
 
34
- require 'thinreports/core/shape/style'
35
- require 'thinreports/core/shape/manager'
36
- require 'thinreports/core/shape/base'
37
- require 'thinreports/core/shape/basic'
38
- require 'thinreports/core/shape/text'
39
- require 'thinreports/core/shape/text_block'
40
- require 'thinreports/core/shape/image_block'
41
- require 'thinreports/core/shape/list'
42
- require 'thinreports/core/shape/page_number'
33
+ require_relative 'shape/style'
34
+ require_relative 'shape/manager'
35
+ require_relative 'shape/base'
36
+ require_relative 'shape/basic'
37
+ require_relative 'shape/text'
38
+ require_relative 'shape/text_block'
39
+ require_relative 'shape/image_block'
40
+ require_relative 'shape/list'
41
+ require_relative 'shape/page_number'
@@ -1,15 +1,6 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'forwardable'
4
4
 
5
- module Thinreports
6
- module Core::Shape
7
-
8
- module Base
9
- end
10
-
11
- end
12
- end
13
-
14
- require 'thinreports/core/shape/base/internal'
15
- require 'thinreports/core/shape/base/interface'
5
+ require_relative 'base/internal'
6
+ require_relative 'base/interface'
@@ -1,38 +1,41 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
- module Core::Shape
5
-
6
- # @abstract
7
- class Base::Interface
8
- include Utils
9
- extend Forwardable
10
-
11
- def self.internal_delegators(*args)
12
- def_delegators :internal, *args
13
- end
14
- private_class_method :internal_delegators
15
-
16
- attr_reader :internal
17
-
18
- def initialize(parent, format, internal = nil)
19
- @internal = internal || init_internal(parent, format)
20
- end
21
-
22
- def copy(parent)
23
- self.class.new(parent, internal.format, internal.copy(parent))
24
- end
25
-
26
- private
27
-
28
- # @param [Thinreports::Report::Page, Thinreports::Core::Shape::List::SectionInterface] parent
29
- # @param [Thinreports::Core::Shape::Basic::Format] format
30
- # @return [Thinreports::Core::Shape::Basic::Internal]
31
- # @abstract
32
- def init_internal
33
- raise NotImplementedError
4
+ module Core
5
+ module Shape
6
+ module Base
7
+ # @abstract
8
+ class Interface
9
+ include Utils
10
+ extend Forwardable
11
+
12
+ def self.internal_delegators(*args)
13
+ def_delegators :internal, *args
14
+ end
15
+ private_class_method :internal_delegators
16
+
17
+ attr_reader :internal
18
+
19
+ def initialize(parent, format, internal = nil)
20
+ @internal = internal || init_internal(parent, format)
21
+ end
22
+
23
+ def copy(parent)
24
+ self.class.new(parent, internal.format, internal.copy(parent))
25
+ end
26
+
27
+ private
28
+
29
+ # @param [Thinreports::Report::Page, Thinreports::Core::Shape::List::SectionInterface] parent
30
+ # @param [Thinreports::Core::Shape::Basic::Format] format
31
+ # @return [Thinreports::Core::Shape::Basic::Internal]
32
+ # @abstract
33
+ # rubocop:disable Lint/UnusedMethodArgument
34
+ def init_internal(parent, format)
35
+ raise NotImplementedError
36
+ end
37
+ end
34
38
  end
35
39
  end
36
-
37
40
  end
38
41
  end
@@ -1,49 +1,51 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
- module Core::Shape
5
-
6
- # @abstract
7
- class Base::Internal
8
- include Utils
9
- extend Forwardable
10
-
11
- def self.format_delegators(*args)
12
- def_delegators :format, *args
13
- end
14
- private_class_method :format_delegators
15
-
16
- attr_reader :parent
17
- attr_reader :format
18
- attr_writer :style
19
- attr_accessor :states
20
-
21
- def initialize(parent, format)
22
- @parent = parent
23
- @format = format
24
- @states = {}
25
- @style = nil
26
-
27
- @finalized_attributes = nil
28
- end
29
-
30
- def style
31
- raise NotImplementedError
32
- end
33
-
34
- def copy(new_parent, &block)
35
- new_internal = self.class.new(new_parent, format)
36
- new_internal.style = style.copy
37
- new_internal.states = deep_copy(states)
38
-
39
- block.call(new_internal) if block_given?
40
- new_internal
41
- end
42
-
43
- def type_of?
44
- raise NotImplementedError
4
+ module Core
5
+ module Shape
6
+ module Base
7
+ # @abstract
8
+ class Internal
9
+ include Utils
10
+ extend Forwardable
11
+
12
+ def self.format_delegators(*args)
13
+ def_delegators :format, *args
14
+ end
15
+ private_class_method :format_delegators
16
+
17
+ attr_reader :parent
18
+ attr_reader :format
19
+ attr_writer :style
20
+ attr_accessor :states
21
+
22
+ def initialize(parent, format)
23
+ @parent = parent
24
+ @format = format
25
+ @states = {}
26
+ @style = nil
27
+
28
+ @finalized_attributes = nil
29
+ end
30
+
31
+ def style
32
+ raise NotImplementedError
33
+ end
34
+
35
+ def copy(new_parent, &block)
36
+ new_internal = self.class.new(new_parent, format)
37
+ new_internal.style = style.copy
38
+ new_internal.states = deep_copy(states)
39
+
40
+ block.call(new_internal) if block_given?
41
+ new_internal
42
+ end
43
+
44
+ def type_of?
45
+ raise NotImplementedError
46
+ end
47
+ end
45
48
  end
46
49
  end
47
-
48
50
  end
49
51
  end
@@ -1,18 +1,18 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
- module Core::Shape
5
-
6
- module Basic
7
- TYPE_NAMES = %w( line rect ellipse image )
4
+ module Core
5
+ module Shape
6
+ module Basic
7
+ TYPE_NAMES = %w[line rect ellipse image].freeze
8
+ end
8
9
  end
9
-
10
10
  end
11
11
  end
12
12
 
13
- require 'thinreports/core/shape/basic/format'
14
- require 'thinreports/core/shape/basic/internal'
15
- require 'thinreports/core/shape/basic/interface'
16
- require 'thinreports/core/shape/basic/block_format'
17
- require 'thinreports/core/shape/basic/block_internal'
18
- require 'thinreports/core/shape/basic/block_interface'
13
+ require_relative 'basic/format'
14
+ require_relative 'basic/internal'
15
+ require_relative 'basic/interface'
16
+ require_relative 'basic/block_format'
17
+ require_relative 'basic/block_internal'
18
+ require_relative 'basic/block_interface'
@@ -1,11 +1,13 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
- module Core::Shape
5
-
6
- class Basic::BlockFormat < Basic::Format
7
- config_reader :value
4
+ module Core
5
+ module Shape
6
+ module Basic
7
+ class BlockFormat < Basic::Format
8
+ config_reader :value
9
+ end
10
+ end
8
11
  end
9
-
10
12
  end
11
13
  end
@@ -1,30 +1,32 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Thinreports
4
- module Core::Shape
4
+ module Core
5
+ module Shape
6
+ module Basic
7
+ class BlockInterface < Basic::Interface
8
+ # @overload value(val)
9
+ # Set a val
10
+ # @param [Object] val
11
+ # @return [self]
12
+ # @overload value
13
+ # Return the value
14
+ # @return [Object]
15
+ def value(*args)
16
+ if args.empty?
17
+ internal.read_value
18
+ else
19
+ internal.write_value(args.first)
20
+ self
21
+ end
22
+ end
5
23
 
6
- class Basic::BlockInterface < Basic::Interface
7
- # @overload value(val)
8
- # Set a val
9
- # @param [Object] val
10
- # @return [self]
11
- # @overload value
12
- # Return the value
13
- # @return [Object]
14
- def value(*args)
15
- if args.empty?
16
- internal.read_value
17
- else
18
- internal.write_value(args.first)
19
- self
24
+ # @param [Object] val
25
+ def value=(val)
26
+ value(val)
27
+ end
20
28
  end
21
29
  end
22
-
23
- # @param [Object] val
24
- def value=(val)
25
- value(val)
26
- end
27
30
  end
28
-
29
31
  end
30
32
  end