Sha256: 10a2b0d98e24005c65da11c8aabad35dafc4f8e4e7593ebfcf4e5e16356c1c85

Contents?: true

Size: 669 Bytes

Versions: 19

Compression:

Stored size: 669 Bytes

Contents

module Lhm

  # Abstracts the details of a table column definition when specified with a type
  # as a symbol. This is the regular ActiveRecord's #add_column syntax:
  #
  #   add_column :tablenames, :field, :string
  #
  class ColumnWithType

    # Constructor
    #
    # @param name [String, Symbol]
    # @param definition [Symbol]
    def initialize(name, definition)
      @name = name
      @definition = definition
    end

    # Returns the column data as an Array to be used with the splat operator.
    # See Lhm::Adaper#add_column
    #
    # @return [Array]
    def attributes
      [definition]
    end

    private

    attr_reader :definition
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
departure-4.0.1 lib/lhm/column_with_type.rb
departure-4.0.0 lib/lhm/column_with_type.rb
departure-2.0.1 lib/lhm/column_with_type.rb
departure-3.0.1 lib/lhm/column_with_type.rb
departure-3.0.0 lib/lhm/column_with_type.rb
departure-2.0.0 lib/lhm/column_with_type.rb
departure-1.0.1 lib/lhm/column_with_type.rb
departure-1.0.0 lib/lhm/column_with_type.rb
percona_migrator-3.0.0 lib/lhm/column_with_type.rb
percona_migrator-1.1.0 lib/lhm/column_with_type.rb
percona_migrator-0.1.1 lib/lhm/column_with_type.rb
percona_migrator-1.0.0 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.7 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.6 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.5 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.4 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.3 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.2 lib/lhm/column_with_type.rb
percona_migrator-0.1.0.rc.1 lib/lhm/column_with_type.rb