Sha256: 238f2da209f1ffb16ca78b556ae948b1351b7d7dff9f8bf3bb29ba00dbc6a618

Contents?: true

Size: 1009 Bytes

Versions: 16

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, T_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, T_DLT, WS)
        visit(object)
        emit_body
        k_end
      end

    end # SClass
  end # Emitter
end # Unparser

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
unparser-0.1.1 lib/unparser/emitter/class.rb
unparser-0.1.0 lib/unparser/emitter/class.rb
unparser-0.0.18 lib/unparser/emitter/class.rb
unparser-0.0.16 lib/unparser/emitter/class.rb
unparser-0.0.15 lib/unparser/emitter/class.rb
unparser-0.0.14 lib/unparser/emitter/class.rb
unparser-0.0.13 lib/unparser/emitter/class.rb
unparser-0.0.12 lib/unparser/emitter/class.rb
unparser-0.0.11 lib/unparser/emitter/class.rb
unparser-0.0.10 lib/unparser/emitter/class.rb
unparser-0.0.8 lib/unparser/emitter/class.rb
unparser-0.0.7 lib/unparser/emitter/class.rb
unparser-0.0.6 lib/unparser/emitter/class.rb
unparser-0.0.5 lib/unparser/emitter/class.rb
unparser-0.0.4 lib/unparser/emitter/class.rb
unparser-0.0.3 lib/unparser/emitter/class.rb