pragmatic_ql 0.3 → 0.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
  SHA256:
3
- metadata.gz: 715af39de3a12f58db1c9ff9d79a70b39cc852d7afaea345ea30ec992f86160e
4
- data.tar.gz: fb7b868bbbe996baaccb89776a5223ee3e47f21dfe0bd7d83c4ee36c3fc1f5ac
3
+ metadata.gz: 9345924c9ae9c102ddd123ccbffae9cbd86dbeec75a9e6bbbb7b49f16ce8028b
4
+ data.tar.gz: 76767192f2d2c0e2a46e534bee12aaba99f064fe0366dc1599a4ef9f7588aba6
5
5
  SHA512:
6
- metadata.gz: 72c1f6b0e6e9b568c276178aa3e675ee96167d4a7d135223b2df17ac25b0cb28ab2647b4715eb7c61d6dd4779ac66eae86c98947e318603b18c5f061a05cb889
7
- data.tar.gz: 06b266317e9d5b6dfe1aaa996483c8402a40596d4a693ee3dee111964b84d6cda204fddd1bfaee704162d44eff2d385905d019f53ee599b48a9b485760bd0b70
6
+ metadata.gz: 351cb3fd023787cd8621c98e6ea4ad7b78560f5534a059d709bc20c30a72e720e83971a8e11f5ab75a8a08e2567a0bfc8e38daee6a2ff0302bac576fd5e18337
7
+ data.tar.gz: 1f1a90a241d14bdbe7edf3d5068ec0a64425b221a9d947cfa199a5f63538cf14c4bde67f6caf369eb0af038c996dfa62f96e86fac5e609e3b88ad8dfc3157f1a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pragmatic_ql (0.2)
4
+ pragmatic_ql (0.3)
5
5
  activesupport (> 4)
6
6
 
7
7
  GEM
@@ -46,4 +46,4 @@ DEPENDENCIES
46
46
  rspec (~> 3.0)
47
47
 
48
48
  BUNDLED WITH
49
- 2.2.17
49
+ 2.3.0
@@ -38,6 +38,16 @@ module PragmaticQL
38
38
  "<#IncludeModel #{@include_hash.inspect}>"
39
39
  end
40
40
 
41
+ def to_h
42
+ @include_hash
43
+ end
44
+
45
+ def to_s
46
+ ary = []
47
+ build_include_string(@include_hash, nil, ary)
48
+ ary.join(',')
49
+ end
50
+
41
51
  def or(other)
42
52
  hooks.each { |hook| hook.or(other) }
43
53
  self.empty? ? other : self
@@ -46,5 +56,17 @@ module PragmaticQL
46
56
  def level_keys
47
57
  @include_hash.keys
48
58
  end
59
+
60
+ private
61
+ def build_include_string(node, key, ary)
62
+ node.each do |k, v|
63
+ new_key = [key, k.to_s].compact.join('.')
64
+ if v.any?
65
+ build_include_string(v, new_key, ary)
66
+ else
67
+ ary << new_key
68
+ end
69
+ end
70
+ end
49
71
  end
50
72
  end
@@ -1,3 +1,3 @@
1
1
  module PragmaticQL
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragmatic_ql
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Valent
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2022-01-14 00:00:00.000000000 Z
16
+ date: 2022-01-17 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activesupport