module Kernel

Private Instance Methods

PSON(object, opts = {}) click to toggle source

If object is string-like parse the string and return the parsed result as a Ruby data structure. Otherwise generate a PSON text from the Ruby data structure object and return it.

The opts argument is passed through to generate/parse respectively, see generate and parse for their documentation.

# File lib/octocatalog-diff/external/pson/common.rb, line 353
def PSON(object, opts = {})
  if object.respond_to? :to_str
    PSON.parse(object.to_str, opts)
  else
    PSON.generate(object, opts)
  end
end
j(*objs) click to toggle source

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

# File lib/octocatalog-diff/external/pson/common.rb, line 331
def j(*objs)
  objs.each do |obj|
    puts PSON::generate(obj, :allow_nan => true, :max_nesting => false)
  end
  nil
end
jj(*objs) click to toggle source

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

# File lib/octocatalog-diff/external/pson/common.rb, line 340
def jj(*objs)
  objs.each do |obj|
    puts PSON::pretty_generate(obj, :allow_nan => true, :max_nesting => false)
  end
  nil
end