Sha256: 69944c4b18c8a10f85c6cb7d9c91096b191123c3f15e5aa008033b67fc52ff72

Contents?: true

Size: 739 Bytes

Versions: 1

Compression:

Stored size: 739 Bytes

Contents

# -*- encoding: utf-8 -*-

module TTY
  class Table
    module Operation

      # A class responsible for transforming table field
      class Filter

        # Initialize a Filter
        #
        # @api public
        def initialize(filter)
          @filter = filter
        end

        # Apply filer to the provided table field
        #
        # @param [TTY::Table::Field] field
        #
        # @param [Integer] row
        #   the field row index
        #
        # @param [Integer] col
        #   the field column index
        #
        # @api public
        def call(field, row, col)
          field.value = @filter.call(field.value, row, col)
        end

      end # Filter

    end # Operation
  end # Table
end # TTY

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-0.0.10 lib/tty/table/operation/filter.rb