跳至内容 跳至搜索
方法
A
B
C
N
R

属性

[R] block
[R] name

类公共方法

new(name, context, options, &block)

# 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

实例公共方法

after()

# File railties/lib/rails/initializable.rb, line 23
def after
  @options[:after]
end

before()

# File railties/lib/rails/initializable.rb, line 19
def before
  @options[:before]
end

belongs_to?(group)

# File railties/lib/rails/initializable.rb, line 27
def belongs_to?(group)
  @options[:group] == group || @options[:group] == :all
end

bind(context)

# File railties/lib/rails/initializable.rb, line 35
def bind(context)
  return self if @context
  Initializer.new(@name, context, @options, &block)
end

context_class()

# File railties/lib/rails/initializable.rb, line 40
def context_class
  @context.class
end

run(*args)

# File railties/lib/rails/initializable.rb, line 31
def run(*args)
  @context.instance_exec(*args, &block)
end