elasticsearch-model 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTEzZGEzOThmZGEyNGQ1NWU1NmQ5M2MxZjY2MTY3Zjc4MjY4YWUzMQ==
4
+ Y2Y1ZDVlOWEyODBjYzg3MmFiYjNmOTZjY2I2YTJmMjIxYzkwN2I1OA==
5
5
  data.tar.gz: !binary |-
6
- MzViYTk0YjhmZjA3ODI1MTlhOWZhNDU4NzdjZTQyZDIxNDcxODYwZg==
6
+ NTIyNTFhZDc3MTQ3YTdiMDlmMmYwZmYxN2VjZmIyOTYyNzlhMWY1Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODRhOGMxYzBmMTZlYWU4YzJmNTRjZmRjZjQ5Y2VkY2I5M2E0ZTFhZWZjYTVl
10
- ODcyMDUyMzkyOGE5MmI2ZDcwNWIwNTEwMTY4YmZlMzIyOWU2NDU2OGI2NmM4
11
- MGFkODMxM2I1NmZmNmRmMDRiNzViOGIyZDhkYzU2MGMxNDQ2NzA=
9
+ MmE4MjU1N2UwMmYwNTJiMzM5ZjdlOWM4ZGI0NzI0NzJkYTc0YjA0OTM2M2Q5
10
+ MGUwZDBmNzFhMDg2MGQ1NTk1N2U0YmVmOWY4MTI0NGVlMzcwYjNhNjU5MzE3
11
+ OWRkYTBmNTAxZGYwOTM1MWQ5Mjc2MDU2ZTUwMDIyOTY3NTcwMmM=
12
12
  data.tar.gz: !binary |-
13
- NGQ2YTM3YWVkNzVkYWU5MmNkNjJmMjZjZTM2MGMxZGU0NGY3Y2U5MmRlZTU5
14
- NWZjOGY2ZDdmODIyMzYzNDkzOTM4M2E4M2YwYTkwN2FmMjZlNmQ2MTIyODRk
15
- YjM4ZTQ1NWNkN2VkY2UzNDU4NThjYTY0NmMyOWY5NDA4MmU5MjA=
13
+ ZTUzYzliYmU4NjcxYTFmYWQyMDA2MGE1ZWYwZDhhMmRiMTI3NzlkYjJhNWI3
14
+ Y2ExNzY3Mzc1NGM4MmQwZWM1MDEzZDlhMjQyYmViN2ZjNTg1NTJlZWE0NmRm
15
+ ZTA1ODRhOWQ1OTUxMWY4YjllZGE3OWQwNzFmMDM5ZDMzNmZkOTg=
@@ -1,3 +1,5 @@
1
+ ## 0.1.3
2
+
1
3
  ## 0.1.2
2
4
 
3
5
  * Properly delegate existence methods like `result.foo?` to `result._source.foo`
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
21
21
  s.extra_rdoc_files = [ "README.md", "LICENSE.txt" ]
22
22
  s.rdoc_options = [ "--charset=UTF-8" ]
23
23
 
24
+ s.required_ruby_version = ">= 1.9.3"
25
+
24
26
  s.add_dependency "elasticsearch", '> 0.4'
25
27
  s.add_dependency "activesupport", '> 3'
26
28
  s.add_dependency "hashie"
@@ -62,6 +62,7 @@ module Elasticsearch
62
62
  # # ...
63
63
  #
64
64
  module Model
65
+ METHODS = [:search, :mapping, :mappings, :settings, :index_name, :document_type, :import]
65
66
 
66
67
  # Adds the `Elasticsearch::Model` functionality to the including class.
67
68
  #
@@ -107,13 +108,9 @@ module Elasticsearch
107
108
  # Delegate important methods to the `__elasticsearch__` proxy, unless they are defined already
108
109
  #
109
110
  class << self
110
- delegate :search, to: :__elasticsearch__ unless respond_to?(:search)
111
- delegate :mapping, to: :__elasticsearch__ unless respond_to?(:mapping)
112
- delegate :mappings, to: :__elasticsearch__ unless respond_to?(:mappings)
113
- delegate :settings, to: :__elasticsearch__ unless respond_to?(:settings)
114
- delegate :index_name, to: :__elasticsearch__ unless respond_to?(:index_name)
115
- delegate :document_type, to: :__elasticsearch__ unless respond_to?(:document_type)
116
- delegate :import, to: :__elasticsearch__ unless respond_to?(:import)
111
+ METHODS.each do |method|
112
+ delegate method, to: :__elasticsearch__ unless self.public_instance_methods.include?(method)
113
+ end
117
114
  end
118
115
 
119
116
  # Mix the importing module into the proxy
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Model
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -22,6 +22,11 @@ class Elasticsearch::Model::ModuleTest < Test::Unit::TestCase
22
22
 
23
23
  context "when included in module/class, " do
24
24
  class ::DummyIncludingModel; end
25
+ class ::DummyIncludingModelWithSearchMethodDefined
26
+ def self.search(query, options={})
27
+ "SEARCH"
28
+ end
29
+ end
25
30
 
26
31
  should "include and set up the proxy" do
27
32
  DummyIncludingModel.__send__ :include, Elasticsearch::Model
@@ -40,6 +45,12 @@ class Elasticsearch::Model::ModuleTest < Test::Unit::TestCase
40
45
  assert_respond_to DummyIncludingModel, :document_type
41
46
  assert_respond_to DummyIncludingModel, :import
42
47
  end
48
+
49
+ should "not override existing method" do
50
+ DummyIncludingModelWithSearchMethodDefined.__send__ :include, Elasticsearch::Model
51
+
52
+ assert_equal 'SEARCH', DummyIncludingModelWithSearchMethodDefined.search('foo')
53
+ end
43
54
  end
44
55
 
45
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-23 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch
@@ -435,7 +435,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
435
435
  requirements:
436
436
  - - ! '>='
437
437
  - !ruby/object:Gem::Version
438
- version: '0'
438
+ version: 1.9.3
439
439
  required_rubygems_version: !ruby/object:Gem::Requirement
440
440
  requirements:
441
441
  - - ! '>='