Class: Thinreports::BasicReport::Layout::Format
Instance Attribute Summary
#identifier
Class Method Summary
collapse
Instance Method Summary
collapse
#find_shape, #has_shape?, #shapes
#attributes, config_accessor, config_checker, config_reader, config_writer
Constructor Details
#initialize ⇒ Format
43
44
45
46
|
# File 'lib/thinreports/basic_report/layout/format.rb', line 43
def initialize(*)
super
initialize_items(attributes['items'])
end
|
Class Method Details
.build(filename) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/thinreports/basic_report/layout/format.rb', line 17
def build(filename)
schema = JSON.parse(read_file(filename))
schema_version = Layout::Version.new(schema['version'])
unless schema_version.compatible?
raise Errors::IncompatibleLayoutFormat.new(
filename, schema['version'],
Layout::Version.compatible_rules.join(' and ')
)
end
if schema_version.legacy?
warn '[DEPRECATION] Support for the layout file with old format' \
' that generated with Editor 0.8 or lower will be dropped in Thinreports 1.1.' \
' Please convert to new layout format using Thinreports Editor 0.9 or 1.0.'
schema = Layout::LegacySchema.new(schema).upgrade
end
new schema
end
|
.read_file(filename) ⇒ Object
38
39
40
|
# File 'lib/thinreports/basic_report/layout/format.rb', line 38
def read_file(filename)
File.read(filename, encoding: 'UTF-8')
end
|
Instance Method Details
#user_paper_type? ⇒ Boolean
48
49
50
|
# File 'lib/thinreports/basic_report/layout/format.rb', line 48
def user_paper_type?
page_paper_type == 'user'
end
|