Sha256: 5c89f6ea65a4724fe373c40f2e04bb92b50695ba93f8eeb188ac9ff961d856d1

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 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

      # 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

3 entries across 3 versions & 1 rubygems

Version Path
active_list-6.6.2 lib/active_list/definition/abstract_column.rb
active_list-6.6.1 lib/active_list/definition/abstract_column.rb
active_list-6.6.0 lib/active_list/definition/abstract_column.rb