Sha256: ad87e24e45c66c9141cb046d42041500b52d2aca7259daa815403b71729284ab

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module ActiveList
  module Definition
    class AbstractColumn
      attr_reader :table, :name, :id, :options

      def initialize(table, name, options = {})
        @table   = table
        @name    = name.to_sym
        @options = options
        @hidden  = !!@options.delete(:hidden)
        @id = 'c' + @table.new_column_id # ActiveList.new_uid
      end

      def header_code
        fail NotImplementedError, "#{self.class.name}#header_code is not implemented."
      end

      def hidden?
        @hidden
      end

      def sortable?
        false
      end

      def exportable?
        false
      end

      def computable?
        false
      end

      # Unique identifier of the column in the application
      def unique_id
        "#{@table.name}-#{@name}"
      end

      # Uncommon but simple identifier for CSS class uses
      def short_id
        @id
      end

      alias_method :sort_id, :name

      def check_options!(options, *keys)
        for key in options.keys
          fail ArgumentError, "Key :#{key} is unexpected. (Expecting: #{keys.to_sentence})"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_list-6.7.3 lib/active_list/definition/abstract_column.rb
active_list-6.7.2 lib/active_list/definition/abstract_column.rb
active_list-6.7.1 lib/active_list/definition/abstract_column.rb
active_list-6.7.0 lib/active_list/definition/abstract_column.rb