activerecord-search 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 7ff2752e5628305c3b0fa90597daa07c5d4ae703
4
- data.tar.gz: 6105dd3dc5fcfd2dfc5133eef9eefc3aed36aba4
3
+ metadata.gz: afe363b0134b9dab1fdee6df2cab99c27a2acd7c
4
+ data.tar.gz: 299a1d6d133d9545cfbf6055881088b01407f4f0
5
5
  SHA512:
6
- metadata.gz: df000a180adcdd0645d478d45bdaba4c4857a3ffedcd1b42bd1bde69b2ba0fae6397d5e11b0e2a7a01742dc4045772be6c12d3854eeb4fe001e6310f931fcbdf
7
- data.tar.gz: b760b7dc43af4a0c31fc078cc0d93349598759516f3a318e9b1c7909e8b09cd01f61015a01b244b3694e181c6763c2da65b0acc28b14d7e8dd01b3a84e88c121
6
+ metadata.gz: fcf29864bfda0d17e319b87009aead4718643f80dab2f4f7e0234c070608a4bdd9fee9b1bdfcff40d0b3d03bc5fe04e0e016f62fd0938149fe3748b921113448
7
+ data.tar.gz: bf61c7fc586b8308e631937c52884f3ca4ab4f3f1013c50cad67290111263f79180c75f4678e35fcee1d1cbecb21c0796a968a001c07adc0775a1faf335b3fde
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in activerecord-search.gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- This plugin permits, with few lines of code, to have a lightweight and steady ActiveRecord search engine.
23
+ This plugin permits, with few lines of code, to have a lightweight and steady ActiveRecord search-engine.
24
24
 
25
25
  Below is an example of the features offered by this plugin:
26
26
 
@@ -47,9 +47,9 @@ class PostsController < ApplicationController
47
47
  Post.search_post("Ruby", :start_with, [:name, :content]) # It's possible to override the :search_option and :search_field values
48
48
 
49
49
  # Some helper method are available
50
- Post.start_with("Ruby") # all record that start with 'Ruby'
51
- Post.end_with("Ruby") # all record that end with 'Ruby'
52
- Post.search_anywhere("Ruby") # all record that search anywhere with 'Ruby'
50
+ Post.start_with("Ruby") # all records that start with 'Ruby'
51
+ Post.end_with("Ruby") # all records that end with 'Ruby'
52
+ Post.search_anywhere("Ruby") # all records that search anywhere with 'Ruby'
53
53
 
54
54
  end
55
55
 
@@ -59,15 +59,16 @@ end
59
59
 
60
60
  ## More about the API
61
61
 
62
- ##### search_option method (Call in model)
62
+ ##### search_option method
63
63
 
64
- `search_option` method specifies where to search in the sentence. Available options:
64
+ `search_option` method specifies where to search in the sentence.<br />
65
+ Available options:
65
66
 
66
67
  - `:start_with` : the sentence starts with the pattern.
67
68
  - `:end_with` : the sentence ends with the pattern.
68
69
  - `:anywhere` : search anywhere in the sentence. [DEFAULT OPTION]
69
70
 
70
- ##### search_field method (Call in model)
71
+ ##### search_field method
71
72
 
72
73
  `search_field` method specifies which field is used for the search. It's possible to search in multiple fields by using the method `search_fields([])`:
73
74
 
@@ -102,9 +103,7 @@ Append the model name to this method results from the following question: What i
102
103
 
103
104
  ## Development
104
105
 
105
- 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.
106
-
107
- 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).
106
+ After checking out the repo, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
108
107
 
109
108
  ## Contributing
110
109
 
@@ -115,3 +114,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/mehdi-
115
114
 
116
115
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
117
116
 
117
+ > Please, feel free to star the project if you like it ! :)
@@ -37,9 +37,10 @@ Gem::Specification.new do |spec|
37
37
  Many Thanks !
38
38
  EOF
39
39
 
40
- spec.add_development_dependency "bundler"
41
- spec.add_development_dependency "rake"
40
+ spec.add_development_dependency "bundler", "~> 1.12"
41
+ spec.add_development_dependency "rake", "~> 10.0"
42
+ spec.add_development_dependency "minitest", "~> 5.0"
42
43
  spec.add_development_dependency "activerecord"
43
44
  spec.add_development_dependency "sqlite3"
44
- spec.add_development_dependency "minitest"
45
+ spec.add_development_dependency "rubocop"
45
46
  end
@@ -14,7 +14,7 @@ module ActiveRecord
14
14
  super
15
15
  return if subclass.to_s.underscore == "active_record/schema_migration"
16
16
  class_eval <<-EOF
17
- class << #{subclass}
17
+ class << #{subclass}
18
18
  attr_reader :search_option, :search_fields
19
19
 
20
20
  def search_#{subclass.to_s.underscore}(words, option = nil, fields = [])
@@ -47,7 +47,7 @@ module ActiveRecord
47
47
  def search_fields(fields)
48
48
  @search_fields = [fields].flatten
49
49
  end
50
- alias_method :search_field, :search_fields
50
+ alias_method :search_field, :search_fields
51
51
 
52
52
  def format_search(words, option)
53
53
  if !option.nil?
@@ -61,7 +61,7 @@ module ActiveRecord
61
61
  def format_with_option(words, option)
62
62
  case option
63
63
  when :start_with then words + '%'
64
- when :end_with then '%' + words
64
+ when :end_with then '%' + words
65
65
  when :anywhere then '%' + words + '%'
66
66
  else
67
67
  raise SearchError
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module Search
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehdi FARSI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-25 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.12'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: activerecord
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: minitest
84
+ name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -125,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
139
  version: '0'
126
140
  requirements: []
127
141
  rubyforge_project:
128
- rubygems_version: 2.4.6
142
+ rubygems_version: 2.5.1
129
143
  signing_key:
130
144
  specification_version: 4
131
145
  summary: ActiveRecord::Search