Module: Kernel

Defined in:
lib/extensions/kernel.rb

Instance Method Summary collapse

Instance Method Details

#j(*objs) ⇒ Object

Outputs objs to STDOUT as JSON strings in the shortest form, that is in one line.



4
5
6
7
8
9
# File 'lib/extensions/kernel.rb', line 4

def j(*objs)
  objs.each do |obj|
    puts JSON::unparse(obj)
  end
  nil
end

#jj(*objs) ⇒ Object

Ouputs objs to STDOUT as JSON strings in a pretty format, with indentation and over many lines.



13
14
15
16
17
18
# File 'lib/extensions/kernel.rb', line 13

def jj(*objs)
  objs.each do |obj|
    puts JSON::pretty_unparse(obj)
  end
  nil
end