graphlyte 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 +4 -4
- data/lib/graphlyte/arguments/set.rb +3 -3
- data/lib/graphlyte/arguments/value.rb +2 -2
- data/lib/graphlyte/query.rb +2 -2
- data/lib/graphlyte/schema/types/base.rb +2 -0
- data/lib/graphlyte/types.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e01c43639c294e8ae4121522a6b0a5e498e69fd9e4f91e9f3e0a3a04753f826
|
4
|
+
data.tar.gz: 985c22c79e96547fdb5da497b52b5c2e8d03621f38253847e57afb932e18c752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d9dc438641a2f9f800eff0ade575f893472bbf96faba57e9d69171efbae8a8bd8caf50bdaeb4d7e71aadc37161c61e55c2385a1da98f04d0b687b20b6d654e
|
7
|
+
data.tar.gz: 671f0580825f19ce0f010926a40a4cdece1ddb408dbda8ec10120c80ad0a2274680fae80085679a1e5f688fc5049e9ad1efae52b21c595ddfa166f2c759fc509
|
@@ -26,15 +26,15 @@ module Graphlyte
|
|
26
26
|
variables
|
27
27
|
end
|
28
28
|
|
29
|
-
def to_h(
|
29
|
+
def to_h(raw = false)
|
30
30
|
return {} unless values && !values.empty?
|
31
31
|
values.inject({}) do |memo, (k, v)|
|
32
32
|
if v.is_a?(Array)
|
33
|
-
memo[k.to_s.to_camel_case] = v.map(
|
33
|
+
memo[k.to_s.to_camel_case] = v.map { |value| value.to_s(raw) }
|
34
34
|
elsif v.is_a?(Set)
|
35
35
|
memo[k.to_s.to_camel_case] = v.to_h
|
36
36
|
else
|
37
|
-
memo[k.to_s.to_camel_case] = v.to_s
|
37
|
+
memo[k.to_s.to_camel_case] = v.to_s(raw)
|
38
38
|
end
|
39
39
|
memo
|
40
40
|
end
|
@@ -19,10 +19,10 @@ module Graphlyte
|
|
19
19
|
value.is_a? Schema::Types::Base
|
20
20
|
end
|
21
21
|
|
22
|
-
def to_s
|
22
|
+
def to_s(raw = false)
|
23
23
|
return "$#{value.to_s.to_camel_case}" if value.is_a? Symbol
|
24
24
|
return value if value.is_a? Numeric
|
25
|
-
return "\"#{value}\"" if value.is_a?
|
25
|
+
return "\"#{value}\"" if value.is_a?(String) && !raw
|
26
26
|
return "null" if value.nil?
|
27
27
|
return "$#{value.placeholder.to_camel_case}" if value.is_a? Schema::Types::Base
|
28
28
|
value.to_s
|
data/lib/graphlyte/query.rb
CHANGED
@@ -43,7 +43,7 @@ module Graphlyte
|
|
43
43
|
end
|
44
44
|
str += "(#{type_new.join(", ")})"
|
45
45
|
end
|
46
|
-
{ query: "#{str} #{to_s(1)}", variables: Arguments::Set.new(hargs).to_h }.to_json
|
46
|
+
{ query: "#{str} #{to_s(1)}", variables: Arguments::Set.new(hargs).to_h(true) }.to_json
|
47
47
|
end
|
48
48
|
|
49
49
|
def to_s(indent=0)
|
@@ -70,7 +70,7 @@ module Graphlyte
|
|
70
70
|
memo
|
71
71
|
end
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def format_fragments
|
75
75
|
str = "\n"
|
76
76
|
flatten(builder.>>).each do |_, fragment|
|
data/lib/graphlyte/types.rb
CHANGED
@@ -2,8 +2,8 @@ require_relative "schema/types/base"
|
|
2
2
|
|
3
3
|
module Graphlyte
|
4
4
|
class Types
|
5
|
-
def method_missing(method, placeholder)
|
6
|
-
Schema::Types::Base.new(method, placeholder)
|
5
|
+
def method_missing(method, placeholder, default = nil)
|
6
|
+
Schema::Types::Base.new(method, placeholder, default)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphlyte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Gregory
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|