active_record_seek 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +45 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +21 -0
- data/active_record_seek.gemspec +31 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gemfiles/mysql.gemfile +5 -0
- data/gemfiles/mysql.gemfile.lock +47 -0
- data/gemfiles/postgresql.gemfile +5 -0
- data/gemfiles/postgresql.gemfile.lock +47 -0
- data/gemfiles/sqlite.gemfile +7 -0
- data/gemfiles/sqlite.gemfile.lock +47 -0
- data/lib/active_record_seek.rb +29 -0
- data/lib/active_record_seek/component.rb +57 -0
- data/lib/active_record_seek/concerns/active_record_concern.rb +20 -0
- data/lib/active_record_seek/concerns/instance_variable_concern.rb +40 -0
- data/lib/active_record_seek/middleware.rb +24 -0
- data/lib/active_record_seek/operators/base_operator.rb +65 -0
- data/lib/active_record_seek/operators/ci_base_operator.rb +66 -0
- data/lib/active_record_seek/operators/ci_matches_base_operator.rb +38 -0
- data/lib/active_record_seek/operators/ci_regexp_base_operator.rb +46 -0
- data/lib/active_record_seek/operators/matches_base_operator.rb +32 -0
- data/lib/active_record_seek/operators/regexp_base_operator.rb +46 -0
- data/lib/active_record_seek/query.rb +68 -0
- data/lib/active_record_seek/scopes/association_scope.rb +98 -0
- data/lib/active_record_seek/scopes/base_scope.rb +10 -0
- data/lib/active_record_seek/scopes/seek_or_scope.rb +53 -0
- data/lib/active_record_seek/scopes/seek_scope.rb +54 -0
- data/lib/active_record_seek/version.rb +3 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0dbcf210cc9193d417f0309ac4a03121336ecbeca5c5bef7a6fe4f59105c734a
|
4
|
+
data.tar.gz: 62a414dd8f5100cb6ebbc037f1abaae9bb2100400971c5848d636b02b0fb52e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e082f81d7e9acd36beaa881324ff473f3986f936b585ad7b5f95f8f5fe62e90933b39c81361935650623f4e458f6995217bc15c6407b63424d4f3e8799f5c7c
|
7
|
+
data.tar.gz: 4d386491bd50337d74c9dd1c4ed21e9209585da512b765880fdf3d122b23fd2c959af55eafc99b125f037094164396425595a36b9f53e8968a40e3d035378e49
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.6.4
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
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.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
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
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
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
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
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.
|
39
|
+
|
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.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
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
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at griffithchaffee@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
|
+
|
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.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
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]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
active_record_seek (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (5.2.3)
|
10
|
+
activesupport (= 5.2.3)
|
11
|
+
activerecord (5.2.3)
|
12
|
+
activemodel (= 5.2.3)
|
13
|
+
activesupport (= 5.2.3)
|
14
|
+
arel (>= 9.0)
|
15
|
+
activesupport (5.2.3)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 0.7, < 2)
|
18
|
+
minitest (~> 5.1)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
arel (9.0.0)
|
21
|
+
byebug (11.1.1)
|
22
|
+
concurrent-ruby (1.1.5)
|
23
|
+
factory_bot (5.1.1)
|
24
|
+
activesupport (>= 4.2.0)
|
25
|
+
i18n (1.6.0)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
minitest (5.11.3)
|
28
|
+
rake (12.3.2)
|
29
|
+
thread_safe (0.3.6)
|
30
|
+
tzinfo (1.2.5)
|
31
|
+
thread_safe (~> 0.1)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
active_record_seek!
|
38
|
+
activerecord (~> 5)
|
39
|
+
bundler (~> 2)
|
40
|
+
byebug (~> 11)
|
41
|
+
factory_bot (~> 5)
|
42
|
+
rake (~> 12)
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Griffith Chaffee
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# ActiveRecord::Seek
|
2
|
+
|
3
|
+
## TESTS
|
4
|
+
|
5
|
+
```
|
6
|
+
rake test:mysql
|
7
|
+
rake test:postgresql
|
8
|
+
rake test:sqlite
|
9
|
+
```
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'active_record_seek'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install active_record_seek
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
TODO: Write usage instructions here
|
30
|
+
|
31
|
+
## Development
|
32
|
+
|
33
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
34
|
+
|
35
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/active_record_seek. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
40
|
+
|
41
|
+
## License
|
42
|
+
|
43
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
44
|
+
|
45
|
+
## Code of Conduct
|
46
|
+
|
47
|
+
Everyone interacting in the ActiveRecord::Seek project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/active_record_seek/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
namespace :test do
|
5
|
+
Rake::TestTask.new(:run) do |t|
|
6
|
+
t.libs << "test"
|
7
|
+
t.libs << "lib"
|
8
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
9
|
+
end
|
10
|
+
|
11
|
+
%w[ postgresql sqlite mysql ].each do |adapter_namespace|
|
12
|
+
desc "run tests with #{adapter_namespace} adapter"
|
13
|
+
task(adapter_namespace) do
|
14
|
+
ENV["BUNDLE_GEMFILE"] = "gemfiles/#{adapter_namespace}.gemfile"
|
15
|
+
Bundler.setup
|
16
|
+
Rake::Task["test:run"].invoke
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
task :default => "test:sqlite"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "active_record_seek/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
|
8
|
+
spec.name = "active_record_seek"
|
9
|
+
spec.version = ActiveRecordSeek::VERSION
|
10
|
+
spec.authors = ["Griffith Chaffee"]
|
11
|
+
spec.email = ["griffithchaffee@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Build complex ActiveRecord queries using hash syntax.}
|
14
|
+
spec.description = %q{Build complex ActiveRecord queries using hash syntax. Includes support for Arel operators, OR queries, and assocition subqueries.}
|
15
|
+
spec.homepage = "https://github.com/griffithchaffee/active_record_seek"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |file_name|
|
19
|
+
file_name.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency("bundler", "~> 2")
|
26
|
+
spec.add_development_dependency("rake", "~> 12")
|
27
|
+
spec.add_development_dependency("activerecord", "~> 5")
|
28
|
+
spec.add_development_dependency("factory_bot", "~> 5")
|
29
|
+
spec.add_development_dependency("byebug", "~> 11")
|
30
|
+
|
31
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "active_record_seek"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_record_seek (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (5.2.4.1)
|
10
|
+
activesupport (= 5.2.4.1)
|
11
|
+
activerecord (5.2.4.1)
|
12
|
+
activemodel (= 5.2.4.1)
|
13
|
+
activesupport (= 5.2.4.1)
|
14
|
+
arel (>= 9.0)
|
15
|
+
activesupport (5.2.4.1)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 0.7, < 2)
|
18
|
+
minitest (~> 5.1)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
arel (9.0.0)
|
21
|
+
byebug (11.1.1)
|
22
|
+
concurrent-ruby (1.1.6)
|
23
|
+
factory_bot (5.1.1)
|
24
|
+
activesupport (>= 4.2.0)
|
25
|
+
i18n (1.8.2)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
minitest (5.14.0)
|
28
|
+
mysql2 (0.5.3)
|
29
|
+
rake (12.3.2)
|
30
|
+
thread_safe (0.3.6)
|
31
|
+
tzinfo (1.2.6)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
active_record_seek!
|
39
|
+
activerecord (~> 5)
|
40
|
+
bundler (~> 2)
|
41
|
+
byebug (~> 11)
|
42
|
+
factory_bot (~> 5)
|
43
|
+
mysql2
|
44
|
+
rake (~> 12)
|
45
|
+
|
46
|
+
BUNDLED WITH
|
47
|
+
2.0.2
|
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_record_seek (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (5.2.4.1)
|
10
|
+
activesupport (= 5.2.4.1)
|
11
|
+
activerecord (5.2.4.1)
|
12
|
+
activemodel (= 5.2.4.1)
|
13
|
+
activesupport (= 5.2.4.1)
|
14
|
+
arel (>= 9.0)
|
15
|
+
activesupport (5.2.4.1)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 0.7, < 2)
|
18
|
+
minitest (~> 5.1)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
arel (9.0.0)
|
21
|
+
byebug (11.1.1)
|
22
|
+
concurrent-ruby (1.1.6)
|
23
|
+
factory_bot (5.1.1)
|
24
|
+
activesupport (>= 4.2.0)
|
25
|
+
i18n (1.8.2)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
minitest (5.14.0)
|
28
|
+
pg (1.2.2)
|
29
|
+
rake (12.3.2)
|
30
|
+
thread_safe (0.3.6)
|
31
|
+
tzinfo (1.2.6)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
active_record_seek!
|
39
|
+
activerecord (~> 5)
|
40
|
+
bundler (~> 2)
|
41
|
+
byebug (~> 11)
|
42
|
+
factory_bot (~> 5)
|
43
|
+
pg
|
44
|
+
rake (~> 12)
|
45
|
+
|
46
|
+
BUNDLED WITH
|
47
|
+
2.0.2
|
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_record_seek (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (5.2.4.1)
|
10
|
+
activesupport (= 5.2.4.1)
|
11
|
+
activerecord (5.2.4.1)
|
12
|
+
activemodel (= 5.2.4.1)
|
13
|
+
activesupport (= 5.2.4.1)
|
14
|
+
arel (>= 9.0)
|
15
|
+
activesupport (5.2.4.1)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 0.7, < 2)
|
18
|
+
minitest (~> 5.1)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
arel (9.0.0)
|
21
|
+
byebug (11.1.1)
|
22
|
+
concurrent-ruby (1.1.6)
|
23
|
+
factory_bot (5.1.1)
|
24
|
+
activesupport (>= 4.2.0)
|
25
|
+
i18n (1.8.2)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
minitest (5.14.0)
|
28
|
+
rake (12.3.2)
|
29
|
+
sqlite3 (1.4.1)
|
30
|
+
thread_safe (0.3.6)
|
31
|
+
tzinfo (1.2.6)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
active_record_seek!
|
39
|
+
activerecord (~> 5)
|
40
|
+
bundler (~> 2)
|
41
|
+
byebug (~> 11)
|
42
|
+
factory_bot (~> 5)
|
43
|
+
rake (~> 12)
|
44
|
+
sqlite3
|
45
|
+
|
46
|
+
BUNDLED WITH
|
47
|
+
2.0.2
|