Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make DefaultFinder.included also include Queryable

  • Loading branch information...
commit b3465e4c96f51e391829d21d002230ac556532cd 1 parent 4ce1241
@shuber authored
Showing with 6 additions and 2 deletions.
  1. +0 −2  lib/queryable_array.rb
  2. +6 −0 lib/queryable_array/default_finder.rb
View
2  lib/queryable_array.rb
@@ -1,7 +1,6 @@
require 'respond_to_missing'
require 'queryable_array/dot_notation'
require 'queryable_array/dynamic_finder'
-require 'queryable_array/queryable'
require 'queryable_array/shorthand'
require 'queryable_array/version'
@@ -10,7 +9,6 @@
# overrides +[]+, +find_all+ and +method_missing+ to provide a simplified DSL
# for looking up objects by querying their attributes.
class QueryableArray < Array
- include Queryable
include Shorthand
include DotNotation
include DynamicFinder
View
6 lib/queryable_array/default_finder.rb
@@ -1,3 +1,5 @@
+require 'queryable_array/queryable'
+
class QueryableArray < Array
# Allows objects to be searched by +default_finders+ thru <tt>[]</tt>. For example:
#
@@ -5,6 +7,10 @@ class QueryableArray < Array
# users['test@example.com'] # => #<User @email='test@example.com'>
# users['missing@domain.com'] # => nil
module DefaultFinder
+ def self.included(base)
+ base.send :include, Queryable
+ end
+
attr_accessor :default_finders
# Accepts an initial +array+ which defaults to +[]+. An optional +default_finders+
Please sign in to comment.
Something went wrong with that request. Please try again.