Class: Marshalsea::Psych::Walk
- Inherits:
-
Object
- Object
- Marshalsea::Psych::Walk
- Defined in:
- lib/marshalsea/psych/inspector.rb
Constant Summary collapse
- MAPPING_KEY_STRIDE =
2
Instance Method Summary collapse
- #call(stream) ⇒ Object
-
#initialize(limits) ⇒ Walk
constructor
A new instance of Walk.
Constructor Details
#initialize(limits) ⇒ Walk
Returns a new instance of Walk.
217 218 219 220 221 222 223 |
# File 'lib/marshalsea/psych/inspector.rb', line 217 def initialize(limits) @limits = limits @references = [] @aliases = 0 @nodes = 0 @documents = 0 end |
Instance Method Details
#call(stream) ⇒ Object
225 226 227 228 229 230 231 |
# File 'lib/marshalsea/psych/inspector.rb', line 225 def call(stream) @documents = stream.children.length check(@documents, limits.max_documents, Limits::ROLE_DOCUMENTS) stream.children.each { |child| visit(child, 1, false) } Document.new(references: @references.freeze, alias_count: @aliases, node_count: @nodes, document_count: @documents) end |