search_in_model 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5a7fd3db0c8a86657cca35889f808249bac55202
4
+ data.tar.gz: 605d11035624412ba392c9aa24e468fa20a95fbd
5
+ SHA512:
6
+ metadata.gz: 0e0e36085f97fdcacee74d7837e5ce0c82cc9db5574792900770a25505efb40ae7b8bb8a9072557fa5b804af8735d2b994202caf883d9edef1dfcabfc796e15b
7
+ data.tar.gz: cab4faf7718cae0e5653500db4443c973ab213993b05f14b30d2d0c1aa539c11c55f7dabbaa0841818ec07d02f89281ae53024b35187bbf82d007bc54442782f
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
@@ -0,0 +1,243 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="f383c8a9-6d79-4f76-b044-40e1888771e2" name="Default" comment="">
5
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/search_in_model/version.rb" afterPath="$PROJECT_DIR$/lib/search_in_model/version.rb" />
6
+ </list>
7
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
8
+ <option name="TRACKING_ENABLED" value="true" />
9
+ <option name="SHOW_DIALOG" value="false" />
10
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
11
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
12
+ <option name="LAST_RESOLUTION" value="IGNORE" />
13
+ </component>
14
+ <component name="FileEditorManager">
15
+ <leaf>
16
+ <file leaf-file-name="search_in_model.rb" pinned="false" current-in-tab="false">
17
+ <entry file="file://$PROJECT_DIR$/lib/search_in_model.rb">
18
+ <provider selected="true" editor-type-id="text-editor">
19
+ <state relative-caret-position="36">
20
+ <caret line="2" column="20" lean-forward="false" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="20" />
21
+ <folding />
22
+ </state>
23
+ </provider>
24
+ </entry>
25
+ </file>
26
+ <file leaf-file-name="README.md" pinned="false" current-in-tab="false">
27
+ <entry file="file://$PROJECT_DIR$/README.md">
28
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
29
+ <state split_layout="SPLIT">
30
+ <first_editor relative-caret-position="180">
31
+ <caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
32
+ <folding>
33
+ <marker date="1506245441117" expanded="true" signature="585:818" ph=" ... end" />
34
+ <marker date="1506245441117" expanded="true" signature="644:668" ph="{ ... }" />
35
+ <marker date="1506245441117" expanded="true" signature="707:741" ph="{ ... }" />
36
+ <marker date="1506245441117" expanded="true" signature="776:811" ph="{ ... }" />
37
+ <marker date="1506245441117" expanded="true" signature="881:962" ph=" ... end" />
38
+ </folding>
39
+ </first_editor>
40
+ <second_editor />
41
+ </state>
42
+ </provider>
43
+ </entry>
44
+ </file>
45
+ <file leaf-file-name="search_in_model.gemspec" pinned="false" current-in-tab="false">
46
+ <entry file="file://$PROJECT_DIR$/search_in_model.gemspec">
47
+ <provider selected="true" editor-type-id="text-editor">
48
+ <state relative-caret-position="68">
49
+ <caret line="9" column="42" lean-forward="false" selection-start-line="9" selection-start-column="42" selection-end-line="9" selection-end-column="42" />
50
+ <folding />
51
+ </state>
52
+ </provider>
53
+ </entry>
54
+ </file>
55
+ <file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
56
+ <entry file="file://$PROJECT_DIR$/lib/search_in_model/version.rb">
57
+ <provider selected="true" editor-type-id="text-editor">
58
+ <state relative-caret-position="18">
59
+ <caret line="1" column="14" lean-forward="false" selection-start-line="1" selection-start-column="14" selection-end-line="1" selection-end-column="14" />
60
+ <folding />
61
+ </state>
62
+ </provider>
63
+ </entry>
64
+ </file>
65
+ </leaf>
66
+ </component>
67
+ <component name="Git.Settings">
68
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
69
+ </component>
70
+ <component name="IdeDocumentHistory">
71
+ <option name="CHANGED_PATHS">
72
+ <list>
73
+ <option value="$PROJECT_DIR$/lib/search_in_model.rb" />
74
+ <option value="$PROJECT_DIR$/README.md" />
75
+ <option value="$PROJECT_DIR$/search_in_model.gemspec" />
76
+ <option value="$PROJECT_DIR$/lib/search_in_model/version.rb" />
77
+ </list>
78
+ </option>
79
+ </component>
80
+ <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
81
+ <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
82
+ <component name="JsGulpfileManager">
83
+ <detection-done>true</detection-done>
84
+ <sorting>DEFINITION_ORDER</sorting>
85
+ </component>
86
+ <component name="ProjectFrameBounds" extendedState="6">
87
+ <option name="x" value="170" />
88
+ <option name="y" value="57" />
89
+ <option name="width" value="1189" />
90
+ <option name="height" value="618" />
91
+ </component>
92
+ <component name="ProjectView">
93
+ <navigator currentView="ProjectPane" proportions="" version="1">
94
+ <flattenPackages />
95
+ <showMembers />
96
+ <showModules />
97
+ <showLibraryContents />
98
+ <hideEmptyPackages />
99
+ <abbreviatePackageNames />
100
+ <autoscrollToSource />
101
+ <autoscrollFromSource />
102
+ <sortByType />
103
+ <manualOrder />
104
+ <foldersAlwaysOnTop value="true" />
105
+ </navigator>
106
+ <panes>
107
+ <pane id="Scratches" />
108
+ <pane id="ProjectPane">
109
+ <subPane>
110
+ <expand>
111
+ <path>
112
+ <item name="search_in_model" type="b2602c69:ProjectViewProjectNode" />
113
+ <item name="search_in_model" type="462c0819:PsiDirectoryNode" />
114
+ </path>
115
+ <path>
116
+ <item name="search_in_model" type="b2602c69:ProjectViewProjectNode" />
117
+ <item name="search_in_model" type="462c0819:PsiDirectoryNode" />
118
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
119
+ </path>
120
+ <path>
121
+ <item name="search_in_model" type="b2602c69:ProjectViewProjectNode" />
122
+ <item name="search_in_model" type="462c0819:PsiDirectoryNode" />
123
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
124
+ <item name="search_in_model" type="462c0819:PsiDirectoryNode" />
125
+ </path>
126
+ </expand>
127
+ <select />
128
+ </subPane>
129
+ </pane>
130
+ <pane id="Scope" />
131
+ </panes>
132
+ </component>
133
+ <component name="PropertiesComponent">
134
+ <property name="WebServerToolWindowFactoryState" value="false" />
135
+ </component>
136
+ <component name="RunDashboard">
137
+ <option name="ruleStates">
138
+ <list>
139
+ <RuleState>
140
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
141
+ </RuleState>
142
+ <RuleState>
143
+ <option name="name" value="StatusDashboardGroupingRule" />
144
+ </RuleState>
145
+ </list>
146
+ </option>
147
+ </component>
148
+ <component name="ShelveChangesManager" show_recycled="false">
149
+ <option name="remove_strategy" value="false" />
150
+ </component>
151
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
152
+ <component name="TaskManager">
153
+ <task active="true" id="Default" summary="Default task">
154
+ <changelist id="f383c8a9-6d79-4f76-b044-40e1888771e2" name="Default" comment="" />
155
+ <created>1506245336624</created>
156
+ <option name="number" value="Default" />
157
+ <option name="presentableId" value="Default" />
158
+ <updated>1506245336624</updated>
159
+ <workItem from="1506245338100" duration="426000" />
160
+ </task>
161
+ <servers />
162
+ </component>
163
+ <component name="TimeTrackingManager">
164
+ <option name="totallyTimeSpent" value="426000" />
165
+ </component>
166
+ <component name="ToolWindowManager">
167
+ <frame x="-1" y="-11" width="1368" height="780" extended-state="6" />
168
+ <editor active="true" />
169
+ <layout>
170
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24963397" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
171
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
172
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32882884" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
173
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
174
+ <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
175
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
176
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
177
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
178
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
179
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
180
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
181
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
182
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
183
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
184
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
185
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
186
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
187
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
188
+ </layout>
189
+ </component>
190
+ <component name="TypeScriptGeneratedFilesManager">
191
+ <option name="version" value="1" />
192
+ </component>
193
+ <component name="VcsContentAnnotationSettings">
194
+ <option name="myLimit" value="2678400000" />
195
+ </component>
196
+ <component name="XDebuggerManager">
197
+ <breakpoint-manager />
198
+ <watches-manager />
199
+ </component>
200
+ <component name="editorHistoryManager">
201
+ <entry file="file://$PROJECT_DIR$/README.md">
202
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
203
+ <state split_layout="SPLIT">
204
+ <first_editor relative-caret-position="180">
205
+ <caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
206
+ <folding>
207
+ <marker date="1506245441117" expanded="true" signature="585:818" ph=" ... end" />
208
+ <marker date="1506245441117" expanded="true" signature="644:668" ph="{ ... }" />
209
+ <marker date="1506245441117" expanded="true" signature="707:741" ph="{ ... }" />
210
+ <marker date="1506245441117" expanded="true" signature="776:811" ph="{ ... }" />
211
+ <marker date="1506245441117" expanded="true" signature="881:962" ph=" ... end" />
212
+ </folding>
213
+ </first_editor>
214
+ <second_editor />
215
+ </state>
216
+ </provider>
217
+ </entry>
218
+ <entry file="file://$PROJECT_DIR$/lib/search_in_model.rb">
219
+ <provider selected="true" editor-type-id="text-editor">
220
+ <state relative-caret-position="36">
221
+ <caret line="2" column="20" lean-forward="false" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="20" />
222
+ <folding />
223
+ </state>
224
+ </provider>
225
+ </entry>
226
+ <entry file="file://$PROJECT_DIR$/search_in_model.gemspec">
227
+ <provider selected="true" editor-type-id="text-editor">
228
+ <state relative-caret-position="68">
229
+ <caret line="9" column="42" lean-forward="false" selection-start-line="9" selection-start-column="42" selection-end-line="9" selection-end-column="42" />
230
+ <folding />
231
+ </state>
232
+ </provider>
233
+ </entry>
234
+ <entry file="file://$PROJECT_DIR$/lib/search_in_model/version.rb">
235
+ <provider selected="true" editor-type-id="text-editor">
236
+ <state relative-caret-position="18">
237
+ <caret line="1" column="14" lean-forward="false" selection-start-line="1" selection-start-column="14" selection-end-line="1" selection-end-column="14" />
238
+ <folding />
239
+ </state>
240
+ </provider>
241
+ </entry>
242
+ </component>
243
+ </project>
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.15.4
@@ -0,0 +1,75 @@
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 hany.s@nabdacare.com
59
+ . All
60
+ complaints will be reviewed and investigated and will result in a response that
61
+ is deemed necessary and appropriate to the circumstances. The project team is
62
+ obligated to maintain confidentiality with regard to the reporter of an incident.
63
+ Further details of specific enforcement policies may be posted separately.
64
+
65
+ Project maintainers who do not follow or enforce the Code of Conduct in good
66
+ faith may face temporary or permanent repercussions as determined by other
67
+ members of the project's leadership.
68
+
69
+ ## Attribution
70
+
71
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
72
+ available at [http://contributor-covenant.org/version/1/4][version]
73
+
74
+ [homepage]: http://contributor-covenant.org
75
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in search_in_model.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 hany
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.
@@ -0,0 +1,61 @@
1
+ # SearchInModel
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/search_in_model`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'search_in_model'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install search_in_model
22
+
23
+ ## Usage
24
+ ```ruby
25
+ app/models/product.rb
26
+
27
+ class Product
28
+ include SearchInModel
29
+
30
+ scope :status, -> (status) { where status: status }
31
+ scope :location, -> (location_id) { where location_id: location_id }
32
+ scope :starts_with, -> (name) { where("name like ?", "#{name}%")}
33
+
34
+ end
35
+ ```
36
+
37
+ ```ruby
38
+ app/controllers/product_controller.rb
39
+
40
+ def index
41
+ @products = Product.filter(params.slice(:status, :location, :starts_with))
42
+ end
43
+ ```
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ 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).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/search_in_model. 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.
54
+
55
+ ## License
56
+
57
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
58
+
59
+ ## Code of Conduct
60
+
61
+ Everyone interacting in the SearchInModel project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/search_in_model/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "search_in_model"
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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ require "search_in_model/version"
2
+
3
+ module SearchInModel
4
+ # Your code goes here...
5
+ extend ActiveSupport::Concern
6
+
7
+ module ClassMethods
8
+ def filter(filtering_params)
9
+ results = self.where(nil)
10
+ filtering_params.each do |key, value|
11
+ results = results.public_send(key, value) if value.present?
12
+ end
13
+ results
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module SearchInModel
2
+ VERSION = "1.1.0"
3
+ end
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "search_in_model/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "search_in_model"
8
+ spec.version = SearchInModel::VERSION
9
+ spec.authors = ["hany"]
10
+ spec.email = ["hanysayed.a@gmail.com\n"]
11
+
12
+ spec.summary = %q{search in database by user keyword}
13
+ spec.description = %q{search in database by user keyword}
14
+ spec.homepage = "https://github.com/h4hany/filterable"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.15"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: search_in_model
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - hany
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-09-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: search in database by user keyword
56
+ email:
57
+ - 'hanysayed.a@gmail.com
58
+
59
+ '
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - ".idea/workspace.xml"
66
+ - ".rspec"
67
+ - ".travis.yml"
68
+ - CODE_OF_CONDUCT.md
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - lib/search_in_model.rb
76
+ - lib/search_in_model/version.rb
77
+ - search_in_model.gemspec
78
+ homepage: https://github.com/h4hany/filterable
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.5.1
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: search in database by user keyword
102
+ test_files: []