Class: Rails::Initializable::Initializer
- Inherits:
 - 
      Object
      
        
- Object
 - Rails::Initializable::Initializer
 
 
- Defined in:
 - lib/rails/initializable.rb
 
Instance Attribute Summary collapse
- 
  
    
      #block  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute block.
 - 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute name.
 
Instance Method Summary collapse
- #after ⇒ Object
 - #before ⇒ Object
 - #belongs_to?(group) ⇒ Boolean
 - #bind(context) ⇒ Object
 - #context_class ⇒ Object
 - 
  
    
      #initialize(name, context, options, &block)  ⇒ Initializer 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Initializer.
 - #run(*args) ⇒ Object
 
Constructor Details
#initialize(name, context, options, &block) ⇒ Initializer
Returns a new instance of Initializer.
      14 15 16 17  | 
    
      # File 'lib/rails/initializable.rb', line 14 def initialize(name, context, , &block) [:group] ||= :default @name, @context, @options, @block = name, context, , block end  | 
  
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
      12 13 14  | 
    
      # File 'lib/rails/initializable.rb', line 12 def block @block end  | 
  
#name ⇒ Object (readonly)
Returns the value of attribute name.
      12 13 14  | 
    
      # File 'lib/rails/initializable.rb', line 12 def name @name end  | 
  
Instance Method Details
#after ⇒ Object
      23 24 25  | 
    
      # File 'lib/rails/initializable.rb', line 23 def after @options[:after] end  | 
  
#before ⇒ Object
      19 20 21  | 
    
      # File 'lib/rails/initializable.rb', line 19 def before @options[:before] end  | 
  
#belongs_to?(group) ⇒ Boolean
      27 28 29  | 
    
      # File 'lib/rails/initializable.rb', line 27 def belongs_to?(group) @options[:group] == group || @options[:group] == :all end  | 
  
#bind(context) ⇒ Object
      35 36 37 38  | 
    
      # File 'lib/rails/initializable.rb', line 35 def bind(context) return self if @context Initializer.new(@name, context, @options, &block) end  | 
  
#context_class ⇒ Object
      40 41 42  | 
    
      # File 'lib/rails/initializable.rb', line 40 def context_class @context.class end  | 
  
#run(*args) ⇒ Object
      31 32 33  | 
    
      # File 'lib/rails/initializable.rb', line 31 def run(*args) @context.instance_exec(*args, &block) end  |