Class: Thinreports::BasicReport::Core::Shape::List::Format

Inherits:
Basic::Format show all
Defined in:
lib/thinreports/basic_report/core/shape/list/format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Basic::Format

#affect_bottom_margin?

Methods included from Utils

#blank_value?, #call_block_in, #deep_copy, included

Methods inherited from Format::Base

#attributes, config_accessor, config_checker, config_reader, config_writer

Constructor Details

#initializeFormat

Returns a new instance of Format.



30
31
32
33
# File 'lib/thinreports/basic_report/core/shape/list/format.rb', line 30

def initialize(*)
  super
  initialize_sections
end

Instance Attribute Details

#sectionsObject (readonly)

Returns the value of attribute sections.



28
29
30
# File 'lib/thinreports/basic_report/core/shape/list/format.rb', line 28

def sections
  @sections
end

Instance Method Details

#has_section?(section_name) ⇒ Boolean

Parameters:

  • section_name (Symbol)

Returns:

  • (Boolean)


44
45
46
# File 'lib/thinreports/basic_report/core/shape/list/format.rb', line 44

def has_section?(section_name)
  section_name == :detail ? true : __send__(:"has_#{section_name}?")
end

#section(section_name) ⇒ Hash

Deprecated.

Parameters:

  • section_name (Symbol)

Returns:

  • (Hash)


38
39
40
# File 'lib/thinreports/basic_report/core/shape/list/format.rb', line 38

def section(section_name)
  __send__(section_name)
end

#section_base_position_top(section_name) ⇒ Numeric

Parameters:

  • section_name (:detai, :header, :page_footer, :footer)

Returns:

  • (Numeric)


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/thinreports/basic_report/core/shape/list/format.rb', line 56

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) ⇒ Numeric

Parameters:

  • section_name (Symbol)

Returns:

  • (Numeric)


50
51
52
# File 'lib/thinreports/basic_report/core/shape/list/format.rb', line 50

def section_height(section_name)
  has_section?(section_name) ? __send__(:"#{section_name}_height") : 0
end