diff options
Diffstat (limited to 'activesupport')
15 files changed, 28 insertions, 28 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index a450b0e6d4..d6687ae937 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -445,7 +445,7 @@ module ActiveSupport def around(&around) CallbackSequence.new do |arg| around.call(arg) { - self.call(arg) + call(arg) } end end @@ -624,7 +624,7 @@ module ActiveSupport # callback is skipped. # # class Writer < Person - # skip_callback :validate, :before, :check_membership, if: -> { self.age > 18 } + # skip_callback :validate, :before, :check_membership, if: -> { age > 18 } # end # # An <tt>ArgumentError</tt> will be raised if the callback has not @@ -662,7 +662,7 @@ module ActiveSupport target.set_callbacks name, chain end - self.set_callbacks name, callbacks.dup.clear + set_callbacks(name, callbacks.dup.clear) end # Define sets of events in the object life cycle that support callbacks. diff --git a/activesupport/lib/active_support/core_ext/date_and_time/zones.rb b/activesupport/lib/active_support/core_ext/date_and_time/zones.rb index c5b46c598c..edd724f1d0 100644 --- a/activesupport/lib/active_support/core_ext/date_and_time/zones.rb +++ b/activesupport/lib/active_support/core_ext/date_and_time/zones.rb @@ -22,7 +22,7 @@ module DateAndTime if time_zone time_with_zone(time, time_zone) else - time || self.to_time + time || to_time end end diff --git a/activesupport/lib/active_support/core_ext/digest/uuid.rb b/activesupport/lib/active_support/core_ext/digest/uuid.rb index 23cb105f7c..e6d60e3267 100644 --- a/activesupport/lib/active_support/core_ext/digest/uuid.rb +++ b/activesupport/lib/active_support/core_ext/digest/uuid.rb @@ -35,12 +35,12 @@ module Digest # Convenience method for uuid_from_hash using Digest::MD5. def self.uuid_v3(uuid_namespace, name) - self.uuid_from_hash(Digest::MD5, uuid_namespace, name) + uuid_from_hash(Digest::MD5, uuid_namespace, name) end # Convenience method for uuid_from_hash using Digest::SHA1. def self.uuid_v5(uuid_namespace, name) - self.uuid_from_hash(Digest::SHA1, uuid_namespace, name) + uuid_from_hash(Digest::SHA1, uuid_namespace, name) end # Convenience method for SecureRandom.uuid. diff --git a/activesupport/lib/active_support/core_ext/hash/compact.rb b/activesupport/lib/active_support/core_ext/hash/compact.rb index f072530e04..78b3387c3b 100644 --- a/activesupport/lib/active_support/core_ext/hash/compact.rb +++ b/activesupport/lib/active_support/core_ext/hash/compact.rb @@ -7,7 +7,7 @@ class Hash # { c: nil }.compact # => {} # { c: true }.compact # => { c: true } def compact - self.select { |_, value| !value.nil? } + select { |_, value| !value.nil? } end # Replaces current hash with non +nil+ values. @@ -18,6 +18,6 @@ class Hash # hash # => { a: true, b: false } # { c: true }.compact! # => nil def compact! - self.reject! { |_, value| value.nil? } + reject! { |_, value| value.nil? } end end diff --git a/activesupport/lib/active_support/core_ext/object/inclusion.rb b/activesupport/lib/active_support/core_ext/object/inclusion.rb index d4c17dfb07..98bf820d36 100644 --- a/activesupport/lib/active_support/core_ext/object/inclusion.rb +++ b/activesupport/lib/active_support/core_ext/object/inclusion.rb @@ -22,6 +22,6 @@ class Object # # @return [Object] def presence_in(another_object) - self.in?(another_object) ? self : nil + in?(another_object) ? self : nil end end diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index b6afd32fb0..caa48e34c5 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -76,7 +76,7 @@ class String if limit == 0 "" elsif limit >= size - self.dup + dup else to(limit - 1) end @@ -96,7 +96,7 @@ class String if limit == 0 "" elsif limit >= size - self.dup + dup else from(-limit) end diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index bf94b97ceb..7e12700c8c 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -31,7 +31,7 @@ class String def pluralize(count = nil, locale = :en) locale = count if count.is_a?(Symbol) if count == 1 - self.dup + dup else ActiveSupport::Inflector.pluralize(self, locale) end diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 622f637675..e585e89563 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -697,7 +697,7 @@ module ActiveSupport #:nodoc: if file_path expanded = File.expand_path(file_path) expanded.sub!(/\.rb\z/, "") - self.loaded.delete(expanded) + loaded.delete(expanded) end if constants.empty? diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index ad6c4f8e8c..74a603c05d 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -216,7 +216,7 @@ module ActiveSupport # modify the receiver but rather returns a new hash with indifferent # access with the result of the merge. def merge(hash, &block) - self.dup.update(hash, &block) + dup.update(hash, &block) end # Like +merge+ but the other way around: Merges the receiver into the diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb index b1be84a096..7b1cbba7fa 100644 --- a/activesupport/lib/active_support/inflector/inflections.rb +++ b/activesupport/lib/active_support/inflector/inflections.rb @@ -43,8 +43,8 @@ module ActiveSupport end def add(words) - self.concat(words.flatten.map(&:downcase)) - @regex_array += self.map {|word| to_regex(word) } + concat(words.flatten.map(&:downcase)) + @regex_array += map {|word| to_regex(word) } self end diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb index 23fe47a039..af9ee93600 100644 --- a/activesupport/lib/active_support/testing/isolation.rb +++ b/activesupport/lib/active_support/testing/isolation.rb @@ -68,7 +68,7 @@ module ActiveSupport if ENV["ISOLATION_TEST"] yield File.open(ENV["ISOLATION_OUTPUT"], "w") do |file| - file.puts [Marshal.dump(self.dup)].pack("m") + file.puts [Marshal.dump(dup)].pack("m") end exit! else diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 439d2b86aa..9cc82e9187 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -458,7 +458,7 @@ module ActiveSupport def method_missing(sym, *args, &block) wrap_with_time_zone time.__send__(sym, *args, &block) rescue NoMethodError => e - raise e, e.message.sub(time.inspect, self.inspect), e.backtrace + raise e, e.message.sub(time.inspect, inspect), e.backtrace end private diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb index 69b15b0086..913b7c8cfc 100644 --- a/activesupport/test/callbacks_test.rb +++ b/activesupport/test/callbacks_test.rb @@ -804,7 +804,7 @@ module CallbacksTest class WriterSkipper < Person attr_accessor :age - skip_callback :save, :before, :before_save_method, if: lambda {self.age > 21} + skip_callback :save, :before, :before_save_method, if: -> { age > 21 } end class WriterCallbacksTest < ActiveSupport::TestCase diff --git a/activesupport/test/concern_test.rb b/activesupport/test/concern_test.rb index 4e74a69f97..4af9ce8163 100644 --- a/activesupport/test/concern_test.rb +++ b/activesupport/test/concern_test.rb @@ -72,7 +72,7 @@ class ConcernTest < ActiveSupport::TestCase def test_class_methods_are_extended @klass.include(Baz) assert_equal "baz", @klass.baz - assert_equal ConcernTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0] + assert_equal ConcernTest::Baz::ClassMethods, (class << @klass; included_modules; end)[0] end def test_class_methods_are_extended_only_on_expected_objects diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 6579b2754f..0c627f1e74 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -27,24 +27,24 @@ end class RemoveMethodTest < ActiveSupport::TestCase def test_remove_method_from_an_object - RemoveMethodTests::A.class_eval{ - self.remove_possible_method(:do_something) + RemoveMethodTests::A.class_eval { + remove_possible_method(:do_something) } assert !RemoveMethodTests::A.new.respond_to?(:do_something) end def test_remove_singleton_method_from_an_object - RemoveMethodTests::A.class_eval{ - self.remove_possible_singleton_method(:do_something_else) + RemoveMethodTests::A.class_eval { + remove_possible_singleton_method(:do_something_else) } assert !RemoveMethodTests::A.respond_to?(:do_something_else) end def test_redefine_method_in_an_object - RemoveMethodTests::A.class_eval{ - self.redefine_method(:do_something) { return 100 } - self.redefine_method(:do_something_protected) { return 100 } - self.redefine_method(:do_something_private) { return 100 } + RemoveMethodTests::A.class_eval { + redefine_method(:do_something) { return 100 } + redefine_method(:do_something_protected) { return 100 } + redefine_method(:do_something_private) { return 100 } } assert_equal 100, RemoveMethodTests::A.new.do_something assert_equal 100, RemoveMethodTests::A.new.send(:do_something_protected) |