Sha256: 53a887299736a216e35bc318953d9e89909f8e4d4c93a269721a3f9ba1386fe7

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

require 'chef/mash'

class NotifyMash < BasicObject

  def initialize(*args)
    @notifications = []
    @mash = ::Mash.new(*args)
  end

  def add_notification(&block)
    @notifications << block
  end

  def method_missing(sym, *args)
    start_state = @mash.hash
    result = @mash.send(sym, *args)
    if(start_state != @mash.hash)
      @notifications.each do |notify|
        notify.call(self)
      end
    end
    result
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagabond-0.2.10 lib/vagabond/notify_mash.rb