scalastic 0.5.0 → 0.5.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
  SHA1:
3
- metadata.gz: 8c137698c420bc7867a4dbf8caf041372c7c0ba5
4
- data.tar.gz: d1a06b6c6fbf723fe018ba57a450b6cf446d1455
3
+ metadata.gz: db0c2019184cf395101e628c12380028c616cecb
4
+ data.tar.gz: fb827f64ffcc8cb8b9beeef11839fae4eb0537bc
5
5
  SHA512:
6
- metadata.gz: 141ecd5e0ae057f91fb67a374e58dae1a9dee830fc8697560506458ea2aa509b24fac08d34210a7453056a091519aa62cee7b1a0a99b0ac46debe7afd13856d8
7
- data.tar.gz: aee055ffa89bfe275214bae37f02feddb0366dfc17e465fc366723f9095d61d7ae24c5ed19852bb0dcb831261c91ad401736703dc6938b6d34a3ad3ba9683939
6
+ metadata.gz: 916ca019138061d26daf42ac486ee8f346dc16b01c5b869525ad09ec064e88728910e1207b55ebf691ff3d5ef7544c6af4a1bde6f45d681d16a8546e90e93296
7
+ data.tar.gz: 5511b43df76519259a6625a5ca1b8f18562766f83cc0ac9d52c936fdd4e1c54c7495f6a8df87ef468205692689819d90b5ab289c38b7833916e36d5b0cf24832
@@ -3,6 +3,8 @@ require "scalastic/es_actions_generator"
3
3
 
4
4
  module Scalastic
5
5
  class PartitionsClient
6
+ include Enumerable
7
+
6
8
  attr_reader(:es_client)
7
9
  attr_reader(:config)
8
10
 
@@ -37,10 +39,8 @@ module Scalastic
37
39
  Partition.new(es_client, config, id)
38
40
  end
39
41
 
40
- def to_a
41
- aliases = es_client.indices.get_aliases
42
- partition_ids = aliases.map{|_, data| data['aliases'].keys}.flatten.map{|a| config.get_partition_id(a)}.compact.uniq
43
- partition_ids.map{|id| Partition.new(es_client, config, id)}
42
+ def each(&_block)
43
+ partition_ids.each{|pid| yield Partition.new(es_client, config, pid) if block_given?}
44
44
  end
45
45
 
46
46
  def prepare_index(args)
@@ -49,5 +49,12 @@ module Scalastic
49
49
  es_client.indices.put_mapping(index: index, type: '_default_', body: {'_default_' => mapping})
50
50
  es_client.indices.put_mapping(index: index, type: 'scalastic', body: {'scalastic' => mapping})
51
51
  end
52
+
53
+ private
54
+
55
+ def partition_ids
56
+ aliases = es_client.indices.get_aliases
57
+ partition_ids = aliases.map{|_, data| data['aliases'].keys}.flatten.map{|a| config.get_partition_id(a)}.compact.uniq
58
+ end
52
59
  end
53
60
  end
@@ -1,3 +1,3 @@
1
1
  module Scalastic
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksei Baturytski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler