Module: ZendeskAPI::TrackChanges

Included in:
Trackie
Defined in:
lib/zendesk_api/track_changes.rb

Overview

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

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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