Sha256: cc14e98f2520f74b0f33ceaa2a47b1052bd6940119ec9f74eb57ce960423f271
Contents?: true
Size: 580 Bytes
Versions: 3
Compression:
Stored size: 580 Bytes
Contents
module JMESPath # @api private module Nodes class Flatten < Node def initialize(child) @child = child end def visit(value) value = @child.visit(value) if value.respond_to?(:to_ary) value.to_ary.each_with_object([]) do |v, values| if v.respond_to?(:to_ary) values.concat(v.to_ary) else values.push(v) end end else nil end end def optimize self.class.new(@child.optimize) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jmespath-1.6.1 | lib/jmespath/nodes/flatten.rb |
jmespath-1.6.0 | lib/jmespath/nodes/flatten.rb |
jmespath-1.5.0 | lib/jmespath/nodes/flatten.rb |