Sha256: c907b41901a740ec000a318306bfbe4a907a9ae7195df162e7794201857ad006

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

module Phlexi
  module Table
    module Components
      module Options
        module Alignment
          def alignment(alignment = nil)
            if alignment.nil?
              options[:align] = options.fetch(:align) { calculate_alignment }
            else
              options[:align] = alignment
              self
            end
          end

          private

          def calculate_alignment
            case type
            when :integer, :float, :decimal
              :end
            else
              :start
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phlexi-table-0.0.5 lib/phlexi/table/components/options/alignment.rb
phlexi-table-0.0.4 lib/phlexi/table/components/options/alignment.rb
phlexi-table-0.0.3 lib/phlexi/table/components/options/alignment.rb