class Schemacop::V3::ObjectNode
Public Class Methods
allowed_options()
click to toggle source
Calls superclass method
Schemacop::V3::Node::allowed_options
# File lib/schemacop/v3/object_node.rb, line 4 def self.allowed_options super + %i[classes strict] end
Public Instance Methods
as_json()
click to toggle source
# File lib/schemacop/v3/object_node.rb, line 8 def as_json {} # Not supported by Json Schema end
Protected Instance Methods
allowed_types()
click to toggle source
# File lib/schemacop/v3/object_node.rb, line 14 def allowed_types Hash[@classes.map { |c| [c, c.name] }] end
init()
click to toggle source
# File lib/schemacop/v3/object_node.rb, line 18 def init @classes = Array(options.delete(:classes) || []) @strict = options.delete(:strict) @strict = true if @strict.nil? end
type_assertion_method()
click to toggle source
# File lib/schemacop/v3/object_node.rb, line 24 def type_assertion_method @strict ? :instance_of? : :is_a? end
validate_self()
click to toggle source
# File lib/schemacop/v3/object_node.rb, line 28 def validate_self unless @strict.is_a?(TrueClass) || @strict.is_a?(FalseClass) fail 'Option "strict" must be a "boolean".' end end