Class: ActiveMocker::Field
- Inherits:
-
Object
- Object
- ActiveMocker::Field
- Defined in:
- lib/active_mocker/field.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #default ⇒ Object
-
#initialize(name, type, options) ⇒ Field
constructor
A new instance of Field.
- #precision ⇒ Object
- #primary_key ⇒ Object
- #scale ⇒ Object
- #to_h ⇒ Object (also: #to_hash)
Constructor Details
#initialize(name, type, options) ⇒ Field
Returns a new instance of Field.
7 8 9 10 11 12 |
# File 'lib/active_mocker/field.rb', line 7 def initialize(name, type, ) @name = name @type = type @primary_key = .first || {} end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/active_mocker/field.rb', line 5 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/active_mocker/field.rb', line 5 def end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/active_mocker/field.rb', line 5 def type @type end |
Instance Method Details
#default ⇒ Object
24 25 26 |
# File 'lib/active_mocker/field.rb', line 24 def default [:default] end |
#precision ⇒ Object
28 29 30 |
# File 'lib/active_mocker/field.rb', line 28 def precision [:precision] end |
#primary_key ⇒ Object
14 15 16 |
# File 'lib/active_mocker/field.rb', line 14 def primary_key @primary_key end |
#scale ⇒ Object
32 33 34 |
# File 'lib/active_mocker/field.rb', line 32 def scale [:scale] end |
#to_h ⇒ Object Also known as: to_hash
18 19 20 |
# File 'lib/active_mocker/field.rb', line 18 def to_h {name: name, type: type, options: } end |