Sha256: 68ee1c4d3b32187c80c9d03773528757d4de3d00041986bfb9e19b7eac2883f1

Contents?: true

Size: 570 Bytes

Versions: 9

Compression:

Stored size: 570 Bytes

Contents

require 'date'

class Object
  def mocha_inspect
    inspect =~ /#</ ? "#<#{self.class}: #{self.object_id}>" : inspect
  end
end

class String
  def mocha_inspect
    inspect.gsub(/\"/, "'")
  end
end

class Array
  def mocha_inspect
    "[#{collect { |member| member.mocha_inspect }.join(', ')}]"
  end
end

class Hash
  def mocha_inspect
    "{#{collect { |key, value| "#{key.mocha_inspect} => #{value.mocha_inspect}" }.join(', ')}}"
  end
end

class Time
  def mocha_inspect
    "#{inspect} (#{to_f} secs)"
  end
end

class Date
  def mocha_inspect
    to_s
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mocha-0.3.1 lib/mocha/inspect.rb
mocha-0.3.3 lib/mocha/inspect.rb
mocha-0.1 lib/mocha/inspect.rb
mocha-0.1.2 lib/mocha/inspect.rb
mocha-0.3.2 lib/mocha/inspect.rb
mocha-0.1.1 lib/mocha/inspect.rb
mocha-0.2.0 lib/mocha/inspect.rb
mocha-0.2.1 lib/mocha/inspect.rb
mocha-0.3.0 lib/mocha/inspect.rb