Sha256: 013159fe5498a2cb28300ddf93fa46caa60ff460df116106a902ad2201c655e3

Contents?: true

Size: 611 Bytes

Versions: 24

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

module Unparser
  class Emitter
    # Emitter for array patterns
    class ArrayPattern < self

      handle :array_pattern
      handle :array_pattern_with_tail

    private

      def dispatch
        write('[')
        delimited(children, &method(:emit_member))
        write(', ') if node_type.equal?(:array_pattern_with_tail)
        write(']')
      end

      def emit_member(node)
        if n_match_rest?(node)
          writer_with(MatchRest, node).emit_array_pattern
        else
          visit(node)
        end
      end
    end # Pin
  end # Emitter
end # Unparser

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
unparser-0.6.15 lib/unparser/emitter/array_pattern.rb
unparser-0.6.14 lib/unparser/emitter/array_pattern.rb
unparser-0.6.13 lib/unparser/emitter/array_pattern.rb
unparser-0.6.12 lib/unparser/emitter/array_pattern.rb
unparser-0.6.10 lib/unparser/emitter/array_pattern.rb
unparser-0.6.9 lib/unparser/emitter/array_pattern.rb
unparser-0.6.8 lib/unparser/emitter/array_pattern.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/unparser-0.6.7/lib/unparser/emitter/array_pattern.rb
unparser-0.6.7 lib/unparser/emitter/array_pattern.rb
unparser-0.6.6 lib/unparser/emitter/array_pattern.rb
unparser-0.6.5 lib/unparser/emitter/array_pattern.rb
unparser-0.6.4 lib/unparser/emitter/array_pattern.rb
unparser-0.6.3 lib/unparser/emitter/array_pattern.rb
unparser-0.6.2 lib/unparser/emitter/array_pattern.rb
unparser-0.6.1 lib/unparser/emitter/array_pattern.rb
unparser-0.6.0 lib/unparser/emitter/array_pattern.rb
unparser-0.5.7 lib/unparser/emitter/array_pattern.rb
unparser-0.5.6 lib/unparser/emitter/array_pattern.rb
unparser-0.5.5 lib/unparser/emitter/array_pattern.rb
unparser-0.5.4 lib/unparser/emitter/array_pattern.rb