Methods
Attributes
[R] | block | |
[R] | name |
Class Public methods
new(name, context, options, &block)
📝 Source code
# File railties/lib/rails/initializable.rb, line 14
def initialize(name, context, options, &block)
options[:group] ||= :default
@name, @context, @options, @block = name, context, options, block
end
🔎 See on GitHub
Instance Public methods
after()
📝 Source code
# File railties/lib/rails/initializable.rb, line 23
def after
@options[:after]
end
🔎 See on GitHub
before()
📝 Source code
# File railties/lib/rails/initializable.rb, line 19
def before
@options[:before]
end
🔎 See on GitHub
belongs_to?(group)
📝 Source code
# File railties/lib/rails/initializable.rb, line 27
def belongs_to?(group)
@options[:group] == group || @options[:group] == :all
end
🔎 See on GitHub
bind(context)
📝 Source code
# File railties/lib/rails/initializable.rb, line 35
def bind(context)
return self if @context
Initializer.new(@name, context, @options, &block)
end
🔎 See on GitHub
context_class()
📝 Source code
# File railties/lib/rails/initializable.rb, line 40
def context_class
@context.class
end
🔎 See on GitHub
run(*args)
📝 Source code
# File railties/lib/rails/initializable.rb, line 31
def run(*args)
@context.instance_exec(*args, &block)
end
🔎 See on GitHub