From 5ec2d875dd11b9c2e81c86fa34bdf46133243939 Mon Sep 17 00:00:00 2001 From: Tim Pease Date: Sat, 24 Jan 2015 13:49:19 -0700 Subject: [PATCH] Switch `alias` to `alias_method` --- lib/logging/appenders/string_io.rb | 2 +- lib/logging/diagnostic_context.rb | 4 ++-- lib/logging/logger.rb | 4 ++-- lib/logging/utils.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/logging/appenders/string_io.rb b/lib/logging/appenders/string_io.rb index 03dc2018..4e9faecc 100644 --- a/lib/logging/appenders/string_io.rb +++ b/lib/logging/appenders/string_io.rb @@ -57,7 +57,7 @@ def clear @sio.truncate 0 } end - alias :reset :clear + alias_method :reset, :clear %w[read readline readlines].each do|m| class_eval <<-CODE, __FILE__, __LINE__+1 diff --git a/lib/logging/diagnostic_context.rb b/lib/logging/diagnostic_context.rb index 36096a35..4dfc92d1 100644 --- a/lib/logging/diagnostic_context.rb +++ b/lib/logging/diagnostic_context.rb @@ -289,7 +289,7 @@ def push( message ) end self end - alias :<< :push + alias_method :<<, :push # Public: Clients should call this method before leaving a diagnostic # context. The returned value is the last pushed message. If no @@ -405,7 +405,7 @@ class << self %w[new start fork].each do |m| class_eval <<-__, __FILE__, __LINE__ - alias :_orig_#{m} :#{m} + alias_method :_orig_#{m}, :#{m} private :_orig_#{m} def #{m}( *a, &b ) create_with_logging_context(:_orig_#{m}, *a ,&b) diff --git a/lib/logging/logger.rb b/lib/logging/logger.rb index 0807b7db..e03fc7f8 100644 --- a/lib/logging/logger.rb +++ b/lib/logging/logger.rb @@ -58,7 +58,7 @@ def new( *args ) logger end end - alias :[] :new + alias_method :[], :new # This is where the actual logging methods are defined. Two methods # are created for each log level. The first is a query method used to @@ -170,7 +170,7 @@ def <<( msg ) @appenders.each {|a| a << msg} @parent << msg if @additive end - alias :write :<< + alias_method :write, :<< # call-seq: # add( severity, message = nil ) {block} diff --git a/lib/logging/utils.rb b/lib/logging/utils.rb index 4086d346..b52c0f9d 100644 --- a/lib/logging/utils.rb +++ b/lib/logging/utils.rb @@ -150,7 +150,7 @@ def initialize @locker = nil end - alias :original_synchronize :synchronize + alias_method :original_synchronize, :synchronize def synchronize if @locker == Thread.current