Method: JSON::Ext::Generator::State#configure

Defined in:
lib/json/ext/generator/state.rb

#configure(opts) ⇒ Object Also known as: merge

call-seq: configure(opts)

Configure this State instance with the Hash opts, and return itself.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/json/ext/generator/state.rb', line 35

def configure(opts)
  unless opts.is_a?(Hash)
    if opts.respond_to?(:to_hash)
      opts = opts.to_hash
    elsif opts.respond_to?(:to_h)
      opts = opts.to_h
    else
      raise TypeError, "can't convert #{opts.class} into Hash"
    end
  end
  _configure(opts)
end