lib/openapi3_parser/node/array.rb in openapi3_parser-0.5.2 vs lib/openapi3_parser/node/array.rb in openapi3_parser-0.6.0

- old
+ new

@@ -12,21 +12,29 @@ # the document hierachy. class Array extend Forwardable include Enumerable - def_delegators :node_data, :each, :[], :empty? + def_delegators :node_data, :empty? attr_reader :node_data, :node_context # @param [::Array] data data used to populate this node # @param [Context] context The context of this node in the document def initialize(data, context) @node_data = data @node_context = context end + def [](index) + Placeholder.resolve(node_data[index]) + end + + def each + node_data.each_index { |index| yield(self[index]) } + end + # Used to access a node relative to this node - # @param [Context::Pointer, ::Array, ::String] pointer_like + # @param [Source::Pointer, ::Array, ::String] pointer_like # @return anything def node_at(pointer_like) current_pointer = node_context.document_location.pointer node_context.document.node_at(pointer_like, current_pointer) end