cherring-rangetastic 0.3.0 → 0.3.1
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.
- data/Rakefile +1 -1
- data/lib/rangetastic.rb +12 -4
- data/rangetastic.gemspec +2 -2
- data/spec/rangetastic_spec.rb +1 -1
- metadata +4 -3
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('rangetastic', '0.3.
|
5
|
+
Echoe.new('rangetastic', '0.3.1') do |p|
|
6
6
|
p.description = "Chain a date range to any named_scope on any date field with specified white listed fields"
|
7
7
|
p.url = "http://github.com/cherring/rangetastic"
|
8
8
|
p.author = "Chris Herring"
|
data/lib/rangetastic.rb
CHANGED
@@ -23,15 +23,23 @@ module Rangetastic
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def field(symbol)
|
26
|
-
if columns_hash.has_key?
|
27
|
-
@field =
|
28
|
-
elsif columns_hash.has_key?
|
29
|
-
@field =
|
26
|
+
if columns_hash.has_key? on_field(symbol)
|
27
|
+
@field = on_field(symbol)
|
28
|
+
elsif columns_hash.has_key? at_field(symbol)
|
29
|
+
@field = at_field(symbol)
|
30
30
|
else
|
31
31
|
@field = nil
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def at_field(symbol)
|
36
|
+
"#{symbol.to_s.gsub("_between","")}_at"
|
37
|
+
end
|
38
|
+
|
39
|
+
def on_field(symbol)
|
40
|
+
"#{symbol.to_s.gsub("_between","")}_on"
|
41
|
+
end
|
42
|
+
|
35
43
|
def field_to_query
|
36
44
|
@field
|
37
45
|
end
|
data/rangetastic.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rangetastic}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Chris Herring"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-28}
|
10
10
|
s.description = %q{Chain a date range to any named_scope on any date field with specified white listed fields}
|
11
11
|
s.email = %q{chris.herring.iphone@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["lib/rangetastic.rb", "README.markdown"]
|
data/spec/rangetastic_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe Order do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should be able to filter on any field that is in fields => []" do
|
24
|
-
%w(ordered_on fulfilled_on
|
24
|
+
%w(ordered_on fulfilled_on shipped_at).each do |field|
|
25
25
|
lambda{ Order.fulfilled.between(1.week.ago, 1.day.ago, field) }.should_not raise_error(ActiveRecord::StatementInvalid)
|
26
26
|
end
|
27
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cherring-rangetastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Herring
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-28 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- spec/test_helper.rb
|
37
37
|
has_rdoc: false
|
38
38
|
homepage: http://github.com/cherring/rangetastic
|
39
|
+
licenses:
|
39
40
|
post_install_message:
|
40
41
|
rdoc_options:
|
41
42
|
- --line-numbers
|
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
62
|
requirements: []
|
62
63
|
|
63
64
|
rubyforge_project: rangetastic
|
64
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.3.5
|
65
66
|
signing_key:
|
66
67
|
specification_version: 3
|
67
68
|
summary: Chain a date range to any named_scope on any date field with specified white listed fields
|