dm-json-search 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -8,15 +8,9 @@ gem install gemcutter # unless you already have
8
8
  gem tumble # unless you already have
9
9
  gem install dm-json-search
10
10
 
11
- Then, in your model:
12
-
13
- class Book
14
- include JsonSearch::Searchable
15
- end
16
-
17
11
  Wala:
18
12
 
19
- Book.search('[{"eql":{"title":"Psycho"}}]')
13
+ Book.all_from_json('[{"eql":{"title":"Psycho"}}]')
20
14
  # Should this be mixed in automagically to every model?
21
15
 
22
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-json-search}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Herald"]
@@ -1,3 +1,6 @@
1
1
  require 'dm-core'
2
2
  require File.dirname(__FILE__) + '/dm-json-search/query_ext'
3
- require File.dirname(__FILE__) + '/dm-json-search/searchable'
3
+ require File.dirname(__FILE__) + '/dm-json-search/searchable'
4
+
5
+ DataMapper::Model.append_extensions(JsonSearch::Searchable::ClassMethods)
6
+ # DataMapper::Model.append_inclusions(JsonSearch::Searchable::ClassMethods)
@@ -1,12 +1,8 @@
1
1
  module JsonSearch
2
2
  module Searchable
3
3
 
4
- def self.included(base)
5
- base.extend(ClassMethods)
6
- end
7
-
8
4
  module ClassMethods
9
- def search(json = {})
5
+ def all_from_json(json = {})
10
6
  json = JSON.parse(json) if json.is_a?(String)
11
7
 
12
8
  if json.is_a?(Array)
@@ -25,5 +21,4 @@ module JsonSearch
25
21
  end
26
22
 
27
23
  end
28
- end
29
- JSONSearch = JsonSearch
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-json-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Herald