class Fray::Data::Base

Public Class Methods

new(hash) click to toggle source
Calls superclass method
# File lib/fray/data.rb, line 8
def initialize(hash)
  if JSON::Validator.validate(__schema, hash)
    super(JSON.parse(JSON.generate(hash)))
    self.freeze
  else
    e = "#{hash.inspect} failed schema validation:\n\n" +
        JSON::Validator.fully_validate(__schema, hash).join("\n")
    raise ArgumentError, e
  end
end