Sha256: 29f922c169eaad43d36b632c60142f3cb41f8afc5884f4135c4e0a7656e241a4

Contents?: true

Size: 579 Bytes

Versions: 10

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module Unparser
  class Emitter
    # Emitter for in pattern nodes
    class MatchPattern < self

      handle :match_pattern

      children :target, :pattern

      # Modern ast format emits `match_pattern`
      # node on single line pre 3.0, but 3.0+ uses `match_pattern_p`
      SYMBOL =
        if RUBY_VERSION < '3.0'
          ' in '
        else
          ' => '
        end

    private

      def dispatch
        visit(target)
        write(SYMBOL)
        visit(pattern)
      end
    end # MatchPattern
  end # Emitter
end # Unparser

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
unparser-0.6.13 lib/unparser/emitter/match_pattern.rb
unparser-0.6.12 lib/unparser/emitter/match_pattern.rb
unparser-0.6.10 lib/unparser/emitter/match_pattern.rb
unparser-0.6.9 lib/unparser/emitter/match_pattern.rb
unparser-0.6.8 lib/unparser/emitter/match_pattern.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/unparser-0.6.7/lib/unparser/emitter/match_pattern.rb
unparser-0.6.7 lib/unparser/emitter/match_pattern.rb
unparser-0.6.6 lib/unparser/emitter/match_pattern.rb
unparser-0.6.5 lib/unparser/emitter/match_pattern.rb
unparser-0.6.4 lib/unparser/emitter/match_pattern.rb