Sha256: 575354d080baa7309b5948493c7564565fba3df8e7965e5a703ec09648570803

Contents?: true

Size: 941 Bytes

Versions: 10

Compression:

Stored size: 941 Bytes

Contents

# encoding: utf-8

module Unparser
  class Emitter

    # Base class for special match node emitters
    class Match < self

      OPERATOR = '=~'.freeze

      # Emitter for match with local variable assignment
      class Lvasgn < self
        handle :match_with_lvasgn

        children :regexp, :lvasgn

      private

        # Perform dispatch
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          visit(regexp)
          write(WS, OPERATOR, WS)
          visit(lvasgn)
        end

      end # Lvasgn

      # Emitter for match current line
      class CurrentLine < self
        handle :match_current_line

        children :regexp

        # Perform dispatch
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          visit(regexp)
        end

      end # CurrentLine

    end # Match
  end # Emitter
end # Unparser

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
unparser-0.1.15 lib/unparser/emitter/match.rb
unparser-0.1.14 lib/unparser/emitter/match.rb
unparser-0.1.13 lib/unparser/emitter/match.rb
unparser-0.1.12 lib/unparser/emitter/match.rb
unparser-0.1.11 lib/unparser/emitter/match.rb
unparser-0.1.10 lib/unparser/emitter/match.rb
unparser-0.1.9 lib/unparser/emitter/match.rb
unparser-0.1.8 lib/unparser/emitter/match.rb
unparser-0.1.7 lib/unparser/emitter/match.rb
unparser-0.1.6 lib/unparser/emitter/match.rb