Sha256: 878bac1bcb240915af9c738d022d692fa084b6154573adacfc47549b95552434

Contents?: true

Size: 968 Bytes

Versions: 6

Compression:

Stored size: 968 Bytes

Contents

# encoding: utf-8

module Unparser
  class Emitter

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

      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

6 entries across 6 versions & 1 rubygems

Version Path
unparser-0.2.4 lib/unparser/emitter/match.rb
unparser-0.2.3 lib/unparser/emitter/match.rb
unparser-0.2.2 lib/unparser/emitter/match.rb
unparser-0.2.1 lib/unparser/emitter/match.rb
unparser-0.2.0 lib/unparser/emitter/match.rb
unparser-0.1.16 lib/unparser/emitter/match.rb