lib/pupa/models/base.rb in pupa-0.0.7 vs lib/pupa/models/base.rb in pupa-0.0.8

- old
+ new

@@ -82,13 +82,13 @@ # @param [Hash,String] value a hash or a relative or absolute path def schema=(value) self.json_schema = if Hash === value value elsif Pathname.new(value).absolute? - value + File.read(value) else - File.expand_path(File.join('..', '..', '..', 'schemas', "#{value}.json"), __dir__) + File.read(File.expand_path(File.join('..', '..', '..', 'schemas', "#{value}.json"), __dir__)) end end end attr_accessor :_id, :_type, :extras @@ -162,10 +162,10 @@ # Validates the object against the schema. # # @raises [JSON::Schema::ValidationError] if the object is invalid def validate! if self.class.json_schema - # JSON::Validator#initialize_data runs fastest if given a hash. + # JSON::Validator#initialize_schema runs fastest if given a hash. JSON::Validator.validate!(self.class.json_schema, stringify_keys(to_h)) end end # Returns the object as a hash.