rad_core_rails 0.8.6 → 0.8.7

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: b17f485067f34bebbd35a7fcab545dcf81273201bdeff52fdfc9bf4f730c064d
4
- data.tar.gz: 9fa40daaa31729315ae09af260478b9ee50f109a1867ff9fea46d016e5162c6e
3
+ metadata.gz: c7ca060d1ce95b64a271d3f79ea39addadbdbdef68b5bf26cf072dfb0fb7629d
4
+ data.tar.gz: 372188898723e4937380ada34fed23b6b77c082ec15850adb95ee3d58ec5cc01
5
5
  SHA512:
6
- metadata.gz: b0f1f03e5b71cf858a9517a9b9e2b7d51187cba5dcd04119683103ca3218f8a90a60c92a82350b261e968d817d61a1539500a3a792166140585c602378fb9005
7
- data.tar.gz: dd746c29acad9bb3ea5c4443cc9d7567773a3999f7173b9bd5eaed0b49323f1aab85ff3ab4d58db4122300180abeadd7101c89384a9f64bd9a756c86b144e4f1
6
+ metadata.gz: 8544212d17b05eb6519cd04855bf90b2355a7368fd5a43c65b2a9d690a307bcbe3bf5cb8f066f48536a61dda107283cc4d0d0a2f0d157d1d0a8003f0f5d60ad3
7
+ data.tar.gz: 48cf45ef1b71c6cc0e0509715568d997f5442661f32c152f2830ad6ba375976d965714668c1d1d9d10ddc4632968eadcb35b3e00fb954280860200e9b04ab7cb
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.4.5
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.4.5
6
6
  - 2.7.0
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +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 sancho.ck@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 [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
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 sancho.ck@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 [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Oleksandr Poltavets
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.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Oleksandr Poltavets
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.
@@ -178,12 +178,13 @@ module RadCoreRails
178
178
  [str, args]
179
179
  end
180
180
 
181
- def generate_model_clause(column_name, filter, optional_exclusion_clause = nil)
181
+ def generate_model_clause(column_name, filter, optional_exclusion_clause = nil, optional_blank_clause = nil)
182
182
  if optional_exclusion_clause.present? && filter[:option] == '!='
183
183
  str = optional_exclusion_clause
184
184
  args = [filter[:values]]
185
185
  elsif filter[:option] == '!!'
186
- str = "(#{column_name} IS NULL)"
186
+ optional_blank_clause ||= "(#{column_name} IS NULL)"
187
+ str = optional_blank_clause
187
188
  args = []
188
189
  else
189
190
  # probably should fix this.
@@ -284,8 +285,13 @@ module RadCoreRails
284
285
  end
285
286
 
286
287
  def generate_zip_codes_clause(column_name, filter)
287
- str = "(#{column_name} = ANY(#{zip_code_class.distance_query}))"
288
- args = zip_code_class.distance_args(filter)
288
+ if filter[:option] != '!!'
289
+ str = "(#{column_name} = ANY(#{zip_code_class.distance_query}))"
290
+ args = zip_code_class.distance_args(filter)
291
+ elsif filter[:option] == '!!'
292
+ str = "(#{column_name} IS NULL OR #{column_name} = '')"
293
+ args = []
294
+ end
289
295
 
290
296
  [str, args]
291
297
  end
@@ -1,31 +1,31 @@
1
- module RadCoreRails
2
- module SearchTerms
3
- extend ActiveSupport::Concern
4
-
5
- class_methods do
6
- def _terms(column, search = '')
7
- if search.present?
8
- if column.is_a?(Array)
9
- terms = []
10
- search.split(' ').each do |term|
11
- columns = []
12
- column.each do |col|
13
- columns.push("(replace(lower(#{Arel.sql(col)}), ' ', '') ILIKE '%#{Arel.sql(term.downcase)}%')")
14
- end
15
- terms.push '(' + columns.join(' OR ') + ')'
16
- end
17
- '(' + terms.join(' AND ') + ')'
18
- else
19
- terms = []
20
- search.split(' ').each do |term|
21
- terms.push("(replace(lower(#{Arel.sql(column)}), ' ', '') ILIKE '%#{Arel.sql(term.downcase)}%')")
22
- end
23
- '(' + terms.join(' AND ') + ')'
24
- end
25
- else
26
- '1 = 1'
27
- end
28
- end
29
- end
30
- end
1
+ module RadCoreRails
2
+ module SearchTerms
3
+ extend ActiveSupport::Concern
4
+
5
+ class_methods do
6
+ def _terms(column, search = '')
7
+ if search.present?
8
+ if column.is_a?(Array)
9
+ terms = []
10
+ search.split(' ').each do |term|
11
+ columns = []
12
+ column.each do |col|
13
+ columns.push("(replace(lower(#{Arel.sql(col)}), ' ', '') ILIKE '%#{Arel.sql(term.downcase)}%')")
14
+ end
15
+ terms.push '(' + columns.join(' OR ') + ')'
16
+ end
17
+ '(' + terms.join(' AND ') + ')'
18
+ else
19
+ terms = []
20
+ search.split(' ').each do |term|
21
+ terms.push("(replace(lower(#{Arel.sql(column)}), ' ', '') ILIKE '%#{Arel.sql(term.downcase)}%')")
22
+ end
23
+ '(' + terms.join(' AND ') + ')'
24
+ end
25
+ else
26
+ '1 = 1'
27
+ end
28
+ end
29
+ end
30
+ end
31
31
  end
@@ -1,14 +1,14 @@
1
- # frozen_string_literal: true
2
- module RadCoreRails
3
- module Sortable
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- scope :sort_order, ->(column, direction) { order(self.sort_column(column, direction)) }
8
-
9
- def self.sort_column(column, direction)
10
- "#{Arel.sql(column)} #{sort_direction(direction)}"
11
- end
12
- end
13
- end
14
- end
1
+ # frozen_string_literal: true
2
+ module RadCoreRails
3
+ module Sortable
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ scope :sort_order, ->(column, direction) { order(self.sort_column(column, direction)) }
8
+
9
+ def self.sort_column(column, direction)
10
+ "#{Arel.sql(column)} #{sort_direction(direction)}"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RadCoreRails
4
- VERSION = '0.8.6'
4
+ VERSION = '0.8.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rad_core_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksandr Poltavets, James Marrs
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-07 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -89,7 +89,7 @@ metadata:
89
89
  homepage_uri: https://github.com/jamesmarrs/rad-core-rails
90
90
  source_code_uri: https://rubygems.org/gems/rad_core_rails
91
91
  changelog_uri: https://rubygems.org/gems/rad_core_rails
92
- post_install_message:
92
+ post_install_message:
93
93
  rdoc_options: []
94
94
  require_paths:
95
95
  - lib
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubygems_version: 3.1.2
108
- signing_key:
108
+ signing_key:
109
109
  specification_version: 4
110
110
  summary: RadCoreRails
111
111
  test_files: []