Class: Schemacop::ObjectValidator

Inherits:
Node
  • Object
show all
Defined in:
lib/schemacop/validator/object_validator.rb

Instance Attribute Summary

Attributes inherited from Node

#options

Instance Method Summary collapse

Methods inherited from Node

build, class_matches?, clear_klasses, clear_symbols, #exec_block, #initialize, klass, option, #option, #option?, register, #resolve_type_klass, symbol, symbol_matches?, #type_filter_matches?, type_matches?, #validate

Constructor Details

This class inherits a constructor from Schemacop::Node

Instance Method Details

#type_labelObject



7
8
9
# File 'lib/schemacop/validator/object_validator.rb', line 7

def type_label
  "#{super} (#{classes.join(', ')})"
end

#type_matches?(data) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/schemacop/validator/object_validator.rb', line 11

def type_matches?(data)
  super && (classes.empty? || classes.include?(data.class)) && !data.nil?
end