Module: Shattered::Unload

Defined in:
lib/shattered_support/unload.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#on_unload(&block) ⇒ Object

Add a block to call on unload.



4
5
6
7
# File 'lib/shattered_support/unload.rb', line 4

def on_unload(&block)
  @on_unload ||= []
  @on_unload << block
end

#unloadObject

Unload the object by calling all the unload blocks.



10
11
12
13
14
15
16
# File 'lib/shattered_support/unload.rb', line 10

def unload
  if(@on_unload)
    @on_unload.reverse.each do |onload_method|
      onload_method.call
    end
  end
end