Permalink
Browse files

Updated bundle. Allow to pass ranges to between operations.

  • Loading branch information...
1 parent dd8738a commit e14cc998148e1336730ab8b589cd01350779d6b9 @dim dim committed Oct 21, 2011
View
4 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- constrainable (0.5.0)
+ constrainable (0.5.1)
abstract
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
@@ -63,7 +63,7 @@ GEM
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
- rspec-core (2.7.0)
+ rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
View
2 constrainable.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
s.name = "constrainable"
s.summary = "Simple filtering for ActiveRecord"
s.description = "Sanitizes simple and readable query parameters -great for building APIs & HTML filters"
- s.version = '0.5.0'
+ s.version = '0.5.1'
s.authors = ["Dimitrij Denissenko"]
s.email = "dimitrij@blacksquaremedia.com"
View
2 lib/bsm/constrainable/operation/between.rb
@@ -3,6 +3,8 @@ class Between < Base
def parsed
result = case value
+ when Range
+ [value.first, value.last]
when /^ *(.+?) *\.{2,} *(.+?) *$/
[$1, $2]
else
View
1 spec/bsm/constrainable/operation/between_spec.rb
@@ -12,6 +12,7 @@ def subject(value = [1, 100])
subject.parsed.should == ['1', '100']
subject("2...5").parsed.should == ['2', '5']
subject("3..7").parsed.should == ['3', '7']
+ subject(3..7).parsed.should == ['3', '7']
subject(" 2 ...... 8 ").parsed.should == ['2', '8']
subject("2010-01-01..2011-01-01").parsed.should == ['2010-01-01', '2011-01-01']
subject(" ").parsed.should be_nil

0 comments on commit e14cc99

Please sign in to comment.