Module: Kernel

Defined in:
lib/facets/json.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.



660
661
662
663
664
665
# File 'lib/facets/json.rb', line 660

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.



669
670
671
672
673
674
# File 'lib/facets/json.rb', line 669

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