Sha256: ef91784c96d164995c6156c7349b8829064b529c0a43fb2f2efc0d0c1b3a4bb2

Contents?: true

Size: 529 Bytes

Versions: 2

Compression:

Stored size: 529 Bytes

Contents

module MotionPrime
  class BaseCellSection < BaseSection
    attr_accessor :table, :cell_type

    def initialize(options = {})
      @table ||= options[:table]
      super
    end

    def section_styles
      @table.try(:cell_styles, self) || {}
    end

    def cell_type
      @cell_type ||= begin
        self.is_a?(BaseFieldSection) ? :field : :cell
      end
    end

    def cell_name
      return name unless table
      table_name = table.name.gsub('_table', '')
      name.gsub("#{table_name}_", '')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
motion-prime-0.3.2 motion-prime/sections/table/base_cell_section.rb
motion-prime-0.3.1 motion-prime/sections/table/base_cell_section.rb