Permalink
Browse files

Make `register_block_for` private

  • Loading branch information...
arthurnn committed Nov 1, 2016
1 parent 7bb28a0 commit 9ebb3558f4bddc2af52829abd2b198bc7fab4a13
Showing with 11 additions and 11 deletions.
  1. +11 −11 railties/lib/rails/railtie.rb
@@ -178,17 +178,6 @@ def generate_railtie_name(string) #:nodoc:
ActiveSupport::Inflector.underscore(string).tr("/", "_")
end
# receives an instance variable identifier, set the variable value if is
# blank and append given block to value, which will be used later in
# `#each_registered_block(type, &block)`
def register_block_for(type, &blk)
var_name = "@#{type}"
blocks = instance_variable_get(var_name) || instance_variable_set(var_name, [])
blocks << blk if blk
blocks
end
# If the class method does not have a method, then send the method call
# to the Railtie instance.
def method_missing(name, *args, &block)
@@ -198,6 +187,17 @@ def method_missing(name, *args, &block)
super
end
end
private
# receives an instance variable identifier, set the variable value if is
# blank and append given block to value, which will be used later in
# `#each_registered_block(type, &block)`
def register_block_for(type, &blk)
var_name = "@#{type}"
blocks = instance_variable_get(var_name) || instance_variable_set(var_name, [])
blocks << blk if blk
blocks
end
end
delegate :railtie_name, to: :class

0 comments on commit 9ebb355

Please sign in to comment.