Sha256: 773ba44a4b2254dd45b81cd31dce48379ccbf09400f3554e5f77b2e603eb4dc6

Contents?: true

Size: 581 Bytes

Versions: 14

Compression:

Stored size: 581 Bytes

Contents

module ActiveMocker
  module ActiveRecord
  # @api private
  class Field

    attr_accessor :name, :type, :options

    def initialize(name, type, options)
      @name    = name
      @type    = type
      @primary_key
      @options = options.first || {}
    end

    def primary_key
      @primary_key
    end

    def to_h
      {name: name, type: type, options: options}
    end

    alias_method :to_hash, :to_h

    def default
      options[:default]
    end

    def precision
      options[:precision]
    end

    def scale
      options[:scale]
    end

  end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_mocker-1.8.4 lib/active_mocker/active_record/field.rb
active_mocker-1.8.3 lib/active_mocker/active_record/field.rb
active_mocker-1.8.2 lib/active_mocker/active_record/field.rb
active_mocker-1.8.1 lib/active_mocker/active_record/field.rb
active_mocker-1.8 lib/active_mocker/active_record/field.rb
active_mocker-1.7.3 lib/active_mocker/active_record/field.rb
active_mocker-1.7.2 lib/active_mocker/active_record/field.rb
active_mocker-1.7.1 lib/active_mocker/active_record/field.rb
active_mocker-1.7.1rc lib/active_mocker/active_record/field.rb
active_mocker-1.7 lib/active_mocker/active_record/field.rb
active_mocker-1.7rc2 lib/active_mocker/active_record/field.rb
active_mocker-1.7.beta3 lib/active_mocker/active_record/field.rb
active_mocker-1.7.beta2 lib/active_mocker/active_record/field.rb
active_mocker-1.7.beta1 lib/active_mocker/active_record/field.rb