class Thinreports::Core::Shape::PageNumber::Internal

Public Instance Methods

build_format(page_no, page_count) click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 22
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
read_format() click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 10
def read_format
  states.key?(:format) ? states[:format] : format.default_format.dup
end
reset_format() click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 14
def reset_format
  states.delete(:format)
end
start_page_number() click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 44
def start_page_number
  for_report? ? parent.report.start_page_number : 1
end
style() click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 36
def style
  @style ||= PageNumber::Style.new(format)
end
type_of?(type_name) click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 40
def type_of?(type_name)
  type_name == PageNumber::TYPE_NAME
end
write_format(format) click to toggle source
# File lib/thinreports/core/shape/page_number/internal.rb, line 18
def write_format(format)
  states[:format] = format.to_s
end