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.13.3 app/models/effective/datatable_column.rb
effective_datatables-4.13.2 app/models/effective/datatable_column.rb
effective_datatables-4.13.1 app/models/effective/datatable_column.rb
effective_datatables-4.13.0 app/models/effective/datatable_column.rb
effective_datatables-4.12.0 app/models/effective/datatable_column.rb
effective_datatables-4.11.2 app/models/effective/datatable_column.rb
effective_datatables-4.11.1 app/models/effective/datatable_column.rb
effective_datatables-4.11.0 app/models/effective/datatable_column.rb
effective_datatables-4.10.7 app/models/effective/datatable_column.rb
effective_datatables-4.10.6 app/models/effective/datatable_column.rb
effective_datatables-4.10.5 app/models/effective/datatable_column.rb
effective_datatables-4.10.4 app/models/effective/datatable_column.rb
effective_datatables-4.10.3 app/models/effective/datatable_column.rb
effective_datatables-4.10.2 app/models/effective/datatable_column.rb
effective_datatables-4.10.1 app/models/effective/datatable_column.rb