Sha256: 48ac2da4eb0aae26fe100fcd60a8b68994d8869337507c4e6437fc7a896d6fd2

Contents?: true

Size: 1023 Bytes

Versions: 11

Compression:

Stored size: 1023 Bytes

Contents

# frozen_string_literal: true

module Unparser
  class Emitter
    class Literal

      # Base class for dynamic literal emitters
      class Dynamic < self

      private

        # Perform dispatch
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          util = self.class
          visit_parentheses(dynamic_body, util::OPEN, util::CLOSE)
        end

        # Return dynamic body
        #
        # @return [Parser::AST::Node]
        #
        # @api private
        #
        def dynamic_body
          Parser::AST::Node.new(:dyn_str_body, children)
        end

        # Dynamic string literal emitter
        class String < self

          OPEN = CLOSE = '"'.freeze
          handle :dstr

        end # String

        # Dynamic symbol literal emitter
        class Symbol < self

          OPEN = ':"'.freeze
          CLOSE = '"'.freeze

          handle :dsym

        end # Symbol
      end # Dynamic
    end # Literal
  end # Emitter
end # Unparser

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unparser-0.4.9 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.8 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.7 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.6 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.5 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.4 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.3 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.2 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.1 lib/unparser/emitter/literal/dynamic.rb
unparser-0.4.0 lib/unparser/emitter/literal/dynamic.rb
unparser-0.3.0 lib/unparser/emitter/literal/dynamic.rb