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/puppet/external/pson/common.rb 357 def PSON(object, opts = {}) 358 if object.respond_to? :to_str 359 PSON.parse(object.to_str, opts) 360 else 361 PSON.generate(object, opts) 362 end 363 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/puppet/external/pson/common.rb 335 def j(*objs) 336 objs.each do |obj| 337 puts PSON::generate(obj, :allow_nan => true, :max_nesting => false) 338 end 339 nil 340 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/puppet/external/pson/common.rb 344 def jj(*objs) 345 objs.each do |obj| 346 puts PSON::pretty_generate(obj, :allow_nan => true, :max_nesting => false) 347 end 348 nil 349 end