Sha256: 9cfe5d620d1e91d69695941bab515fc655b88b240b8c88e529781a05a1e65d75

Contents?: true

Size: 1009 Bytes

Versions: 1

Compression:

Stored size: 1009 Bytes

Contents

module Unparser
  class Emitter
    # Emitter for class nodes
    class Class < self

      handle :class

      children :name, :superclass, :body

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        write(K_CLASS, WS)
        visit(name)
        emit_superclass
        emit_body
        k_end
      end

      # Emit superclass
      #
      # @return [undefined]
      #
      # @api private
      #
      def emit_superclass
        return unless superclass
        write(WS, O_LT, WS)
        visit(superclass)
      end

    end # Class

    # Emitter for sclass nodes
    class SClass  < self

      handle :sclass

      children :object, :body

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        write(K_CLASS, WS, O_DLT, WS)
        visit(object)
        emit_body
        k_end
      end

    end # SClass
  end # Emitter
end # Unparser

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unparser-0.0.2 lib/unparser/emitter/class.rb