class Thinreports::Core::Shape::List::Format

Attributes

sections[R]

Public Class Methods

new(*) click to toggle source
Calls superclass method Thinreports::Core::Format::Base::new
# File lib/thinreports/core/shape/list/format.rb, line 29
def initialize(*)
  super
  initialize_sections
end

Public Instance Methods

has_section?(section_name) click to toggle source

@param [Symbol] section_name @return [Boolean]

# File lib/thinreports/core/shape/list/format.rb, line 43
def has_section?(section_name)
  section_name == :detail ? true : __send__(:"has_#{section_name}?")
end
section(section_name) click to toggle source

@param [Symbol] section_name @return [Hash] @deprecated

# File lib/thinreports/core/shape/list/format.rb, line 37
def section(section_name)
  __send__(section_name)
end
section_base_position_top(section_name) click to toggle source

@param [:detai, :header, :page_footer, :footer] section_name @return [Numeric]

# File lib/thinreports/core/shape/list/format.rb, line 55
def section_base_position_top(section_name)
  section = @sections[section_name]
  return 0 unless has_section?(section_name)

  top = section.relative_top

  case section_name
  when :page_footer
    top - section_height(:detail)
  when :footer
    top - section_height(:detail) - section_height(:page_footer)
  else
    top
  end
end
section_height(section_name) click to toggle source

@param [Symbol] section_name @return [Numeric]

# File lib/thinreports/core/shape/list/format.rb, line 49
def section_height(section_name)
  has_section?(section_name) ? __send__(:"#{section_name}_height") : 0
end

Private Instance Methods

initialize_sections() click to toggle source
# File lib/thinreports/core/shape/list/format.rb, line 73
def initialize_sections
  @sections = {
    detail: List::SectionFormat.new(attributes['detail'])
  }

  @sections[:header] = section_format('header') if has_section?(:header)
  @sections[:page_footer] = section_format('page-footer') if has_section?(:page_footer)
  @sections[:footer] = section_format('footer') if has_section?(:footer)
end
section_format(section_name) click to toggle source
# File lib/thinreports/core/shape/list/format.rb, line 83
def section_format(section_name)
  List::SectionFormat.new(attributes[section_name])
end