Class: ActiveMocker::ActiveRecord::Field Private

Inherits:
Object
  • Object
show all
Defined in:
lib/active_mocker/active_record/field.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, options) ⇒ Field

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Field.



8
9
10
11
12
13
# File 'lib/active_mocker/active_record/field.rb', line 8

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

Instance Attribute Details

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/active_mocker/active_record/field.rb', line 6

def name
  @name
end

#optionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/active_mocker/active_record/field.rb', line 6

def options
  @options
end

#typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/active_mocker/active_record/field.rb', line 6

def type
  @type
end

Instance Method Details

#defaultObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/active_mocker/active_record/field.rb', line 25

def default
  options[:default]
end

#precisionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/active_mocker/active_record/field.rb', line 29

def precision
  options[:precision]
end

#primary_keyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
# File 'lib/active_mocker/active_record/field.rb', line 15

def primary_key
  @primary_key
end

#scaleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'lib/active_mocker/active_record/field.rb', line 33

def scale
  options[:scale]
end

#to_hObject Also known as: to_hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/active_mocker/active_record/field.rb', line 19

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