Sha256: 233522787bb8ebdd24858a6ed62162c8b55d1e1f3fff7098e390c5553c082e18
Contents?: true
Size: 1.15 KB
Versions: 28
Compression:
Stored size: 1.15 KB
Contents
module Ecoportal module API class Internal class Person def new?(doc = :initial) ref_doc = (doc == :original) ? original_doc : initial_doc !ref_doc["details"] && !ref_doc["account"] end # @return [Boolean] if the account has been added, compared to `doc` def account_added?(doc = :initial) ref_doc = (doc == :original) ? original_doc : initial_doc account && !ref_doc["account"] end # It replaces `doc` by `new_doc` # @return [Hash] `doc` before change def replace_doc!(new_doc) raise UnlinkedModel.new(from: "#{self.class}#replace_doc", key: _key) unless linked? @doc.tap do @doc = new_doc end end # It replaces `original_doc` by `new_doc` # @return [Hash] `original_doc` before change def replace_original_doc!(new_doc) raise UnlinkedModel.new(from: "#{self.class}#replace_original_doc", key: _key) unless linked? @original_doc.tap do @original_doc = new_doc end end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems