Permalink
Browse files

Make DefaultFinder.included also include Queryable

  • Loading branch information...
1 parent 4ce1241 commit b3465e4c96f51e391829d21d002230ac556532cd @shuber committed Jan 30, 2013
Showing with 6 additions and 2 deletions.
  1. +0 −2 lib/queryable_array.rb
  2. +6 −0 lib/queryable_array/default_finder.rb
View
@@ -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
@@ -1,10 +1,16 @@
+require 'queryable_array/queryable'
+
class QueryableArray < Array
# Allows objects to be searched by +default_finders+ thru <tt>[]</tt>. For example:
#
# users = QueryableArray.new(User.all, :email)
# 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+

0 comments on commit b3465e4

Please sign in to comment.