lib/json_schema/schema.rb in json_schema-0.14.0 vs lib/json_schema/schema.rb in json_schema-0.14.1
- old
+ new
@@ -31,9 +31,17 @@
class_eval("def #{attr} ; !@#{attr}.nil? ? @#{attr} : #{default} ; end")
end
def initialize
@clones = Set.new
+
+ # nil out all our schema fields so that it's possible to instantiate a
+ # schema instance without going through the parser and validate against
+ # it without Ruby throwing warnings about uninitialized instance
+ # variables.
+ @@schema_attrs.each do |_, a|
+ send(:"#{a}=", nil)
+ end
end
# Fragment of a JSON Pointer that can help us build a pointer back to this
# schema for debugging.
attr_accessor :fragment