Sha256: b03e998bc5c1e69c5e7f0373d741e2421c23f09aba8600627c0c8a2c2a016f41

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

module RubyNext
  module Language
    module Rewriters
      class MethodReference < Base
        SYNTAX_PROBE = "Language.:transform"
        MIN_SUPPORTED_VERSION = Gem::Version.new("2.7.0")

        def on_meth_ref(node)
          context.track! self

          receiver, mid = *node.children

          replace(
            node.children.first.loc.expression.end.join(
              node.loc.expression.end
            ),
            ".method(:#{mid})"
          )

          node.updated(
            :send,
            [
              receiver,
              :method,
              s(:sym, mid)
            ]
          )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-next-core-0.9.1 lib/ruby-next/language/rewriters/method_reference.rb
ruby-next-core-0.9.0 lib/ruby-next/language/rewriters/method_reference.rb
ruby-next-core-0.9.0.pre lib/ruby-next/language/rewriters/method_reference.rb
ruby-next-core-0.8.0 lib/ruby-next/language/rewriters/method_reference.rb
ruby-next-core-0.7.0 lib/ruby-next/language/rewriters/method_reference.rb