Class: DocsKit::OpenApi::Schema::Cursor

Inherits:
Data
  • Object
show all
Defined in:
lib/docs_kit/open_api/schema.rb

Overview

The recursion state threaded through property flattening: the dotted-name prefix, the current depth, and the $ref chain seen so far (for cycles).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth

Returns:

  • (Object)

    the current value of depth



36
37
38
# File 'lib/docs_kit/open_api/schema.rb', line 36

def depth
  @depth
end

#prefixObject (readonly)

Returns the value of attribute prefix

Returns:

  • (Object)

    the current value of prefix



36
37
38
# File 'lib/docs_kit/open_api/schema.rb', line 36

def prefix
  @prefix
end

#seenObject (readonly)

Returns the value of attribute seen

Returns:

  • (Object)

    the current value of seen



36
37
38
# File 'lib/docs_kit/open_api/schema.rb', line 36

def seen
  @seen
end

Class Method Details

.rootObject



37
# File 'lib/docs_kit/open_api/schema.rb', line 37

def self.root = new(prefix: "", depth: 0, seen: [])

Instance Method Details

#descend(name, ref) ⇒ Object



38
# File 'lib/docs_kit/open_api/schema.rb', line 38

def descend(name, ref) = self.class.new(prefix: name, depth: depth + 1, seen: seen + [ref].compact)

#dotted(name) ⇒ Object



39
# File 'lib/docs_kit/open_api/schema.rb', line 39

def dotted(name) = prefix.empty? ? name : "#{prefix}.#{name}"