Sha256: 5166b103223e532a9b8da952e4b5999a882f48f2ee2ed51b86ad66ad91932146

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

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

      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, T_LT, WS)
        visit(superclass)
      end

    end # Class

    # Emitter for sclass nodes
    class SClass  < self

      handle :sclass

      children :object, :body

    private

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

    end # SClass
  end # Emitter
end # Unparser

Version data entries

8 entries across 8 versions & 1 rubygems

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