lib/ecoportal/api/common/base_model.rb in ecoportal-api-0.1.12 vs lib/ecoportal/api/common/base_model.rb in ecoportal-api-0.2.0

- old
+ new

@@ -6,9 +6,15 @@ def initialize(doc = {}) @doc = doc @original_doc = JSON.parse(doc.to_json) end + def self.build(doc = {}) + new(doc).tap do |instance| + instance.instance_variable_set("@original_doc", {}) + end + end + def print puts JSON.pretty_generate(as_json) self end