elastic_record 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0b259a896bb4fd66fdaec2488bbaea13d1d8552
4
- data.tar.gz: 222ebe69df2eb9d70d5dbf179eab523828c170d0
3
+ metadata.gz: b6bfba08e1902bc979309fb76e3a65863aac0fcc
4
+ data.tar.gz: a749ec6deb016dab7932bac24e448abd078657e2
5
5
  SHA512:
6
- metadata.gz: 47c2ca1fb2036e21ad964718cdc657073c37fd9536b6f2f142ac5cb973e7fd39f6de2c3344302b327c7ecc4cefe016fa5c24126a5c74a526866d71ecdc44856d
7
- data.tar.gz: 661ebefed3dd61f89ced4efff8f129c13be29a7aec77bb197b1c25057babf3fc223ad45ff43dac7b3aead8c0a6bf61330569885b62e008035218e27ec5a74fd5
6
+ metadata.gz: 34e651e0c1c2f779a16f417f065645bb924e674f5038f9219e368e2d09c6f98a803d4b7d176c1477cec34c61a5bea74feafbc6bbb5dcb8c0fa9b97cb20b898e6
7
+ data.tar.gz: 6870c79bcf0d75bdd0692bea7af511477d3cbe846cec72676db217d89273db6606a112dab00b57b287983a648ba1c95ba824fe27068a4f51b0d0589a8ab6f31c
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '1.1.2'
5
+ s.version = '1.1.3'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -1,28 +1,21 @@
1
+ require 'active_support/core_ext/class/attribute'
2
+
1
3
  module ElasticRecord
2
4
  class Config
3
- class << self
4
- def servers=(value)
5
- @servers = value
6
- end
5
+ class_attribute :servers
7
6
 
8
- def servers
9
- @servers
10
- end
7
+ class_attribute :connection_options
8
+ self.connection_options = {}
11
9
 
12
- def connection_options
13
- @connection_options ||= {}
14
- end
10
+ class_attribute :model_names
11
+ self.model_names = []
15
12
 
16
- def connection_options=(options)
17
- @connection_options = options
18
- end
19
-
20
- def model_names=(names)
21
- @model_names = names
22
- end
13
+ class_attribute :scroll_keep_alive
14
+ self.scroll_keep_alive = '5m'
23
15
 
16
+ class << self
24
17
  def models
25
- @models ||= @model_names.map { |model_name| model_name.constantize }
18
+ @models ||= model_names.map { |model_name| model_name.constantize }
26
19
  end
27
20
  end
28
21
  end
@@ -16,7 +16,7 @@ module ElasticRecord
16
16
  def find_ids_in_batches(options = {}, &block)
17
17
  options.assert_valid_keys(:batch_size, :keep_alive)
18
18
 
19
- scroll_keep_alive = options[:keep_alive] || '5m'
19
+ scroll_keep_alive = options[:keep_alive] || ElasticRecord::Config.scroll_keep_alive
20
20
  size = options[:batch_size] || 100
21
21
 
22
22
  options = {
@@ -1,6 +1,10 @@
1
1
  require 'helper'
2
2
 
3
3
  class ElasticRecord::ConfigTest < MiniTest::Spec
4
+ def test_defaults
5
+ assert_equal '5m', ElasticRecord::Config.scroll_keep_alive
6
+ end
7
+
4
8
  def test_models
5
9
  ElasticRecord::Config.model_names = %w(Widget)
6
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infogroup
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-24 00:00:00.000000000 Z
12
+ date: 2013-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic