Module: CatTree::Initializer::ClassMethods

Defined in:
lib/cat_tree/initializer.rb

Constant Summary collapse

@@cat_tree_observer =
{}

Instance Method Summary collapse

Instance Method Details

#add_cat_tree_observer(observer) ⇒ Object



6
7
8
# File 'lib/cat_tree/initializer.rb', line 6

def add_cat_tree_observer(observer)
  @@cat_tree_observer[Thread.current.object_id] = observer
end

#cat_tree_notice(object) ⇒ Object



14
15
16
17
18
# File 'lib/cat_tree/initializer.rb', line 14

def cat_tree_notice(object)
  if cat_tree_observer = @@cat_tree_observer[Thread.current.object_id]
    cat_tree_observer.notice(object)
  end
end

#remove_cat_tree_observerObject



10
11
12
# File 'lib/cat_tree/initializer.rb', line 10

def remove_cat_tree_observer
  @@cat_tree_observer[Thread.current.object_id] = nil
end