Sha256: a8522fbc88956c1f7609e4c3ac7d8152bc82ec5086cd25cf3309d2f2d9213ca3

Contents?: true

Size: 661 Bytes

Versions: 5

Compression:

Stored size: 661 Bytes

Contents

module ToSource
  class Emitter
    # Emitter for singleton class nodes
    class SingletonClass < self

      handle(Rubinius::AST::SClass)

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        emit('class << ')
        visit(node.receiver)
        emit_body
        emit_end
      end

      # Emit body
      #
      # @return [undefined]
      #
      # @api private
      #
      def emit_body
        indented do
          # FIXME: attr_reader missing on Rubinius::AST::SClass
          visit(node.instance_variable_get(:@body))
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
to_source-0.2.20 lib/to_source/emitter/singleton_class.rb
to_source-0.2.19 lib/to_source/emitter/singleton_class.rb
to_source-0.2.18 lib/to_source/emitter/singleton_class.rb
to_source-0.2.17 lib/to_source/emitter/singleton_class.rb
to_source-0.2.16 lib/to_source/emitter/singleton_class.rb