Module: Sequel::Plugins::HookClassMethods::ClassMethods
- Defined in:
- lib/sequel/plugins/hook_class_methods.rb
Instance Method Summary collapse
- 
  
    
      #freeze  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Freeze hooks when freezing model class. 
- 
  
    
      #has_hooks?(hook)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns true if there are any hook blocks for the given hook. 
- 
  
    
      #hook_blocks(hook)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Yield every block related to the given hook. 
- 
  
    
      #hook_methods_for(hook)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Yield every method related to the given hook. 
Instance Method Details
#freeze ⇒ Object
Freeze hooks when freezing model class.
| 50 51 52 53 | # File 'lib/sequel/plugins/hook_class_methods.rb', line 50 def freeze @hooks.freeze.each_value(&:freeze) super end | 
#has_hooks?(hook) ⇒ Boolean
Returns true if there are any hook blocks for the given hook.
| 56 57 58 | # File 'lib/sequel/plugins/hook_class_methods.rb', line 56 def has_hooks?(hook) !@hooks[hook].empty? end | 
#hook_blocks(hook) ⇒ Object
Yield every block related to the given hook.
| 61 62 63 64 65 | # File 'lib/sequel/plugins/hook_class_methods.rb', line 61 def hook_blocks(hook) # SEQUEL6: Remove Sequel::Deprecation.deprecate("The hook_blocks class method in the hook_class_methods plugin is deprecated and will be removed in Sequel 6.") @hooks[hook].each{|_,v,_| yield v} end | 
#hook_methods_for(hook) ⇒ Object
Yield every method related to the given hook.
| 68 69 70 | # File 'lib/sequel/plugins/hook_class_methods.rb', line 68 def hook_methods_for(hook) @hooks[hook].each{|_,_,m| yield m} end |