Method: JSI::Base::HashNode#each
- Defined in:
- lib/jsi/base/node.rb
#each(**kw) {|Object, Object| ... } ⇒ self, Enumerator
yields each Hash key (JSON object property name) and value of this node.
each yielded key is a key of the instance hash, and each yielded value is the result of JSI::Base#[].
74 75 76 77 78 79 80 81 82 |
# File 'lib/jsi/base/node.rb', line 74 def each(**kw, &block) return to_enum(__method__, **kw) { jsi_node_content_hash_pubsend(:size) } unless block if block.arity > 1 jsi_node_content_hash_pubsend(:each_key) { |k| yield k, self[k, **kw] } else jsi_node_content_hash_pubsend(:each_key) { |k| yield [k, self[k, **kw]] } end self end |