Class: ActiveMocker::ActiveRecord::Table Private
- Inherits:
-
Object
- Object
- ActiveMocker::ActiveRecord::Table
- Defined in:
- lib/active_mocker/active_record/table.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
- #fields ⇒ Object readonly private
- #name ⇒ Object readonly private
Instance Method Summary collapse
- #column_names ⇒ Object private
-
#initialize(name, id = true, fields = []) ⇒ Table
constructor
private
A new instance of Table.
- #to_h ⇒ Object (also: #to_hash) private
Constructor Details
#initialize(name, id = true, fields = []) ⇒ Table
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 Table.
8 9 10 11 12 |
# File 'lib/active_mocker/active_record/table.rb', line 8 def initialize(name, id=true, fields=[]) @name = name @fields = fields fields.unshift Field.new('id', :integer, [{primary_key: true}]) if id.nil? end |
Instance Attribute Details
#fields ⇒ Object (readonly)
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/table.rb', line 6 def fields @fields end |
#name ⇒ Object (readonly)
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/table.rb', line 6 def name @name end |
Instance Method Details
#column_names ⇒ Object
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.
20 21 22 |
# File 'lib/active_mocker/active_record/table.rb', line 20 def column_names fields.map { |f| f.name } end |
#to_h ⇒ Object 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.
14 15 16 |
# File 'lib/active_mocker/active_record/table.rb', line 14 def to_h {name: name, fields: fields.to_h} end |