elasticsearch-model 7.2.0 → 7.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 394cd3e2e2da51faa7db9c7843aa4b9e225199d3544491ccc2f6df35b5de721f
4
- data.tar.gz: b8ce93762fe83c40b40b14b5dc0a2a59f936c2a9ee20647ed95c99cab108b3d6
3
+ metadata.gz: e1aecf263867f2176d7819eccd7e23f9b37bc85132223b8f64398ab85736ea75
4
+ data.tar.gz: af80ff000fcf065f2694141bfcdc282a947cfea05f5ece2f11a24897f5753039
5
5
  SHA512:
6
- metadata.gz: d3fc6c1744793d2066084410900a1e7af07fdf4efd420ce11f2fac368b2a72563510a83b3eeb99773a8b5554087af32d1b0b702e3c00df3cd18a99dea29f1952
7
- data.tar.gz: 8b6a7603023357295b9b83aabf85bbc22cc04d527ebf9e1de48cd2de1212ff4c70060944ff964607bdb0e4a6b16c36b318c07793e9404bb8c889e940474f05fa
6
+ metadata.gz: 246ae4f642a662a4a0c5fe6e26581c052c15ddf868d9b47b640c3f996e584056a8facc4004d61151647e67e6624d1bb16cad90a4513f303ad0afdeaf84b1eedf
7
+ data.tar.gz: 406c37164bb6fc16068d2edcf6e1183d9c2ba34420d57fab9d3f288416fd0d75173ecc4ad3f37236051d517db717c4fb37ae2d44663f87a6b28213637ea8f7a5
data/README.md CHANGED
@@ -8,7 +8,7 @@ It aims to simplify integration of Ruby classes ("models"), commonly found e.g.
8
8
 
9
9
  This library is compatible with Ruby 2.4 and higher.
10
10
 
11
- The library version numbers follow the Elasticsearch major versions. The `master` branch is compatible with the latest Elasticsearch stack stable release.
11
+ The library version numbers follow the Elasticsearch major versions. The `main` branch is compatible with the latest Elasticsearch stack stable release.
12
12
 
13
13
  | Rubygem | | Elasticsearch |
14
14
  |:-------------:|:-:| :-----------: |
@@ -16,7 +16,7 @@ The library version numbers follow the Elasticsearch major versions. The `master
16
16
  | 2.x | → | 2.x |
17
17
  | 5.x | → | 5.x |
18
18
  | 6.x | → | 6.x |
19
- | master | → | 7.x |
19
+ | main | → | 7.x |
20
20
 
21
21
  ## Installation
22
22
 
@@ -116,7 +116,7 @@ See the `Elasticsearch::Model` module documentation for technical information.
116
116
 
117
117
  ### The Elasticsearch client
118
118
 
119
- The module will set up a [client](https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch),
119
+ The module will set up a [client](https://github.com/elastic/elasticsearch-ruby/tree/main/elasticsearch),
120
120
  connected to `localhost:9200`, by default. You can access and use it as any other `Elasticsearch::Client`:
121
121
 
122
122
  ```ruby
@@ -139,7 +139,7 @@ Elasticsearch::Model.client = Elasticsearch::Client.new log: true
139
139
  You might want to do this during your application bootstrap process, e.g. in a Rails initializer.
140
140
 
141
141
  Please refer to the
142
- [`elasticsearch-transport`](https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch-transport)
142
+ [`elasticsearch-transport`](https://github.com/elastic/elasticsearch-ruby/tree/main/elasticsearch-transport)
143
143
  library documentation for all the configuration options, and to the
144
144
  [`elasticsearch-api`](http://rubydoc.info/gems/elasticsearch-api) library documentation
145
145
  for information about the Ruby client API.
@@ -248,7 +248,7 @@ response.records.order(:title).to_a
248
248
  The `records` method returns the real instances of your model, which is useful when you want to access your
249
249
  model methods -- at the expense of slowing down your application, of course.
250
250
  In most cases, working with `results` coming from Elasticsearch is sufficient, and much faster. See the
251
- [`elasticsearch-rails`](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-rails)
251
+ [`elasticsearch-rails`](https://github.com/elastic/elasticsearch-rails/tree/main/elasticsearch-rails)
252
252
  library for more information about compatibility with the Ruby on Rails framework.
253
253
 
254
254
  When you want to access both the database `records` and search `results`, use the `each_with_hit`
@@ -343,7 +343,7 @@ response.results.first.title
343
343
  # => "Quick brown fox"
344
344
  ```
345
345
 
346
- Also, you can use the [**`elasticsearch-dsl`**](https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch-dsl) library, which provides a specialized Ruby API for the Elasticsearch Query DSL:
346
+ Also, you can use the [**`elasticsearch-dsl`**](https://github.com/elastic/elasticsearch-ruby/tree/main/elasticsearch-dsl) library, which provides a specialized Ruby API for the Elasticsearch Query DSL:
347
347
 
348
348
  ```ruby
349
349
  require 'elasticsearch/dsl'
@@ -115,15 +115,18 @@ module Elasticsearch
115
115
  @target = target
116
116
  end
117
117
 
118
- # Delegate methods to `@target`
118
+ def ruby2_keywords(*) # :nodoc:
119
+ end if RUBY_VERSION < "2.7"
120
+
121
+ # Delegate methods to `@target`. As per [the Ruby 3.0 explanation for keyword arguments](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/), the only way to work on Ruby <2.7, and 2.7, and 3.0+ is to use `ruby2_keywords`.
119
122
  #
120
- def method_missing(method_name, *arguments, &block)
123
+ ruby2_keywords def method_missing(method_name, *arguments, &block)
121
124
  target.respond_to?(method_name) ? target.__send__(method_name, *arguments, &block) : super
122
125
  end
123
126
 
124
127
  # Respond to methods from `@target`
125
128
  #
126
- def respond_to?(method_name, include_private = false)
129
+ def respond_to_missing?(method_name, include_private = false)
127
130
  target.respond_to?(method_name) || super
128
131
  end
129
132
 
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module Model
20
- VERSION = "7.2.0"
20
+ VERSION = "7.2.1"
21
21
  end
22
22
  end
@@ -31,6 +31,10 @@ describe Elasticsearch::Model::Proxy do
31
31
  'insta barr'
32
32
  end
33
33
 
34
+ def keyword_method(foo: 'default value')
35
+ foo
36
+ end
37
+
34
38
  def as_json(options)
35
39
  {foo: 'bar'}
36
40
  end
@@ -98,7 +102,6 @@ describe Elasticsearch::Model::Proxy do
98
102
  end
99
103
 
100
104
  context 'when instances are cloned' do
101
-
102
105
  let!(:model) do
103
106
  DummyProxyModel.new
104
107
  end
@@ -121,4 +124,9 @@ describe Elasticsearch::Model::Proxy do
121
124
  expect(duplicate).to eq(duplicate_target)
122
125
  end
123
126
  end
127
+
128
+ it 'forwards keyword arguments to target methods' do
129
+ expect(DummyProxyModel.new.__elasticsearch__.keyword_method(foo: 'bar')).to eq('bar')
130
+ end
131
+
124
132
  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: 7.2.0
4
+ version: 7.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -442,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
442
  - !ruby/object:Gem::Version
443
443
  version: '0'
444
444
  requirements: []
445
- rubygems_version: 3.1.6
445
+ rubygems_version: 3.3.3
446
446
  signing_key:
447
447
  specification_version: 4
448
448
  summary: ActiveModel/Record integrations for Elasticsearch.