lib/ecoportal/api/graphql/fragment.rb in ecoportal-api-graphql-0.3.7 vs lib/ecoportal/api/graphql/fragment.rb in ecoportal-api-graphql-0.3.8
- old
+ new
@@ -27,15 +27,24 @@
end
def define(sym, heredoc, namespace: ::Fragment)
namespace.send(:remove_const, sym) if namespace.const_defined?(sym)
client.parse(heredoc).tap do |fragment|
- namespace.const_set(sym, fragment)
- ::Fragment.const_set(sym, fragment) unless namespace == ::Fragment
+ without_warnings do
+ namespace.const_set(sym, fragment)
+ ::Fragment.const_set(sym, fragment) unless namespace == ::Fragment
+ end
end
end
private
+
+ def without_warnings
+ original_verbose, $VERBOSE = $VERBOSE, nil
+ yield if block_given?
+ ensure
+ $VERBOSE = original_verbose
+ end
def parse
fragments = self.class.fragments.each_with_object({}) do |(sym, heredoc), out|
out[sym] = define(sym, heredoc, namespace: self.class)
end