module ZendeskAPI::TrackChanges

Shamelessly stolen and modified from github.com/archan937/dirty_hashy @private

Public Class Methods

included(base) click to toggle source
# File lib/zendesk_api/track_changes.rb, line 5
def self.included(base)
  base.method_defined?(:regular_writer).tap do |defined|
    base.send :include, InstanceMethods
    unless defined
      base.send :alias_method, :_store, :store
      base.send :alias_method, :store, :regular_writer
      base.send :alias_method, :[]=, :store
      base.send :define_method, :update do |other|
        other.each { |key, value| store key, value }
      end
      base.send :alias_method, :merge!, :update
    end
  end
end