search_me 0.1.1 → 0.1.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 +4 -4
- data/lib/search_me.rb +1 -20
- data/lib/search_me/configuration.rb +21 -0
- data/lib/search_me/filters.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7c821bcb957da6494a225c81c256bef004fcbd1
|
|
4
|
+
data.tar.gz: 7e005fa980b5ee77c3c6eb7513150b9251052c9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ee8f5d11e5835bdc04000ddd4eac40fa311b80cbede2e4be42e146b2e6cb379d919339e13fe5638ee5652ce7ae7ed266c8e31901c8d5c51fd4532aee7704afe
|
|
7
|
+
data.tar.gz: 61a243c813bdcb5eccd3a6b42f01b641b99618a2d70de8c42be3d30d94d5e395d0680e88b687de51d7921488759d56946df37cf0bd481c031f00ea1334ade49e
|
data/lib/search_me.rb
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
+
require_relative 'search_me/configuration'
|
|
1
2
|
require_relative 'search_me/search'
|
|
2
3
|
require_relative 'search_me/filters'
|
|
3
4
|
|
|
4
5
|
module SearchMe
|
|
5
|
-
|
|
6
|
-
class Config
|
|
7
|
-
attr_accessor :time_field
|
|
8
|
-
def initialize
|
|
9
|
-
# Set Defaults
|
|
10
|
-
@time_field = :created_at
|
|
11
|
-
|
|
12
|
-
yield(self) if block_given?
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
extend self
|
|
17
|
-
|
|
18
|
-
def self.config(&block)
|
|
19
|
-
if block_given?
|
|
20
|
-
@config = Config.new(&block)
|
|
21
|
-
else
|
|
22
|
-
@config ||= Config.new
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
6
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module SearchMe
|
|
2
|
+
module Configuration
|
|
3
|
+
class Config
|
|
4
|
+
attr_accessor :time_field
|
|
5
|
+
def initialize
|
|
6
|
+
# Set Defaults
|
|
7
|
+
@time_field = :created_at
|
|
8
|
+
|
|
9
|
+
yield(self) if block_given?
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def search_me_config(&block)
|
|
14
|
+
if block_given?
|
|
15
|
+
@_search_me_config = Config.new(&block)
|
|
16
|
+
else
|
|
17
|
+
@_search_me_config ||= Config.new
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/search_me/filters.rb
CHANGED
|
@@ -76,7 +76,7 @@ module SearchMe
|
|
|
76
76
|
|
|
77
77
|
private
|
|
78
78
|
def build_between_query_for(duration)
|
|
79
|
-
field =
|
|
79
|
+
field = arel_table[search_me_config.time_field]
|
|
80
80
|
arel = field.eq(duration[0])
|
|
81
81
|
.or( field.gt(duration[0]).and(field.lt(duration[1])) )
|
|
82
82
|
.or( field.eq(duration[1]) )
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: search_me
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jphager2
|
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
|
19
19
|
files:
|
|
20
20
|
- LICENSE
|
|
21
21
|
- lib/search_me.rb
|
|
22
|
+
- lib/search_me/configuration.rb
|
|
22
23
|
- lib/search_me/filters.rb
|
|
23
24
|
- lib/search_me/search.rb
|
|
24
25
|
homepage: https://github.com/jphager2/search_me
|