class Rails::Initializable::Initializer
Attributes
[R] | after |
|
[R] | before |
|
[R] | block |
|
[R] | name |
Public class methods
Source code GitHub
# File railties/lib/rails/initializable.rb, line 15
def initialize(name, context, before:, after:, group: nil, &block)
@group = group || :default
@name, @before, @after, @context, @block = name, before, after, context, block
end
Public instance methods
Source code GitHub
# File railties/lib/rails/initializable.rb, line 20
def belongs_to?(group)
@group == group || @group == :all
end
Source code GitHub
# File railties/lib/rails/initializable.rb, line 28
def bind(context)
return self if @context
Initializer.new(@name, context, before:, after:, group: @group, &block)
end
Source code GitHub
# File railties/lib/rails/initializable.rb, line 33
def context_class
@context.class
end
Source code GitHub
# File railties/lib/rails/initializable.rb, line 24
def run(*args)
@context.instance_exec(*args, &block)
end