Sha256: 2708d2d80850361d21e50b9c54050d12552550ebbca28a22fde92deb3a131d85

Contents?: true

Size: 540 Bytes

Versions: 15

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module Unparser
  module Writer
    class Send
      # Writer for unary sends
      class Unary < self
        MAP = {
          '-@': '-',
          '+@': '+'
        }.freeze

        private_constant(*constants(false))

        def dispatch
          name = selector

          write(MAP.fetch(name, name).to_s)

          if n_int?(receiver) && selector.equal?(:+@)
            write('+')
          end

          visit(receiver)
        end
      end # Unary
    end # Send
  end # Writer
end # Unparser

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
unparser-0.6.15 lib/unparser/writer/send/unary.rb
unparser-0.6.14 lib/unparser/writer/send/unary.rb
unparser-0.6.13 lib/unparser/writer/send/unary.rb
unparser-0.6.12 lib/unparser/writer/send/unary.rb
unparser-0.6.10 lib/unparser/writer/send/unary.rb
unparser-0.6.9 lib/unparser/writer/send/unary.rb
unparser-0.6.8 lib/unparser/writer/send/unary.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/unparser-0.6.7/lib/unparser/writer/send/unary.rb
unparser-0.6.7 lib/unparser/writer/send/unary.rb
unparser-0.6.6 lib/unparser/writer/send/unary.rb
unparser-0.6.5 lib/unparser/writer/send/unary.rb
unparser-0.6.4 lib/unparser/writer/send/unary.rb
unparser-0.6.3 lib/unparser/writer/send/unary.rb
unparser-0.6.2 lib/unparser/writer/send/unary.rb
unparser-0.6.1 lib/unparser/writer/send/unary.rb