lib/pupa/models/model.rb in pupa-0.2.3 vs lib/pupa/models/model.rb in pupa-0.2.4
- old
+ new
@@ -76,17 +76,10 @@
# Sets the class' schema.
#
# @param [Hash,String] value a hash or a relative or absolute path
# @note `JSON::Validator#initialize_schema` runs fastest if given a hash.
def schema=(value)
- self.json_schema = if Hash === value
- value
- elsif Pathname.new(value).absolute?
- JSON.load(File.read(value))
- else
- JSON.load(File.read(File.expand_path(File.join('..', '..', '..', 'schemas', "#{value}.json"), __dir__)))
- end
-
+ self.json_schema = value
self.validator = JSON::Validator.new(self.json_schema, {}, {
clear_cache: false,
parse_data: false,
})
end