Conditions | 5 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
1 | require 'jsondoc' |
||
8 | attr_accessor :doc |
||
9 | def initialize(data={}, opts={}) |
||
10 | if data.is_a? JsonDoc::Document |
||
11 | @doc = data |
||
12 | elsif data.is_a? Hash |
||
13 | data = _symbolize_keys data |
||
14 | @doc = JsonDoc::Document.new(data,false, false, false) |
||
15 | elsif opts.key?(:force) && opts[:force] |
||
16 | @doc = JsonDoc::Document.new({}, false, false, false) |
||
17 | else |
||
18 | raise 'initialize needs JsonDoc::Document or Hash argument' |
||
19 | end |
||
20 | end |
||
60 |