Sha256: dcfc07a0d9540768d1585d5b2b4f129a1bd22c394ed15b9fe27b331deac3996d

Contents?: true

Size: 685 Bytes

Versions: 55

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

# In practice this is just a regular hash with the aggregate, format, search, sort do syntax that saves a block
module Effective
  class DatatableColumn
    attr_accessor :attributes

    delegate :[], :[]=, to: :attributes

    def initialize(attributes)
      @attributes = attributes
    end

    def to_s
      self[:name]
    end

    def aggregate(&block)
      @attributes[:aggregate] = block; self
    end

    def format(&block)
      @attributes[:format] = block; self
    end

    def search(&block)
      @attributes[:search_method] = block; self
    end

    def sort(&block)
      @attributes[:sort_method] = block; self
    end

  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
effective_datatables-4.25.3 app/models/effective/datatable_column.rb
effective_datatables-4.25.2 app/models/effective/datatable_column.rb
effective_datatables-4.25.1 app/models/effective/datatable_column.rb
effective_datatables-4.25.0 app/models/effective/datatable_column.rb
effective_datatables-4.24.2 app/models/effective/datatable_column.rb
effective_datatables-4.24.1 app/models/effective/datatable_column.rb
effective_datatables-4.24.0 app/models/effective/datatable_column.rb
effective_datatables-4.23.0 app/models/effective/datatable_column.rb
effective_datatables-4.22.3 app/models/effective/datatable_column.rb
effective_datatables-4.22.2 app/models/effective/datatable_column.rb
effective_datatables-4.22.1 app/models/effective/datatable_column.rb
effective_datatables-4.22.0 app/models/effective/datatable_column.rb
effective_datatables-4.21.1 app/models/effective/datatable_column.rb
effective_datatables-4.21.0 app/models/effective/datatable_column.rb
effective_datatables-4.20.6 app/models/effective/datatable_column.rb
effective_datatables-4.20.5 app/models/effective/datatable_column.rb
effective_datatables-4.20.4 app/models/effective/datatable_column.rb
effective_datatables-4.20.3 app/models/effective/datatable_column.rb
effective_datatables-4.20.2 app/models/effective/datatable_column.rb
effective_datatables-4.20.1 app/models/effective/datatable_column.rb