Module: MightyInspect
- Defined in:
- lib/mighty_inspect.rb
Class Method Summary collapse
Class Method Details
.mighty_inspect(obj) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/mighty_inspect.rb', line 6 def self.mighty_inspect(obj) if `obj.$mighty_inspect` && obj.respond_to?(:mighty_inspect) obj.mighty_inspect elsif `obj.$inspect` obj.inspect else "#<JS " + `JSON.stringify(#{obj}) || "undefined"` + ">" end end |
.p(obj) ⇒ Object
2 3 4 |
# File 'lib/mighty_inspect.rb', line 2 def self.p(obj) Kernel.puts mighty_inspect(obj) end |