Sha256: 26f2a1180966b150a9f92c8165ba6345ad572e64dda793b85f7e46f5be1576ba

Contents?: true

Size: 814 Bytes

Versions: 5

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EacRailsUtils
  module DataTableHelper
    class DataTable
      class ValueCell
        enable_method_class
        common_constructor :data_table, :column, :record
        delegate :view, to: :data_table

        # @return [ActiveSupport::SafeBuffer]
        def result
          view.content_tag('td', column.record_value(record), tag_attributes)
        end

        # @return [Object]
        def tag_attribute_value(value)
          value.is_a?(::Proc) ? value.call(record) : value
        end

        # @return [Hash]
        def tag_attributes
          column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h # rubocop:disable Style/HashTransformValues, Style/MapToHash
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eac_rails_utils-0.25.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.24.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.23.4 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.23.3 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.23.2 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb