Sha256: 959d7458c5178094ebc59d5d8c8ad71c33d247953343dd800ae7d4da6878082c

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

module Unparser
  class Emitter
    class Literal

      # Base class for primitive emitters
      class Primitive < self

        children :value

      private

        # Dispatch node
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          if node.location
            emit_source_map
          else
            dispatch_value
          end
        end

        abstract_method :disaptch_value

        # Emitter for primitives based on Object#inspect
        class Inspect < self

          handle :int, :str, :float, :sym

        private

          # Dispatch value
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch_value
            buffer.append(value.inspect)
          end

        end # Inspect
      end # Primitive
    end # Literal
  end # Emitter
end # Unparser

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unparser-0.0.5 lib/unparser/emitter/literal/primitive.rb
unparser-0.0.4 lib/unparser/emitter/literal/primitive.rb
unparser-0.0.3 lib/unparser/emitter/literal/primitive.rb
unparser-0.0.2 lib/unparser/emitter/literal/primitive.rb
unparser-0.0.1 lib/unparser/emitter/literal/primitive.rb