Sha256: 70d9682629507398eb5c7d1f47ff79751aafed6609a2608d2701fbcf04594dec
Contents?: true
Size: 610 Bytes
Versions: 6
Compression:
Stored size: 610 Bytes
Contents
module Schemacop class ObjectValidator < Node register symbols: :object, klasses: BasicObject option :classes option :strict def type_label "#{super} (#{classes.join(', ')})" end def type_matches?(data) if option(:strict).is_a?(FalseClass) sub_or_class = classes.map { |klass| data.class <= klass }.include?(true) super && (classes.empty? || sub_or_class) && !data.nil? else super && (classes.empty? || classes.include?(data.class)) && !data.nil? end end private def classes [*option(:classes)] end end end
Version data entries
6 entries across 6 versions & 1 rubygems