CloudSesame 0.2.3 → 0.2.4

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: cad47f21e63d0bbeb0258dbb151d48e0ec5641fa
4
- data.tar.gz: 84db3ca4528fcf0d12f4f434774cc79d8a6c878c
3
+ metadata.gz: ee2f110af5801dc881dfc3066166ad65481bc9db
4
+ data.tar.gz: 981fc6f70346fb0f0cc89842d34c0ab27a0bf918
5
5
  SHA512:
6
- metadata.gz: 3ad6883b3f6132987d65ddfb8134a082e2b605317a7a1ade5f8e7b5512e63e5137668d45985e5e15b2bcfbd84527ee348d8d6d8b9e813ac24f42f4cf684127f7
7
- data.tar.gz: b792c52ccc362256a202fbdf9c151bebd4a21ce8128e9d2efe8d66710e30690c55ef8564aa912848bdad131b8ba8847158e80d2e93672cb4d20ae0d6dbc7d1d5
6
+ metadata.gz: 52fbacfb8507b86e22fb01dd10440249ef38ba4305ce83c2aaa348b5f1d447af093b1f5f0184868e22f07e583f6552108a5792ea749520171def79496380b61a
7
+ data.tar.gz: 082924caf18ca846469bf1e9957a0dbb27b192c2445db8f001724e9137b74cbef7aa323a3ce5def4d4e954f4352c9c099342f1e5e49e792183cafcf2f19b7e97
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- CloudSesame (0.2.3)
4
+ CloudSesame (0.2.4)
5
5
  aws-sdk (~> 2)
6
6
 
7
7
  GEM
data/cloud_sesame.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'CloudSesame'
3
- s.version = '0.2.3'
3
+ s.version = '0.2.4'
4
4
  s.date = '2016-01-14'
5
5
  s.summary = "AWS CloudSearch Query DSL"
6
6
  s.description = "AWS CloudSearch Query DSL"
@@ -4,7 +4,7 @@ module CloudSesame
4
4
  class RangeValue < Value
5
5
 
6
6
  def initialize(range = nil)
7
- @data = range && range.kind_of?(Range) ? [true, to_value(range.begin), to_value(range.end), !range.exclude_end?] : [false, nil, nil, false]
7
+ @data = range.kind_of?(Range) ? [true, valufy(range.begin), valufy(range.end), !range.exclude_end?] : [false, nil, nil, false]
8
8
  end
9
9
 
10
10
  def compile
@@ -18,7 +18,7 @@ module CloudSesame
18
18
  end
19
19
 
20
20
  def ==(value)
21
- data == value || compile == value
21
+ value == data || value == compile
22
22
  end
23
23
 
24
24
  private
@@ -31,10 +31,14 @@ module CloudSesame
31
31
  dsl_scope << node
32
32
  dsl_return node
33
33
  else
34
- AST::BlockChainingRelation.new(dsl_scope, dsl_return, node)
34
+ return_chaining_relation(node)
35
35
  end
36
36
  end
37
37
 
38
+ def return_chaining_relation(node)
39
+ AST::BlockChainingRelation.new(dsl_scope, dsl_return, node)
40
+ end
41
+
38
42
  end
39
43
  end
40
44
  end
@@ -38,13 +38,7 @@ module CloudSesame
38
38
 
39
39
  def insert(values = [])
40
40
  values.each do |value|
41
- child = ensure_not_raw_value value
42
- parents.compact.each do |parent|
43
- node = parent[:klass].new dsl_context, parent[:options]
44
- node << child
45
- child = node
46
- end
47
- dsl_scope << child
41
+ dsl_scope << create_parents(build_literal(value))
48
42
  end
49
43
  parents.clear unless values.empty?
50
44
  dsl_return != dsl_scope ? dsl_return : self
@@ -56,7 +50,16 @@ module CloudSesame
56
50
  values[-1].is_a?(Hash) ? values.delete_at(-1) : {}
57
51
  end
58
52
 
59
- def ensure_not_raw_value(value)
53
+ def create_parents(child)
54
+ parents.compact.each do |parent|
55
+ node = parent[:klass].new dsl_context, parent[:options]
56
+ node << child
57
+ child = node
58
+ end
59
+ child
60
+ end
61
+
62
+ def build_literal(value)
60
63
  if value.kind_of?(AST::SingleExpressionOperator) || value.is_a?(AST::Literal)
61
64
  value.is_for field, field_options
62
65
  value
@@ -11,7 +11,7 @@ module CloudSesame
11
11
 
12
12
  def method_missing(name, *args, &block)
13
13
  if scopes && (callback = scopes[name])
14
- self.instance_exec *args, &callback
14
+ instance_exec *args, &callback
15
15
  dsl_return
16
16
  else
17
17
  super
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CloudSesame
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chu