anonymous_active_record 1.0.3 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0c82662e8af866d1743315b3a68a9b76fc6658b2a22ed48642b307c204ad067
4
- data.tar.gz: 74a221bcf95cb888be5729aef71838919835fb2b20bef8caa0338ab619484542
3
+ metadata.gz: 122443ea21e04dc844dfc547f12dacc18fa889ebf91b988b580f5c32cd63f547
4
+ data.tar.gz: 9948435b6b32dd03ad00ff89c1f0740da2ae5f74ebd3b87a2851e48f94ee59d8
5
5
  SHA512:
6
- metadata.gz: 6737111961bdc7ec78a05bf51cc7c16f7a6f08569a3f96d4f64bc993f9b80cdf1f57c84fa4736ed06b750b92e9b97176ae12a4800dd287d6b19013a1ec0505f1
7
- data.tar.gz: 2cb6992f6a210d06d13e5fd4c4a8dacd79a8c3e38b5c1dff04ccb014f3b9c2c07375217417ad743df8c0b65f5cb0f6a888ee65c900d3a3cf9ed8457a8029f832
6
+ metadata.gz: fd9b89d81ed386ee4e5b988d127bd266bcd546d3c1f5f242da5f2ea4af14be5a5dc307125a87859ee7066033db0c804d4d76f44871f9819167ff2d8eb688e414
7
+ data.tar.gz: 53f79696142eb5df7bb52470a651caafe1c98170ffe849f324861b17601eeb564ef7764488af91bb430222c9b3579779158564eeb0835a20017b3f7024f6790b
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,133 @@
1
+
1
2
  # Contributor Covenant Code of Conduct
2
3
 
3
4
  ## Our Pledge
4
5
 
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
11
15
 
12
16
  ## Our Standards
13
17
 
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
16
20
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
22
28
 
23
- Examples of unacceptable behavior by participants include:
29
+ Examples of unacceptable behavior include:
24
30
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
28
34
  * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
31
37
  * Other conduct which could reasonably be considered inappropriate in a
32
38
  professional setting
33
39
 
34
- ## Our Responsibilities
40
+ ## Enforcement Responsibilities
35
41
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
39
46
 
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
45
51
 
46
52
  ## Scope
47
53
 
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
54
59
 
55
60
  ## Enforcement
56
61
 
57
62
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at peter.boling@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
63
85
 
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
67
115
 
68
116
  ## Attribution
69
117
 
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
127
+ at [https://www.contributor-covenant.org/translations][translations].
72
128
 
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
data/README.md CHANGED
@@ -11,14 +11,14 @@ Warning: Use of this gem is a **security risk**, due to the use of Ruby's `eval`
11
11
  | download rank | [![Downloads Today](https://img.shields.io/gem/rd/anonymous_active_record.svg)](https://github.com/pboling/anonymous_active_record) |
12
12
  | version | [![Version](https://img.shields.io/gem/v/anonymous_active_record.svg)](https://rubygems.org/gems/anonymous_active_record) |
13
13
  | dependencies | [![Depfu](https://badges.depfu.com/badges/272ce0df3bc6df5cbea9354e2c3b65af/count.svg)](https://depfu.com/github/pboling/anonymous_active_record?project_id=5614) |
14
- | continuous integration | [![Build Status](https://travis-ci.org/pboling/anonymous_active_record.svg?branch=master)](https://travis-ci.org/pboling/anonymous_active_record) |
14
+ | continuous integration | [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpboling%2Fanonymous_active_record%2Fbadge&style=flat)](https://actions-badge.atrox.dev/pboling/anonymous_active_record/goto) |
15
15
  | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/test_coverage)](https://codeclimate.com/github/pboling/anonymous_active_record/test_coverage) |
16
16
  | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/maintainability)](https://codeclimate.com/github/pboling/anonymous_active_record/maintainability) |
17
17
  | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/anonymous_active_record/badges/users.svg)](https://www.codetriage.com/pboling/anonymous_active_record) |
18
18
  | FOSSA Licenses | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record?ref=badge_shield) |
19
19
  | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
20
20
  | documentation | [on RDoc.info][documentation] |
21
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌍 🌎 🌏](https://about.me/peter.boling), [🍚](https://www.crowdrise.com/helprefugeeswithhopefortomorrowliberia/fundraiser/peterboling), [➕](https://plus.google.com/+PeterBoling/posts), [👼](https://angel.co/peter-boling), [🐛](https://www.topcoder.com/members/pboling/), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo) |
21
+ | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo), [🌹](https://nationalprogressiveparty.org) |
22
22
 
23
23
  ## Installation
24
24
 
@@ -36,6 +36,11 @@ Or install it yourself as:
36
36
 
37
37
  $ gem install anonymous_active_record
38
38
 
39
+ ## Compatibility
40
+
41
+ This gem is compatible with, as of Feb 2021:
42
+ • Ruby 2.4, 2.5, 2.6, 2.7, 3.0, ruby-head
43
+
39
44
  ## Usage
40
45
 
41
46
  Require the library in your `spec_helper` or other test suite boot file.
@@ -49,7 +54,7 @@ Let's say you want to write specs for a module, `HasBalloon`, which provides a m
49
54
  ```ruby
50
55
  module HasBalloon
51
56
  def has_balloon?
52
- name == 'Spot' ? true : false # only Spot has a balloon
57
+ name == 'Spot' # only Spot has a balloon
53
58
  end
54
59
  end
55
60
  ```
@@ -57,61 +62,62 @@ end
57
62
  This won't work [(really!)](https://github.com/rails/rails/issues/8934):
58
63
 
59
64
  ```ruby
60
- let(:ar_with_balloon) do
61
- Class.new(ActiveRecord::Base) do
62
- attr_accessor :name
63
- include HasBalloon
64
- def flowery_name
65
- "#{b_f}#{name}#{b_f}"
66
- end
67
- def b_f
68
- has_balloon? ? '🎈' : '🌸'
69
- end
65
+ let(:ar_with_balloon) do
66
+ Class.new(ActiveRecord::Base) do
67
+ attr_accessor :name
68
+
69
+ include HasBalloon
70
+ def flowery_name
71
+ "#{b_f}#{name}#{b_f}"
72
+ end
73
+ def b_f
74
+ has_balloon? ? '🎈' : '🌸'
70
75
  end
71
76
  end
77
+ end
72
78
  ```
73
79
 
74
80
  So do this instead:
75
81
 
76
82
  ```ruby
77
- let(:ar_with_balloon) do
78
- AnonymousActiveRecord.generate(columns: ['name']) do
79
- include HasBalloon
80
- def flowery_name
81
- "#{b_f}#{name}#{b_f}"
82
- end
83
- def b_f
84
- has_balloon? ? '🎈' : '🌸'
85
- end
83
+ let(:ar_with_balloon) do
84
+ AnonymousActiveRecord.generate(columns: ['name']) do
85
+ include HasBalloon
86
+ def flowery_name
87
+ "#{b_f}#{name}#{b_f}"
88
+ end
89
+ def b_f
90
+ has_balloon? ? '🎈' : '🌸'
86
91
  end
87
92
  end
88
- it 'can test the module' do
89
- expect(ar_with_balloon.new(name: 'Spot').flowery_name).to eq('🎈Spot🎈')
90
- expect(ar_with_balloon.new(name: 'Not Spot').flowery_name).to eq('🌸Not Spot🌸')
91
- end
93
+ end
94
+ it 'can test the module' do
95
+ expect(ar_with_balloon.new(name: 'Spot').flowery_name).to eq('🎈Spot🎈')
96
+ expect(ar_with_balloon.new(name: 'Not Spot').flowery_name).to eq('🌸Not Spot🌸')
97
+ end
92
98
  ```
93
99
 
94
100
  ### Generate Options
95
101
 
96
102
  ```ruby
97
103
  AnonymousActiveRecord.generate(
98
- table_name: 'a_table_name',
99
- # if table_name is not set klass_basename will be used to derive a unique random table_name
100
- # default is a unique random table name
101
- klass_basename: 'anons', # is default
102
- columns: ['name'],
103
- # columns default is [],
104
- # meaning class will have ['id', 'created_at', 'updated_at'], as the AR defaults
105
- # Optionally provide an array of hashes and thereby designate column type:
106
- # [{name: 'name', type: 'string'}, {name: 'baked_at', type: 'time'}]
107
- timestamps: true, # is default
108
- indexes: [{columns: ['name'], unique: true}],
109
- # indexes default is [],
110
- # meaning class will have no indexes, as the AR defaults
111
- # Optionally provide an array of hashes of index options (similar to those used in Rails migrations):
112
- # [{columns: ['name'], unique: true}, {columns: ['baked_at']}]
113
- connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' } # is default
114
- ) do
104
+ table_name: 'a_table_name',
105
+ # if table_name is not set klass_basename will be used to derive a unique random table_name
106
+ # default is a unique random table name
107
+ klass_basename: 'anons', # is default
108
+ columns: ['name'],
109
+ # columns default is [],
110
+ # meaning class will have ['id', 'created_at', 'updated_at'], as the AR defaults
111
+ # Optionally provide an array of hashes and thereby designate column type:
112
+ # [{name: 'name', type: 'string'}, {name: 'baked_at', type: 'time'}]
113
+ timestamps: true, # is default
114
+ indexes: [{ columns: ['name'], unique: true }],
115
+ # indexes default is [],
116
+ # meaning class will have no indexes, as the AR defaults
117
+ # Optionally provide an array of hashes of index options (similar to those used in Rails migrations):
118
+ # [{columns: ['name'], unique: true}, {columns: ['baked_at']}]
119
+ connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' } # is default
120
+ ) do
115
121
  # code which becomes part of the class definition
116
122
  end
117
123
  ```
@@ -122,10 +128,10 @@ The block is optional.
122
128
 
123
129
  ```ruby
124
130
  AnonymousActiveRecord.factory(
125
- source_data: [{name: 'Phil'}, {name: 'Vickie'}],
131
+ source_data: [{ name: 'Phil' }, { name: 'Vickie' }]
126
132
  # Array of hashes, where each hash represents a record that will be created
127
133
  # ... The rest of the options are the same as for generate, see above.
128
- ) do
134
+ ) do
129
135
  # same as for generate, see above.
130
136
  end
131
137
  ```
@@ -170,7 +176,7 @@ spec.add_dependency 'anonymous_active_record', '~> 0.0'
170
176
 
171
177
  * Copyright (c) 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
172
178
 
173
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
179
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
174
180
 
175
181
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record?ref=badge_large)
176
182
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record'
2
4
 
3
5
  require 'anonymous_active_record/version'
@@ -40,22 +42,31 @@ module AnonymousActiveRecord
40
42
  encoding: 'utf8',
41
43
  database: ':memory:'
42
44
  }.freeze
45
+ DEFAULT_PARENT_KLASS = 'ActiveRecord::Base'
43
46
 
44
47
  # Defines a pseudo anonymous class in a particular namespace of your choosing.
45
- def generate(table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
46
- gen = AnonymousActiveRecord::Generator.new(table_name, klass_namespaces, klass_basename)
48
+ def generate(table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: DEFAULT_PARENT_KLASS, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
49
+ gen = AnonymousActiveRecord::Generator.new(table_name, klass_namespaces, klass_basename, parent_klass)
47
50
  klass = gen.generate(&block)
48
51
  connection_params = YAML.load_file(connection_params) if connection_params.is_a?(String)
49
52
  klass.establish_connection(connection_params.dup)
50
- klass.connection.create_table gen.table_name do |t|
53
+ klass.connection.create_table(gen.table_name) do |t|
51
54
  columns.each do |col|
52
55
  if col.is_a?(Hash)
53
56
  # :name and :type are required at minimum
54
57
  name = col.delete(:name)
55
58
  type = col.delete(:type)
56
- t.column(name, type, col)
59
+ t.column(name, type, **col)
57
60
  elsif col.is_a?(Array)
58
- t.column col[0], col[-1] || :string
61
+ if col[-1].is_a?(Hash)
62
+ if col[-1].present?
63
+ t.column col[0], **col[-1]
64
+ else
65
+ t.column col[0], :string
66
+ end
67
+ else
68
+ t.column col[0], col[-1] || :string
69
+ end
59
70
  else
60
71
  t.column col, :string
61
72
  end
@@ -63,10 +74,12 @@ module AnonymousActiveRecord
63
74
  indexes.each do |idx_options|
64
75
  if idx_options.is_a?(Hash)
65
76
  column_names = idx_options.delete(:columns)
66
- t.index column_names, idx_options
77
+ t.index column_names, **idx_options
67
78
  elsif idx_options.is_a?(Array)
68
79
  if idx_options.length == 1
69
80
  t.index idx_options[0]
81
+ elsif idx_options[-1].is_a?(Hash)
82
+ t.index idx_options[0], **idx_options[-1]
70
83
  else
71
84
  t.index idx_options[0], idx_options[-1]
72
85
  end
@@ -80,21 +93,53 @@ module AnonymousActiveRecord
80
93
  end
81
94
 
82
95
  # Initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
83
- def factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
84
- factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, indexes: indexes, timestamps: timestamps, connection_params: connection_params, &block)
96
+ def factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: DEFAULT_PARENT_KLASS, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
97
+ factory = _factory(
98
+ source_data: source_data,
99
+ table_name: table_name,
100
+ klass_namespaces: klass_namespaces,
101
+ klass_basename: klass_basename,
102
+ columns: columns,
103
+ indexes: indexes,
104
+ timestamps: timestamps,
105
+ parent_klass: parent_klass,
106
+ connection_params: connection_params,
107
+ &block
108
+ )
85
109
  factory.run
86
110
  end
87
111
 
88
112
  # Initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
89
- def factory!(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
90
- factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, indexes: indexes, timestamps: timestamps, connection_params: connection_params, &block)
113
+ def factory!(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: DEFAULT_PARENT_KLASS, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
114
+ factory = _factory(
115
+ source_data: source_data,
116
+ table_name: table_name,
117
+ klass_namespaces: klass_namespaces,
118
+ klass_basename: klass_basename,
119
+ columns: columns,
120
+ indexes: indexes,
121
+ timestamps: timestamps,
122
+ parent_klass: parent_klass,
123
+ connection_params: connection_params,
124
+ &block
125
+ )
91
126
  factory.run!
92
127
  end
93
128
 
94
129
  private
95
130
 
96
- def _factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
97
- klass = generate(table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, indexes: indexes, connection_params: connection_params, &block)
131
+ def _factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: DEFAULT_PARENT_KLASS, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
132
+ klass = generate(
133
+ table_name: table_name,
134
+ klass_namespaces: klass_namespaces,
135
+ klass_basename: klass_basename,
136
+ columns: columns,
137
+ timestamps: timestamps,
138
+ parent_klass: parent_klass,
139
+ indexes: indexes,
140
+ connection_params: connection_params,
141
+ &block
142
+ )
98
143
  AnonymousActiveRecord::Factory.new(source_data, klass)
99
144
  end
100
145