pax_global_header00006660000000000000000000000064121574321610014514gustar00rootroot0000000000000052 comment=ab1066bb88ce87e80b52b1df38065f05bebac813 ruby-origin-1.1.0/000077500000000000000000000000001215743216100137615ustar00rootroot00000000000000ruby-origin-1.1.0/.gitignore000066400000000000000000000002731215743216100157530ustar00rootroot00000000000000.DS_Store coverage/* pkg/* scratch_directory/* sandbox/* tmp/* *.gem .bundle Gemfile.lock rdoc/* TODO ISSUES DONATE .yardoc/* doc/* *.swp *.un~ *~ *.rbc *.profile *.profile.pdf *.symbols ruby-origin-1.1.0/.rspec000066400000000000000000000001071215743216100150740ustar00rootroot00000000000000--colour --tty --format <%= ENV["CI"] ? 'progress' : 'documentation'%> ruby-origin-1.1.0/.ruby-gemset000066400000000000000000000000071215743216100162220ustar00rootroot00000000000000origin ruby-origin-1.1.0/.ruby-version000066400000000000000000000000131215743216100164200ustar00rootroot00000000000000ruby-2.0.0 ruby-origin-1.1.0/.travis.yml000066400000000000000000000002461215743216100160740ustar00rootroot00000000000000language: ruby bundler_args: --without development rvm: - 1.9.3 - 2.0.0 - ruby-head - jruby - jruby-head jdk: - oraclejdk7 - openjdk7 env: CI="travis" ruby-origin-1.1.0/.yardopts000066400000000000000000000000151215743216100156230ustar00rootroot00000000000000- CHANGELOG* ruby-origin-1.1.0/CHANGELOG.md000066400000000000000000000035631215743216100156010ustar00rootroot00000000000000# Overview ## 1.1.0 (branch: master) ### Resolved Issues * \#77 Arrays can now be expanded when complex keys are preset. (Timersha Ziganshin) * \#76 Hashes with nested values multiple levels are now expanded properly. (Timersha Ziganshin) * \#75 Merging strategies now expand nested criteria properly. (Timersha Ziganshin) * \#73 Negation now properly works for $gt/$lt etc queries. (Arthur Neves) * \#62 Fixed time with zone require. (Julien Boyer) ## 1.0.11 ### Resolved Issues * \#58 Retain milliseconds precision when evolving times. (Steve Valaitis) * \#56 Selector values are no longer modified in place. * \#55 Allow #only and #without to take array arguments. (Egor Lynko) ## 1.0.10 ### Resolved Issues * \#51 hash equality works corectly with `Origin::Key`s (Gerad Suyderhoud) { :foo.all => [1, 2] } == { :foo.all => [1, 2] } #=> true ## 1.0.9 ### Resolved Issues * \#45 Fixed $not query negation with regular expressions. (Andrew Bennett) ## 1.0.8 ### Resolved Issues * \#44 Fixed serialization on deeply nested $and and $or queries. (Egor Lynko) ## 1.0.7 ### Resolved Issues * \#40 Allow $elemMatch queries to be expanded in where clauses, not just elem_match method calls. ## 1.0.5 ### Resolved Issues * \#40 Allow $elemMatch queries to be expanded. ## 1.0.4 ### Resolved Issues * \#39 Fixed errors when using forwarding when active support is not present. ## 1.0.3 ### Resolved Issues * mongoid/mongoid\#2170 Multi selection ($and/$or) now properly concats when merging two criteria. ## 1.0.2 ### Resolved Issues * mongoid/mongoid\#2165 Multi selection ($and/$or) now takes into account field aliases. ## 1.0.1 ### Resolved Issues * \#38 Fixed issues around UTC time conversion of dates and date times: `DateTimes` already in UTC are not converted to UTC again. `Dates` properly convert directly to UTC from numeric values. ruby-origin-1.1.0/Gemfile000066400000000000000000000003661215743216100152610ustar00rootroot00000000000000source "http://rubygems.org" gemspec group :test do gem "activesupport", "~> 3.1" gem "i18n", "~> 0.6" gem "rspec", "~> 2.13" gem "tzinfo", "~> 0.3.22" unless ENV["CI"] gem "guard-rspec" gem "rb-fsevent" end end gem "rake" ruby-origin-1.1.0/Guardfile000066400000000000000000000003531215743216100156070ustar00rootroot00000000000000# vim:set filetype=ruby: guard( "rspec", all_after_pass: false, cli: "--fail-fast --tty --format documentation --colour") do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |match| "spec/#{match[1]}_spec.rb" } end ruby-origin-1.1.0/LICENSE000066400000000000000000000020461215743216100147700ustar00rootroot00000000000000Copyright (c) 2011-2013 Durran Jordan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ruby-origin-1.1.0/README.md000066400000000000000000000034361215743216100152460ustar00rootroot00000000000000Origin [![Build Status](https://secure.travis-ci.org/mongoid/origin.png?branch=master&.png)](http://travis-ci.org/mongoid/origin) ======== Origin is a DSL for building MongoDB queries. Project Tracking ---------------- * [Mongoid Google Group](http://groups.google.com/group/mongoid) * [Origin Website and Documentation](http://mongoid.org/en/origin/) * [Origin Code Climate](https://codeclimate.com/github/mongoid/origin) Compatibility ------------- Origin is tested against MRI 1.9.2, 1.9.3, 2.0.0, and JRuby (1.9). Documentation ------------- Please see the new Mongoid website for up-to-date documentation in the Origin section: [mongoid.org](http://mongoid.org/en/origin/) License ------- Copyright (c) 2011-2013 Durran Jordan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Credits ------- Durran Jordan: durran at gmail dot com ruby-origin-1.1.0/Rakefile000066400000000000000000000012501215743216100154240ustar00rootroot00000000000000require "bundler" Bundler.setup require "rake" require "rspec" require "rspec/core/rake_task" $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require "origin/version" task :gem => :build task :build do system "gem build origin.gemspec" end task :install => :build do system "sudo gem install origin-#{Origin::VERSION}.gem" end task :release => :build do system "git tag -a v#{Origin::VERSION} -m 'Tagging #{Origin::VERSION}'" system "git push --tags" system "gem push origin-#{Origin::VERSION}.gem" system "rm origin-#{Origin::VERSION}.gem" end RSpec::Core::RakeTask.new("spec") do |spec| spec.pattern = "spec/**/*_spec.rb" end task :default => :spec ruby-origin-1.1.0/lib/000077500000000000000000000000001215743216100145275ustar00rootroot00000000000000ruby-origin-1.1.0/lib/origin.rb000066400000000000000000000001431215743216100163410ustar00rootroot00000000000000# encoding: utf-8 require "origin/forwardable" require "origin/queryable" require "origin/version" ruby-origin-1.1.0/lib/origin/000077500000000000000000000000001215743216100160165ustar00rootroot00000000000000ruby-origin-1.1.0/lib/origin/extensions.rb000066400000000000000000000014211215743216100205400ustar00rootroot00000000000000# encoding: utf-8 unless defined?(Boolean) class Boolean; end end if defined?(ActiveSupport) unless defined?(ActiveSupport::TimeWithZone) require "active_support/time_with_zone" end require "origin/extensions/time_with_zone" end require "time" require "origin/extensions/object" require "origin/extensions/array" require "origin/extensions/big_decimal" require "origin/extensions/boolean" require "origin/extensions/date" require "origin/extensions/date_time" require "origin/extensions/hash" require "origin/extensions/nil_class" require "origin/extensions/numeric" require "origin/extensions/range" require "origin/extensions/regexp" require "origin/extensions/set" require "origin/extensions/string" require "origin/extensions/symbol" require "origin/extensions/time" ruby-origin-1.1.0/lib/origin/extensions/000077500000000000000000000000001215743216100202155ustar00rootroot00000000000000ruby-origin-1.1.0/lib/origin/extensions/array.rb000066400000000000000000000110631215743216100216610ustar00rootroot00000000000000# encoding: utf-8 module Origin module Extensions # The array module adds custom behaviour for Origin onto the Array class. module Array # Combine the two objects using the add strategy. # # @example Add the object to the array. # [ 1, 2, 3 ].__add__(4) # # @param [ Object ] object The object to add. # # @return [ Object ] The result of the add. # # @since 1.0.0 def __add__(object) object.__add_from_array__(self) end # Return the object as an array. # # @example Get the array. # [ 1, 2 ].__array__ # # @return [ Array ] self # # @since 1.0.0 def __array__; self; end # Makes a deep copy of the array, deep copying every element inside the # array. # # @example Get a deep copy of the array. # [ 1, 2, 3 ].__deep_copy__ # # @return [ Array ] The deep copy of the array. # # @since 1.0.0 def __deep_copy__ map { |value| value.__deep_copy__ } end # Evolve the array into an array of mongo friendly dates. (Times at # midnight). # # @example Evolve the array to dates. # [ Date.new(2010, 1, 1) ].__evolve_date__ # # @return [ Array