Class: Thinreports::BasicReport::Core::Shape::PageNumber::Internal
Instance Attribute Summary
#format, #parent, #states
Instance Method Summary
collapse
#identifier
#copy, #initialize
Methods included from Utils
#blank_value?, #call_block_in, #deep_copy, included
Instance Method Details
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 23
def build_format(page_no, page_count)
return '' if blank_value?(read_format)
if start_page_number > 1
page_no += start_page_number - 1
page_count += start_page_number - 1
end
read_format.dup.tap do |f|
f.gsub! '{page}', page_no.to_s
f.gsub! '{total}', page_count.to_s
end
end
|
11
12
13
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 11
def read_format
states.key?(:format) ? states[:format] : format.default_format.dup
end
|
15
16
17
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 15
def reset_format
states.delete(:format)
end
|
#start_page_number ⇒ Object
45
46
47
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 45
def start_page_number
for_report? ? parent.report.start_page_number : 1
end
|
#style ⇒ Object
37
38
39
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 37
def style
@style ||= PageNumber::Style.new(format)
end
|
#type_of?(type_name) ⇒ Boolean
41
42
43
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 41
def type_of?(type_name)
type_name == PageNumber::TYPE_NAME
end
|
19
20
21
|
# File 'lib/thinreports/basic_report/core/shape/page_number/internal.rb', line 19
def write_format(format)
states[:format] = format.to_s
end
|