Sha256: 25fae520850a25c8336fb5bf5bbeaa780e9dfa2198bb84a8f03d38556085435e

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

module ATP
  module Processors
    # Makes the AST safe for Marshaling
    class Marshal < Processor
      def on_object(node)
        if node.value.is_a?(String) || node.value.is_a?(Hash)
          node.updated(nil, [{ 'Test' => node.value }])
        elsif node.value.respond_to?(:to_meta)
          node.updated(nil, [node.value.to_meta])
        else
          node.updated(nil, [{ 'Test' => node.value.name }])
        end
      end

      def on_render(node)
        node.updated(nil, [node.value.to_s])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atp-0.4.2 lib/atp/processors/marshal.rb
atp-0.4.1 lib/atp/processors/marshal.rb