Class: CyclicValueValidation

Inherits:
Validation show all
Defined in:
lib/json_patterns.rb

Constant Summary collapse

@@references =
{}
@@count =
0

Constants included from Inspectable

Inspectable::INSPECTING_KEY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Validation

#as_object_members, #expects_an_object?, memoized_new_from_pattern, new_from_pattern, #validate_from_root

Methods included from DeepEquality

#==

Methods included from Inspectable

#inspect

Constructor Details

#initialize(opts) ⇒ CyclicValueValidation

Returns a new instance of CyclicValueValidation.



890
891
892
893
894
# File 'lib/json_patterns.rb', line 890

def initialize(opts)
  super(opts)
  @@count += 1
  @@references[self] = @@count
end

Instance Attribute Details

#interiorObject

Returns the value of attribute interior.



886
887
888
# File 'lib/json_patterns.rb', line 886

def interior
  @interior
end

Instance Method Details

#shallow_describeObject



904
905
906
# File 'lib/json_patterns.rb', line 904

def shallow_describe
  interior.shallow_describe
end

#shallow_match?(data) ⇒ Boolean

Returns:



900
901
902
# File 'lib/json_patterns.rb', line 900

def shallow_match?(data)
  interior.shallow_match?(data)
end

#to_sObject



908
909
910
911
912
# File 'lib/json_patterns.rb', line 908

def to_s
  # TODO: Use a dynamically scoped variable to distinguish the first printing of this value

  "&#{@@references[self]}"
end

#validate(path, data) ⇒ Object



896
897
898
# File 'lib/json_patterns.rb', line 896

def validate(path, data)
  interior.validate(path, data)
end