Sha256: 1cf4dabb9a20c9cf5aa40f0a71b11d0e6abc43784fe54e8373504f2d672a1166

Contents?: true

Size: 667 Bytes

Versions: 11

Compression:

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

11 entries across 11 versions & 3 rubygems

Version Path
departure-6.7.0 lib/lhm/column_with_type.rb
departure-6.6.0 lib/lhm/column_with_type.rb
departure-6.5.0 lib/lhm/column_with_type.rb
departure-6.4.0 lib/lhm/column_with_type.rb
departure-6.3.0 lib/lhm/column_with_type.rb
departure-76c9880-6.2.0 lib/lhm/column_with_type.rb
departure-6.2.0 lib/lhm/column_with_type.rb
arrival-0.1.0 lib/lhm/column_with_type.rb
departure-6.1.0 lib/lhm/column_with_type.rb
departure-6.0.0 lib/lhm/column_with_type.rb
departure-5.0.0 lib/lhm/column_with_type.rb