Sha256: 6ccfc5002df59f41e88cce293bad63843cfa52d40dff8ed5b3c9c4ffa273a075

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 Bytes

Contents

require 'tap/tasks/dump'

module Tap
  module Tasks
    class Dump
      
      # :startdoc::task inspect and dump an object
      #
      # Dumps objects to a file or IO using object.inspect.  An alternate
      # method can be specified for inspection using the inspect_method
      # config.
      #
      #   % tap load/yaml "{key: value}" -: inspect
      #   {"key"=>"value"}
      #
      class Inspect < Dump
        
        config :inspect_method, 'inspect', :long => :method, :short => :m    # The inspection method
        
        # Dumps the object to io using obj.inspect
        def dump(obj, io)
          io.puts obj.send(inspect_method)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tap-tasks-0.8.0 lib/tap/tasks/dump/inspect.rb
tap-tasks-0.7.0 lib/tap/tasks/dump/inspect.rb