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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4993b6b7dba33932ac40eff10ac57644a120ee41d23df9408d70ea3c5fe12aec
4
- data.tar.gz: f7fba13051b20ad335936347753ec3507b113852bcbdd4c5ad62ac3b127496ec
3
+ metadata.gz: 5e01c43639c294e8ae4121522a6b0a5e498e69fd9e4f91e9f3e0a3a04753f826
4
+ data.tar.gz: 985c22c79e96547fdb5da497b52b5c2e8d03621f38253847e57afb932e18c752
5
5
  SHA512:
6
- metadata.gz: 3bab812cb94fd2abeb816180683297c4c95f1486368a5f3029a9917fcf4dcf505d8b6c82777ef4574f550fdc8cd6f0878a92bebcbeb09702b3d832f664e4a0fa
7
- data.tar.gz: cbbfbbff19e0f789d09b01e8581ded8892601b85710b9c9a84ffcc9e393c1ef69aa27c094deb2a81a23078614982519d6ee0f8047ff63d3f1991fddab764a39f
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(inner = false)
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(&:to_s)
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? String
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
@@ -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|
@@ -27,6 +27,8 @@ module Graphlyte
27
27
  str << ", " if idx < (value.size - 1)
28
28
  end
29
29
  str << "]"
30
+ elsif value.is_a?(Symbol)
31
+ str << value.to_s
30
32
  else
31
33
  str << "#{Arguments::Value.new(value).to_s}"
32
34
  end
@@ -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.3
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: 2021-12-12 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec