search_me 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +13 -5
  2. data/lib/search_me/search.rb +8 -3
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4dda6eb047e473b4ddb6589405b67e8053f35f6b
4
- data.tar.gz: 6f8b867f9554d4fdd6c8d84c86543196ebb617fa
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDM2MTkwYjU4Y2Q3OTUyOWZjNmU3OTFjZmRmNTdiNDAwYzZiM2Q0Mg==
5
+ data.tar.gz: !binary |-
6
+ OGNjZGY4MzI0ZDNmYjJlNjljZWYzMjdmMTRhMzBmNjI2YWNiYzJjZA==
5
7
  SHA512:
6
- metadata.gz: 4f2223995371daf6b83e0aaee00ac97501cc877c473552fdb3debb9e2c004989a5b5cd51cb12336dd09b8eb13e179998b8d7bf784c70dc1c6c6d7734bd99953f
7
- data.tar.gz: 88d8b938bca88d7c96d959f2c364f5aa64b181064aac55f73803522b4b5d5bca456f5c0f18c9d9d1643d27aefdb65e93cb2d14563deae3148094f2cf3e4409f5
8
+ metadata.gz: !binary |-
9
+ NDdkYTRkOTA5NTZlOTJkZTgyNzMyZWM3ZmIwNjhiN2JmNWYzNzA2MjYyMDFm
10
+ NjgwZGQzZDM5MTljMDc1ZjVhNDlkMmFjZjk5YmM1YzUzNzYwMjI0OGUxODM3
11
+ ZTE0NzA3MTZlNzg3NzRmNGU2OWRiNjg5YWI3OTM0MzExYzhjOGM=
12
+ data.tar.gz: !binary |-
13
+ Mzc1YTU0OTdiN2IwOWI0YzMzMDE1YzRlMWM4ZTc1MmZjYTMwZGE0MDA1Yjc1
14
+ ODc0OWMwMWUzODIzNjAxOGYyN2ZiODFjNzEwYjNjNGQyY2VjZjQyOWJlZjU0
15
+ N2U1MWU0MjQzMWZiN2NjYzY1OWFhNWJjZjZiZjA0NDY2ODdiYTg=
@@ -14,7 +14,10 @@ module SearchMe
14
14
  }
15
15
  end
16
16
 
17
- def attr_search(*attributes, type: :simple)
17
+ # assuming the last attribute could be a hash
18
+ def attr_search(*attributes)
19
+ options = attributes.last.is_a?(Hash) ? attributes.pop : {}
20
+ type = options.fetch(:type) { :simple }
18
21
  unless ([:simple] + self.reflections.keys).include?(type)
19
22
  raise ArgumentError, 'incorect type given'
20
23
  end
@@ -22,7 +25,8 @@ module SearchMe
22
25
  search_attributes_hash!(attributes, type, search_attributes)
23
26
  end
24
27
 
25
- def alias_advanced_search(attribute, type: :simple, &block)
28
+ def alias_advanced_search(attribute, options = {}, &block)
29
+ type = options.fetch(:type) { :simple }
26
30
  advanced_search_blocks[type][attribute] = block
27
31
  end
28
32
 
@@ -249,7 +253,8 @@ module SearchMe
249
253
  end
250
254
  end
251
255
 
252
- def name_for(constant, plural: false)
256
+ def name_for(constant, options = {})
257
+ options.fetch(:plural) { false }
253
258
  name = constant.to_s.underscore
254
259
  name = name.singularize unless plural
255
260
  name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jphager2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Uses LIKE to search attributes and return any objects of the model for
14
14
  which a match is found
@@ -31,12 +31,12 @@ require_paths:
31
31
  - lib
32
32
  required_ruby_version: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ">="
34
+ - - ! '>='
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0'
37
37
  required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - ! '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []