Sha256: f03c612f4e3858ff40dfc6a0c223ab35dff55d302dddece5e062e875834be437

Contents?: true

Size: 554 Bytes

Versions: 5

Compression:

Stored size: 554 Bytes

Contents

module ActiveMocker
  # @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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_mocker-1.6.4 lib/active_mocker/field.rb
active_mocker-1.6.3 lib/active_mocker/field.rb
active_mocker-1.6.2 lib/active_mocker/field.rb
active_mocker-1.6.1 lib/active_mocker/field.rb
active_mocker-1.6 lib/active_mocker/field.rb