Class: Scorpio::JSON::ArrayNode

Inherits:
Node
  • Object
show all
Includes:
Arraylike
Defined in:
lib/scorpio/json/node.rb

Constant Summary

Constants included from Arraylike

Arraylike::DESTRUCTIVE_METHODS, Arraylike::SAFE_INDEX_ELEMENT_METHODS, Arraylike::SAFE_INDEX_ONLY_METHODS, Arraylike::SAFE_METHODS

Instance Attribute Summary

Attributes inherited from Node

#document, #path, #pointer

Instance Method Summary collapse

Methods included from Arraylike

#inspect, #pretty_print, #to_s

Methods inherited from Node

#[], #content, #deref, #document_node, #fingerprint, #fragment, #initialize, #inspect, #modified_copy, new_by_type, #object_group_text, #parent_node, #pointer_path, #pretty_print

Methods included from FingerprintHash

#==, #hash

Constructor Details

This class inherits a constructor from Scorpio::JSON::Node

Instance Method Details

#as_jsonObject

needs redefined after including Enumerable



208
209
210
# File 'lib/scorpio/json/node.rb', line 208

def as_json # needs redefined after including Enumerable
  Typelike.as_json(content)
end

#eachObject



196
197
198
199
200
# File 'lib/scorpio/json/node.rb', line 196

def each
  return to_enum(__method__) { content.size } unless block_given?
  content.each_index { |i| yield self[i] }
  self
end

#to_aryObject



202
203
204
# File 'lib/scorpio/json/node.rb', line 202

def to_ary
  to_a
end