Sha256: c6bb901b86a5748e71f3c64c42b5bca95686cf8ee990a8b3f3ac4744524a00be

Contents?: true

Size: 983 Bytes

Versions: 5

Compression:

Stored size: 983 Bytes

Contents

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
    end # Literal
  end # Emitter
end # Unparser

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unparser-0.1.5 lib/unparser/emitter/literal/dynamic.rb
unparser-0.1.4 lib/unparser/emitter/literal/dynamic.rb
unparser-0.1.3 lib/unparser/emitter/literal/dynamic.rb
unparser-0.1.2 lib/unparser/emitter/literal/dynamic.rb
unparser-0.1.1 lib/unparser/emitter/literal/dynamic.rb