Module: JSON

Defined in:
lib/dnapi/extensions.rb

Class Method Summary collapse

Class Method Details

.jexp(*a) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/dnapi/extensions.rb', line 20

def self.jexp(*a)
  if a.size == 1 && RUBY_VERSION >= "1.9.0"
    o = a.first
    o.respond_to?(:to_jexp) ? o.to_jexp : JSON.parse(JSON.dump([o])).first
  else
    return *a.map{|o| o.respond_to?(:to_jexp) ? o.to_jexp : JSON.parse(JSON.dump([o])).first}
  end
end