Sha256: 1cda36714a2c9a81dd4b1b6ce457f397d3196e9b9c96d6031c47f1e10e2e5645

Contents?: true

Size: 544 Bytes

Versions: 18

Compression:

Stored size: 544 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 Array === value
          value.each_with_object([]) do |v, values|
            if Array === v
              values.concat(v)
            else
              values.push(v)
            end
          end
        else
          nil
        end
      end

      def optimize
        self.class.new(@child.optimize)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
jmespath-1.4.0 lib/jmespath/nodes/flatten.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/jmespath-1.3.1/lib/jmespath/nodes/flatten.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/jmespath-1.3.1/lib/jmespath/nodes/flatten.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/jmespath-1.3.1/lib/jmespath/nodes/flatten.rb
jmespath-1.3.1 lib/jmespath/nodes/flatten.rb
jmespath-1.3.0 lib/jmespath/nodes/flatten.rb
jmespath-1.2.4 lib/jmespath/nodes/flatten.rb
jmespath-1.2.3 lib/jmespath/nodes/flatten.rb
jmespath-1.2.2 lib/jmespath/nodes/flatten.rb
jmespath-1.2.1 lib/jmespath/nodes/flatten.rb
jmespath-1.2 lib/jmespath/nodes/flatten.rb
burtpath-1.1.2 lib/jmespath/nodes/flatten.rb
burtpath-1.1.1 lib/jmespath/nodes/flatten.rb
jmespath-1.1.3 lib/jmespath/nodes/flatten.rb
jmespath-1.1.2 lib/jmespath/nodes/flatten.rb
jmespath-1.1.1 lib/jmespath/nodes/flatten.rb
jmespath-1.1.0 lib/jmespath/nodes/flatten.rb
burtpath-1.1.0 lib/jmespath/nodes/flatten.rb