Module: JSON

Defined in:
lib/usamin/overwrite.rb

Class Method Summary collapse

Class Method Details

.generate(object, **options) ⇒ Object Also known as: fast_generate


4
5
6
# File 'lib/usamin/overwrite.rb', line 4

def self.generate(object, **options)
    options[:indent] ? Usamin.pretty_generate(object, indent: options[:indent]) : Usamin.generate(object)
end

.load(source, proc = nil, **options) ⇒ Object Also known as: restore


16
17
18
19
20
# File 'lib/usamin/overwrite.rb', line 16

def self.load(source, proc = nil, **options)
    ret = Usamin.parse(object)
    proc.call(ret) if proc
    ret
end

.parse(source, **options) ⇒ Object


12
13
14
# File 'lib/usamin/overwrite.rb', line 12

def self.parse(source, **options)
    Usamin.parse(object)
end

.pretty_generate(object, **options) ⇒ Object


8
9
10
# File 'lib/usamin/overwrite.rb', line 8

def self.pretty_generate(object, **options)
    options[:indent] ? Usamin.pretty_generate(object, indent: options[:indent]) : Usamin.pretty_generate(object)
end