Sha256: 939acb83132c5fe0e3f93e53d038da46121d34373de75bb01cc7fc6308bdb006

Contents?: true

Size: 560 Bytes

Versions: 46

Compression:

Stored size: 560 Bytes

Contents

# frozen_string_literal: true

class ReeDao::ExtractChanges
  include Ree::FnDSL

  fn :extract_changes do
    link :dao_cache, as: :__ree_dao_cache
  end

  contract(Symbol, Any, Hash => Hash)
  def call(table_name, primary_key, hash)
    cached = __ree_dao_cache.get(table_name, primary_key)
    return hash unless cached
    changes = {}

    hash.each do |column, value|
      previous_column_value = cached[column]

      if cached.has_key?(column) && previous_column_value != value
        changes[column] = value
      end
    end

    changes
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
ree_lib-1.0.88 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.87 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.86 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.85 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.84 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.83 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.82 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.81 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.80 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.79 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.78 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.77 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.76 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.75 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.74 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.73 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.72 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.71 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.70 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb
ree_lib-1.0.69 lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb