Method: GraphQL::Subscriptions::Serialize.dump_recursive
- Defined in:
- lib/graphql/subscriptions/serialize.rb
.dump_recursive(obj) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is for turning objects into subscription scopes. It's a one-way transformation, can't reload this :'(
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/graphql/subscriptions/serialize.rb', line 34 def dump_recursive(obj) case when obj.is_a?(Array) obj.map { |i| dump_recursive(i) }.join(':') when obj.is_a?(Hash) obj.map { |k, v| "#{dump_recursive(k)}:#{dump_recursive(v)}" }.join(":") when obj.is_a?(GraphQL::Schema::InputObject) dump_recursive(obj.to_h) when obj.respond_to?(:to_gid_param) obj.to_gid_param when obj.respond_to?(:to_param) obj.to_param else obj.to_s end end |