ruby-montage 0.4.2 → 0.4.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: decd9cc4e67b76eee7421a652d5e706c3b22d020
4
- data.tar.gz: d709bf40de4d8db85a47c32b1f879c69c657f65d
3
+ metadata.gz: ff94ccc5900983ed4a32427891dfa8ee6101e0b4
4
+ data.tar.gz: 1abfb57b4be19e851eadb4b2d7fb85df3928ca5c
5
5
  SHA512:
6
- metadata.gz: db6e762a2f195f7e89121412d57bc580a3da0a12a1067f88ce232693699e9e7396ee40b5196b10302d1499816ea443d7fc64a088ba544cdc3f15971183e6af04
7
- data.tar.gz: d745d68b4d24937e52cd7d7e4fc67e9c9a3ad576f42ec70e0b7ec29ab41f2bd001646eee763085fdff1fb3955348efc0b1a5a3c7c5605e6c58adf2960b64a6f7
6
+ metadata.gz: a5f82b3395d986f92a1cdf2184bebf63baa88a220f0f8359052bdc243b3deabcec553c0486b847a7cd8a8062908838adc0b22832d4413f423b4e3df4e55707b6
7
+ data.tar.gz: 16f1f2cf70b1fe1ed8b9014e910ef35c51746d11830cc4c29a0481a3571e0b25a6bfa7c38be62c63686b4d435992e498798bd80bd3b29d29710b1cac032c38f8
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  .env
12
12
  tmp.json
13
13
  ruby-montage-*.gem
14
+ /build
data/README.md CHANGED
@@ -91,6 +91,7 @@ All API actions are available as methods on the client object. The following met
91
91
  | not in | __notin |
92
92
  | like | __contains |
93
93
  | ilike | __icontains |
94
+ | includes | __includes |
94
95
 
95
96
 
96
97
  ## The Query Object
@@ -9,6 +9,7 @@ require 'montage/operators/ilike'
9
9
  require 'montage/operators/like'
10
10
  require 'montage/operators/in'
11
11
  require 'montage/operators/nil'
12
+ require 'montage/operators/includes'
12
13
 
13
14
  module Montage
14
15
  module Operators
@@ -24,6 +25,7 @@ module Montage
24
25
  Montage::Operators::In,
25
26
  Montage::Operators::Ilike,
26
27
  Montage::Operators::Like,
28
+ Montage::Operators::Includes
27
29
  ]
28
30
  end
29
31
 
@@ -10,7 +10,7 @@ module Montage
10
10
  end
11
11
 
12
12
  def self.==(value)
13
- value =~ /in/i && !value.downcase.include?("not")
13
+ value =~ /\bin\b(?=([^']*'[^']*')*[^']*$)/i && !value.downcase.include?("not")
14
14
  end
15
15
  end
16
16
  end
@@ -0,0 +1,17 @@
1
+ module Montage
2
+ module Operators
3
+ class Includes
4
+ def self.operator
5
+ "includes"
6
+ end
7
+
8
+ def self.montage_operator
9
+ "__includes"
10
+ end
11
+
12
+ def self.==(value)
13
+ value =~ /\bincludes\b(?=([^']*'[^']*')*[^']*$)/i
14
+ end
15
+ end
16
+ end
17
+ end
@@ -41,14 +41,18 @@ module Montage
41
41
  # Parse a single portion of the query string
42
42
  #
43
43
  def parse_part(part)
44
- if is_i?(part)
45
- part.to_i
46
- elsif is_f?(part)
47
- part.to_f
48
- elsif part =~ /\(.*\)/
49
- to_array(part)
44
+ parsed_part = JSON.parse(part) rescue part
45
+
46
+ if is_i?(parsed_part)
47
+ parsed_part.to_i
48
+ elsif is_f?(parsed_part)
49
+ parsed_part.to_f
50
+ elsif parsed_part =~ /\(.*\)/
51
+ to_array(parsed_part)
52
+ elsif parsed_part.is_a?(Array)
53
+ parsed_part
50
54
  else
51
- part.gsub(/('|')/, "")
55
+ parsed_part.gsub(/('|')/, "")
52
56
  end
53
57
  end
54
58
 
@@ -1,3 +1,3 @@
1
1
  module Montage
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-montage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dphaener
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -205,6 +205,7 @@ files:
205
205
  - lib/montage/operators/gte.rb
206
206
  - lib/montage/operators/ilike.rb
207
207
  - lib/montage/operators/in.rb
208
+ - lib/montage/operators/includes.rb
208
209
  - lib/montage/operators/like.rb
209
210
  - lib/montage/operators/lt.rb
210
211
  - lib/montage/operators/lte.rb