thinreports 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +41 -0
- data/.travis.yml +4 -6
- data/CHANGELOG.md +21 -2
- data/Gemfile +2 -4
- data/README.md +4 -5
- data/Rakefile +7 -8
- data/examples/character_spacing/character_spacing.rb +1 -1
- data/examples/dynamic_image/dynamic_image.rb +3 -3
- data/examples/dynamic_style/dynamic_style.rb +1 -1
- data/examples/eudc/eudc.rb +1 -1
- data/examples/helper.rb +2 -2
- data/examples/hidden_shapes/hidden_shapes.rb +1 -1
- data/examples/list_events/list_events.rb +1 -1
- data/examples/list_manual_generation/list_manual_generation.rb +1 -1
- data/examples/list_page_number/list_page_number.rb +1 -1
- data/examples/page_number/page_number.rb +1 -1
- data/examples/palleted_png/palleted_png.rb +1 -3
- data/examples/password_setting/password_setting.rb +1 -1
- data/examples/report_callbacks/report_callbacks.rb +1 -1
- data/examples/single_line_tblock/single_line_tblock.rb +1 -1
- data/examples/tblock_overflow/tblock_overflow.rb +1 -1
- data/examples/tblock_styles/tblock_styles.rb +1 -1
- data/examples/text_align/text_align.rb +1 -1
- data/examples/typeB_page_size/typeB_page_size.rb +1 -1
- data/examples/word_wrap/word_wrap.rb +1 -1
- data/lib/thinreports.rb +16 -15
- data/lib/thinreports/config.rb +2 -24
- data/lib/thinreports/core/errors.rb +6 -17
- data/lib/thinreports/core/format/base.rb +62 -61
- data/lib/thinreports/core/shape.rb +13 -14
- data/lib/thinreports/core/shape/base.rb +3 -12
- data/lib/thinreports/core/shape/base/interface.rb +35 -32
- data/lib/thinreports/core/shape/base/internal.rb +45 -43
- data/lib/thinreports/core/shape/basic.rb +12 -12
- data/lib/thinreports/core/shape/basic/block_format.rb +8 -6
- data/lib/thinreports/core/shape/basic/block_interface.rb +24 -22
- data/lib/thinreports/core/shape/basic/block_internal.rb +28 -26
- data/lib/thinreports/core/shape/basic/format.rb +11 -9
- data/lib/thinreports/core/shape/basic/interface.rb +79 -77
- data/lib/thinreports/core/shape/basic/internal.rb +17 -14
- data/lib/thinreports/core/shape/image_block.rb +9 -9
- data/lib/thinreports/core/shape/image_block/format.rb +7 -5
- data/lib/thinreports/core/shape/image_block/interface.rb +15 -13
- data/lib/thinreports/core/shape/image_block/internal.rb +10 -8
- data/lib/thinreports/core/shape/list.rb +13 -13
- data/lib/thinreports/core/shape/list/format.rb +83 -77
- data/lib/thinreports/core/shape/list/manager.rb +182 -176
- data/lib/thinreports/core/shape/list/page.rb +94 -93
- data/lib/thinreports/core/shape/list/page_state.rb +42 -40
- data/lib/thinreports/core/shape/list/section_format.rb +28 -26
- data/lib/thinreports/core/shape/list/section_interface.rb +42 -40
- data/lib/thinreports/core/shape/list/section_internal.rb +21 -19
- data/lib/thinreports/core/shape/manager.rb +4 -13
- data/lib/thinreports/core/shape/manager/format.rb +21 -19
- data/lib/thinreports/core/shape/manager/internal.rb +88 -84
- data/lib/thinreports/core/shape/manager/target.rb +93 -95
- data/lib/thinreports/core/shape/page_number.rb +9 -9
- data/lib/thinreports/core/shape/page_number/format.rb +20 -18
- data/lib/thinreports/core/shape/page_number/interface.rb +20 -18
- data/lib/thinreports/core/shape/page_number/internal.rb +47 -44
- data/lib/thinreports/core/shape/style.rb +5 -14
- data/lib/thinreports/core/shape/style/base.rb +121 -120
- data/lib/thinreports/core/shape/style/basic.rb +12 -10
- data/lib/thinreports/core/shape/style/graphic.rb +35 -33
- data/lib/thinreports/core/shape/style/text.rb +113 -107
- data/lib/thinreports/core/shape/text.rb +9 -9
- data/lib/thinreports/core/shape/text/format.rb +10 -9
- data/lib/thinreports/core/shape/text/interface.rb +13 -11
- data/lib/thinreports/core/shape/text/internal.rb +14 -12
- data/lib/thinreports/core/shape/text_block.rb +10 -10
- data/lib/thinreports/core/shape/text_block/format.rb +35 -33
- data/lib/thinreports/core/shape/text_block/formatter.rb +26 -24
- data/lib/thinreports/core/shape/text_block/formatter/basic.rb +25 -25
- data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +15 -12
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +45 -39
- data/lib/thinreports/core/shape/text_block/formatter/padding.rb +17 -14
- data/lib/thinreports/core/shape/text_block/interface.rb +25 -23
- data/lib/thinreports/core/shape/text_block/internal.rb +68 -68
- data/lib/thinreports/core/utils.rb +4 -3
- data/lib/thinreports/generator/pdf.rb +24 -25
- data/lib/thinreports/generator/pdf/document.rb +109 -110
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +58 -51
- data/lib/thinreports/generator/pdf/document/draw_template_items.rb +51 -47
- data/lib/thinreports/generator/pdf/document/font.rb +62 -59
- data/lib/thinreports/generator/pdf/document/graphics.rb +32 -33
- data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +122 -121
- data/lib/thinreports/generator/pdf/document/graphics/basic.rb +113 -114
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +58 -150
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +152 -137
- data/lib/thinreports/generator/pdf/document/page.rb +63 -64
- data/lib/thinreports/generator/pdf/document/parse_color.rb +37 -37
- data/lib/thinreports/generator/pdf/drawer/base.rb +41 -41
- data/lib/thinreports/generator/pdf/drawer/list.rb +48 -45
- data/lib/thinreports/generator/pdf/drawer/list_section.rb +42 -40
- data/lib/thinreports/generator/pdf/drawer/page.rb +101 -96
- data/lib/thinreports/generator/pdf/prawn_ext.rb +4 -30
- data/lib/thinreports/generator/pdf/prawn_ext/calc_image_dimensions.rb +34 -0
- data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +29 -0
- data/lib/thinreports/layout.rb +5 -7
- data/lib/thinreports/layout/base.rb +5 -7
- data/lib/thinreports/layout/format.rb +18 -13
- data/lib/thinreports/layout/legacy_schema.rb +18 -10
- data/lib/thinreports/layout/version.rb +22 -25
- data/lib/thinreports/report.rb +4 -6
- data/lib/thinreports/report/base.rb +24 -51
- data/lib/thinreports/report/internal.rb +9 -11
- data/lib/thinreports/report/page.rb +5 -6
- data/lib/thinreports/version.rb +2 -2
- data/test/schema_helper.rb +4 -3
- data/test/test_helper.rb +9 -3
- data/test/unit/core/format/test_base.rb +1 -1
- data/test/unit/core/shape/base/test_internal.rb +1 -1
- data/test/unit/core/shape/basic/test_block_format.rb +1 -1
- data/test/unit/core/shape/basic/test_block_interface.rb +1 -1
- data/test/unit/core/shape/basic/test_block_internal.rb +1 -1
- data/test/unit/core/shape/basic/test_format.rb +1 -1
- data/test/unit/core/shape/basic/test_interface.rb +1 -1
- data/test/unit/core/shape/basic/test_internal.rb +1 -1
- data/test/unit/core/shape/image_block/test_interface.rb +1 -1
- data/test/unit/core/shape/image_block/test_internal.rb +1 -1
- data/test/unit/core/shape/list/test_format.rb +1 -1
- data/test/unit/core/shape/list/test_manager.rb +4 -4
- data/test/unit/core/shape/list/test_page.rb +1 -1
- data/test/unit/core/shape/list/test_page_state.rb +1 -1
- data/test/unit/core/shape/list/test_section_format.rb +1 -1
- data/test/unit/core/shape/list/test_section_interface.rb +2 -2
- data/test/unit/core/shape/list/test_section_internal.rb +1 -1
- data/test/unit/core/shape/manager/test_format.rb +2 -2
- data/test/unit/core/shape/manager/test_internal.rb +3 -3
- data/test/unit/core/shape/manager/test_target.rb +1 -1
- data/test/unit/core/shape/page_number/test_format.rb +1 -1
- data/test/unit/core/shape/page_number/test_interface.rb +1 -1
- data/test/unit/core/shape/page_number/test_internal.rb +1 -1
- data/test/unit/core/shape/styles/test_base.rb +1 -1
- data/test/unit/core/shape/styles/test_basic.rb +1 -1
- data/test/unit/core/shape/styles/test_graphic.rb +1 -1
- data/test/unit/core/shape/styles/test_text.rb +1 -1
- data/test/unit/core/shape/text/test_format.rb +1 -1
- data/test/unit/core/shape/text/test_internal.rb +1 -1
- data/test/unit/core/shape/text_block/formatter/test_basic.rb +1 -1
- data/test/unit/core/shape/text_block/formatter/test_datetime.rb +1 -1
- data/test/unit/core/shape/text_block/formatter/test_number.rb +1 -1
- data/test/unit/core/shape/text_block/formatter/test_padding.rb +2 -2
- data/test/unit/core/shape/text_block/test_format.rb +1 -1
- data/test/unit/core/shape/text_block/test_formatter.rb +1 -1
- data/test/unit/core/shape/text_block/test_interface.rb +1 -1
- data/test/unit/core/shape/text_block/test_internal.rb +3 -3
- data/test/unit/core/test_shape.rb +1 -1
- data/test/unit/core/test_utils.rb +2 -2
- data/test/unit/generator/pdf/document/graphics/test_attributes.rb +1 -1
- data/test/unit/generator/pdf/document/graphics/test_basic.rb +2 -1
- data/test/unit/generator/pdf/document/graphics/test_image.rb +27 -131
- data/test/unit/generator/pdf/document/graphics/test_text.rb +1 -1
- data/test/unit/generator/pdf/document/test_font.rb +2 -2
- data/test/unit/generator/pdf/document/test_graphics.rb +1 -1
- data/test/unit/generator/pdf/document/test_page.rb +7 -7
- data/test/unit/generator/pdf/document/test_parse_color.rb +1 -1
- data/test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +41 -0
- data/test/unit/generator/pdf/prawn_ext/test_width_of.rb +22 -0
- data/test/unit/generator/pdf/test_document.rb +8 -6
- data/test/unit/generator/test_pdf.rb +12 -10
- data/test/unit/layout/test_base.rb +1 -1
- data/test/unit/layout/test_format.rb +2 -2
- data/test/unit/layout/test_legacy_schema.rb +4 -4
- data/test/unit/layout/test_version.rb +11 -80
- data/test/unit/report/test_base.rb +45 -59
- data/test/unit/report/test_internal.rb +1 -1
- data/test/unit/test_config.rb +1 -16
- data/test/unit/test_layout.rb +1 -1
- data/test/unit/test_report.rb +1 -1
- data/thinreports.gemspec +11 -14
- metadata +42 -103
- data/lib/thinreports/generator.rb +0 -29
- data/lib/thinreports/generator/base.rb +0 -40
- data/lib/thinreports/generator/configuration.rb +0 -31
- data/lib/thinreports/report/events.rb +0 -32
- data/test/unit/generator/test_base.rb +0 -40
- data/test/unit/generator/test_configuration.rb +0 -21
@@ -1,88 +1,89 @@
|
|
1
|
-
#
|
2
|
-
module Thinreports::Core
|
3
|
-
module Format
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def config_accessor(*configs, &block)
|
29
|
+
config_reader(*configs, &block)
|
30
|
+
config_writer(*configs)
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
+
private
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
def initialize(config, &block)
|
56
|
+
@config = config
|
57
|
+
block.call(self) if ::Kernel.block_given?
|
58
|
+
end
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
def attributes
|
61
|
+
@config
|
62
|
+
end
|
62
63
|
|
63
|
-
|
64
|
+
private
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
def write(value, *keys)
|
77
|
+
key = keys.pop
|
78
|
+
owner = find(*keys)
|
79
|
+
owner[key] = value
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
-
#
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'forwardable'
|
4
4
|
|
5
|
-
|
6
|
-
|
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
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Thinreports
|
4
|
-
module Core
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Thinreports
|
4
|
-
module Core
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Thinreports
|
4
|
-
module Core
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Thinreports
|
4
|
-
module Core
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Thinreports
|
4
|
-
module Core
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|