From 21d27f60694a52bf9de010adde065ceb69a50562 Mon Sep 17 00:00:00 2001 From: Esad Hajdarevic Date: Tue, 20 Sep 2011 23:02:02 +0200 Subject: Add a missing require for 'active_support/deprecation' in Module#deprecate --- activesupport/lib/active_support/core_ext/module/deprecation.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/deprecation.rb b/activesupport/lib/active_support/core_ext/module/deprecation.rb index 5a5b4e3f80..9c169a2598 100644 --- a/activesupport/lib/active_support/core_ext/module/deprecation.rb +++ b/activesupport/lib/active_support/core_ext/module/deprecation.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation' + class Module # Declare that a method has been deprecated. # deprecate :foo -- cgit v1.2.3 From c33334fc921894ee035e79591732188a08b3eed9 Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 6 Feb 2012 17:03:26 +0000 Subject: Change FILENAME_MAX_SIZE in FileStore to 228. In order that temp filenames generated from it will fit in 255 chars. See https://github.com/rails/rails/issues/4907 --- activesupport/lib/active_support/cache/file_store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 9460532af0..85c1225b7e 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -13,7 +13,7 @@ module ActiveSupport attr_reader :cache_path DIR_FORMATTER = "%03X" - FILENAME_MAX_SIZE = 230 # max filename size on file system is 255, minus room for timestamp and random characters appended by Tempfile (used by atomic write) + FILENAME_MAX_SIZE = 228 # max filename size on file system is 255, minus room for timestamp and random characters appended by Tempfile (used by atomic write) EXCLUDED_DIRS = ['.', '..'].freeze def initialize(cache_path, options = nil) -- cgit v1.2.3 From b16eb56280f704de0f1ea80f5ab850d9b17d70f8 Mon Sep 17 00:00:00 2001 From: jlxw Date: Mon, 27 Feb 2012 13:51:02 +0800 Subject: logger.silence is deprecated --- activesupport/lib/active_support/benchmarkable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb index cc94041a1d..f149a7f0ed 100644 --- a/activesupport/lib/active_support/benchmarkable.rb +++ b/activesupport/lib/active_support/benchmarkable.rb @@ -35,7 +35,7 @@ module ActiveSupport options[:level] ||= :info result = nil - ms = Benchmark.ms { result = options[:silence] ? logger.silence { yield } : yield } + ms = Benchmark.ms { result = options[:silence] ? silence { yield } : yield } logger.send(options[:level], '%s (%.1fms)' % [ message, ms ]) result else -- cgit v1.2.3 From ba9537c275d5434aff505cdc5d435009715dcc0e Mon Sep 17 00:00:00 2001 From: Dmitrii Golub Date: Wed, 28 Mar 2012 03:09:40 +0400 Subject: remove redundant variable --- activesupport/lib/active_support/core_ext/hash/deep_dup.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/hash/deep_dup.rb b/activesupport/lib/active_support/core_ext/hash/deep_dup.rb index 447142605c..9ab179c566 100644 --- a/activesupport/lib/active_support/core_ext/hash/deep_dup.rb +++ b/activesupport/lib/active_support/core_ext/hash/deep_dup.rb @@ -3,8 +3,7 @@ class Hash def deep_dup duplicate = self.dup duplicate.each_pair do |k,v| - tv = duplicate[k] - duplicate[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_dup : v + duplicate[k] = v.is_a?(Hash) ? v.deep_dup : v end duplicate end -- cgit v1.2.3 From 96b951ce24651aa1527b16f4ec293c716757e8b0 Mon Sep 17 00:00:00 2001 From: Dmitry Plashchynski Date: Fri, 30 Mar 2012 15:35:35 +0300 Subject: validate attribute names in class and module attribute accessors --- activesupport/lib/active_support/core_ext/class/attribute_accessors.rb | 2 ++ activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | 2 ++ 2 files changed, 4 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb index 268303aaf2..95eb94fdf6 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb @@ -29,6 +29,7 @@ class Class def cattr_reader(*syms) options = syms.extract_options! syms.each do |sym| + raise NameError.new("invalid attribute name") unless sym =~ /^[_A-Za-z]\w*$/ class_eval(<<-EOS, __FILE__, __LINE__ + 1) unless defined? @@#{sym} @@#{sym} = nil @@ -52,6 +53,7 @@ class Class def cattr_writer(*syms) options = syms.extract_options! syms.each do |sym| + raise NameError.new("invalid attribute name") unless sym =~ /^[_A-Za-z]\w*$/ class_eval(<<-EOS, __FILE__, __LINE__ + 1) unless defined? @@#{sym} @@#{sym} = nil diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb index be94ae1565..84acb629ad 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -4,6 +4,7 @@ class Module def mattr_reader(*syms) options = syms.extract_options! syms.each do |sym| + raise NameError.new("invalid attribute name") unless sym =~ /^[_A-Za-z]\w*$/ class_eval(<<-EOS, __FILE__, __LINE__ + 1) @@#{sym} = nil unless defined? @@#{sym} @@ -25,6 +26,7 @@ class Module def mattr_writer(*syms) options = syms.extract_options! syms.each do |sym| + raise NameError.new("invalid attribute name") unless sym =~ /^[_A-Za-z]\w*$/ class_eval(<<-EOS, __FILE__, __LINE__ + 1) def self.#{sym}=(obj) @@#{sym} = obj -- cgit v1.2.3 From 0244c0d8f339385a9b420a0565b17d327bf25b13 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 31 Mar 2012 17:21:49 -0700 Subject: use undef_method to avoid NameError exceptions all the time --- activesupport/lib/active_support/core_ext/module/remove_method.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/remove_method.rb b/activesupport/lib/active_support/core_ext/module/remove_method.rb index b76bc16ee1..719071d1c2 100644 --- a/activesupport/lib/active_support/core_ext/module/remove_method.rb +++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb @@ -1,12 +1,8 @@ class Module def remove_possible_method(method) if method_defined?(method) || private_method_defined?(method) - remove_method(method) + undef_method(method) end - rescue NameError - # If the requested method is defined on a superclass or included module, - # method_defined? returns true but remove_method throws a NameError. - # Ignore this. end def redefine_method(method, &block) -- cgit v1.2.3 From 5f62e88b3ba14675b76009e112b25ee7a3105cb5 Mon Sep 17 00:00:00 2001 From: Artyom Bolshakov Date: Tue, 3 Apr 2012 14:20:32 +0400 Subject: Fix typo --- activesupport/lib/active_support/inflector/methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 4cebad742f..19a6c51516 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -146,7 +146,7 @@ module ActiveSupport # Replaces underscores with dashes in the string. # # Example: - # "puni_puni" # => "puni-puni" + # "puni_puni".dasherize # => "puni-puni" def dasherize(underscored_word) underscored_word.tr('_', '-') end -- cgit v1.2.3 From 2d8396fc9fbea9189e9e945e41e643925da5b2cb Mon Sep 17 00:00:00 2001 From: Jurriaan Pruis Date: Tue, 3 Apr 2012 15:16:09 +0200 Subject: Updated/changed useless tr/gsubs --- activesupport/lib/active_support/inflector/methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 19a6c51516..54d3b4f5ca 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -77,7 +77,7 @@ module ActiveSupport # "SSLError".underscore.camelize # => "SslError" def underscore(camel_cased_word) word = camel_cased_word.to_s.dup - word.gsub!(/::/, '/') + word.gsub!('::', '/') word.gsub!(/(?:([A-Za-z\d])|^)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1}#{$1 && '_'}#{$2.downcase}" } word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') -- cgit v1.2.3 From e25eeed5b873f05f9614ecf6720c0eb636d52b63 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 3 Apr 2012 16:17:45 -0700 Subject: the file update checker now also detects removed files --- .../lib/active_support/file_update_checker.rb | 62 +++++++++++++--------- 1 file changed, 38 insertions(+), 24 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/file_update_checker.rb b/activesupport/lib/active_support/file_update_checker.rb index fe22b9515b..c99da22cd6 100644 --- a/activesupport/lib/active_support/file_update_checker.rb +++ b/activesupport/lib/active_support/file_update_checker.rb @@ -9,7 +9,7 @@ module ActiveSupport # the filesystem or not; # # * +execute+ which executes the given block on initialization - # and updates the counter to the latest timestamp; + # and updates the latest watched files and timestamp; # # * +execute_if_updated+ which just executes the block if it was updated; # @@ -39,13 +39,13 @@ module ActiveSupport # # == Implementation details # - # This particular implementation checks for added and updated files, - # but not removed files. Directories lookup are compiled to a glob for - # performance. Therefore, while someone can add new files to the +files+ - # array after initialization (and parts of Rails do depend on this feature), - # adding new directories after initialization is not allowed. + # This particular implementation checks for added, updated, and removed + # files. Directories lookup are compiled to a glob for performance. + # Therefore, while someone can add new files to the +files+ array after + # initialization (and parts of Rails do depend on this feature), adding + # new directories after initialization is not supported. # - # Notice that other objects that implements FileUpdateChecker API may + # Notice that other objects that implement the FileUpdateChecker API may # not even allow new files to be added after initialization. If this # is the case, we recommend freezing the +files+ after initialization to # avoid changes that won't make effect. @@ -53,27 +53,38 @@ module ActiveSupport @files = files @glob = compile_glob(dirs) @block = block - @updated_at = nil - @last_update_at = updated_at + + @last_watched = watched + @last_update_at = updated_at(@last_watched) end - # Check if any of the entries were updated. If so, the updated_at - # value is cached until the block is executed via +execute+ or +execute_if_updated+ + # Check if any of the entries were updated. If so, the watched and/or + # updated_at values are cached until the block is executed via +execute+ + # or +execute_if_updated+ def updated? - current_updated_at = updated_at - if @last_update_at < current_updated_at - @updated_at = updated_at + current_watched = watched + if @last_watched.size != current_watched.size + @watched = current_watched true else - false + current_updated_at = updated_at(current_watched) + if @last_update_at < current_updated_at + @watched = current_watched + @updated_at = current_updated_at + true + else + false + end end end - # Executes the given block and updates the counter to latest timestamp. + # Executes the given block and updates the latest watched files and timestamp. def execute - @last_update_at = updated_at + @last_watched = watched + @last_update_at = updated_at(@last_watched) @block.call ensure + @watched = nil @updated_at = nil end @@ -89,16 +100,19 @@ module ActiveSupport private - def updated_at #:nodoc: - @updated_at || begin + def watched + @watched || begin all = @files.select { |f| File.exists?(f) } - all.concat Dir[@glob] if @glob - all.map! { |path| File.mtime(path) } - all.max || Time.at(0) + all.concat(Dir[@glob]) if @glob + all end end - def compile_glob(hash) #:nodoc: + def updated_at(paths) + @updated_at || paths.map { |path| File.mtime(path) }.max || Time.at(0) + end + + def compile_glob(hash) hash.freeze # Freeze so changes aren't accidently pushed return if hash.empty? @@ -112,7 +126,7 @@ module ActiveSupport key.gsub(',','\,') end - def compile_ext(array) #:nodoc: + def compile_ext(array) array = Array(array) return if array.empty? ".{#{array.join(",")}}" -- cgit v1.2.3 From b1e55041ebb33a27121eff4424eeeaee4e4b5028 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 5 Apr 2012 14:44:05 -0300 Subject: Remove not used require from as to avoid circular requires --- activesupport/lib/active_support/deprecation/method_wrappers.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb index d0d8b577b3..8be8665e40 100644 --- a/activesupport/lib/active_support/deprecation/method_wrappers.rb +++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb @@ -1,4 +1,3 @@ -require 'active_support/core_ext/module/deprecation' require 'active_support/core_ext/module/aliasing' require 'active_support/core_ext/array/extract_options' -- cgit v1.2.3 From b621ded8130a98c6089a6be9bdeec5865b51fe38 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 5 Apr 2012 14:44:05 -0300 Subject: Initialize variables in file update checker to avoid warnings --- activesupport/lib/active_support/file_update_checker.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/file_update_checker.rb b/activesupport/lib/active_support/file_update_checker.rb index c99da22cd6..8860636168 100644 --- a/activesupport/lib/active_support/file_update_checker.rb +++ b/activesupport/lib/active_support/file_update_checker.rb @@ -54,6 +54,9 @@ module ActiveSupport @glob = compile_glob(dirs) @block = block + @watched = nil + @updated_at = nil + @last_watched = watched @last_update_at = updated_at(@last_watched) end -- cgit v1.2.3 From 29089bf6faeb496f0cb7d439b848bc6ee4f40e9e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 5 Apr 2012 14:33:47 -0700 Subject: revises requires of some AS deprecation files --- activesupport/lib/active_support/core_ext/module/deprecation.rb | 2 +- activesupport/lib/active_support/deprecation.rb | 1 + activesupport/lib/active_support/deprecation/method_wrappers.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/deprecation.rb b/activesupport/lib/active_support/core_ext/module/deprecation.rb index 9c169a2598..9e77ac3c45 100644 --- a/activesupport/lib/active_support/core_ext/module/deprecation.rb +++ b/activesupport/lib/active_support/core_ext/module/deprecation.rb @@ -1,4 +1,4 @@ -require 'active_support/deprecation' +require 'active_support/deprecation/method_wrappers' class Module # Declare that a method has been deprecated. diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index 45b9dda5ca..176edefa42 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/module/deprecation' require 'active_support/deprecation/behaviors' require 'active_support/deprecation/reporting' require 'active_support/deprecation/method_wrappers' diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb index 8be8665e40..c5de5e6a95 100644 --- a/activesupport/lib/active_support/deprecation/method_wrappers.rb +++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb @@ -2,9 +2,9 @@ require 'active_support/core_ext/module/aliasing' require 'active_support/core_ext/array/extract_options' module ActiveSupport - class << Deprecation + module Deprecation # Declare that a method has been deprecated. - def deprecate_methods(target_module, *method_names) + def self.deprecate_methods(target_module, *method_names) options = method_names.extract_options! method_names += options.keys -- cgit v1.2.3 From 4b685aad7b5edeb087968c42f815be2bec14b822 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 7 Apr 2012 23:49:28 +0200 Subject: revises the regexp used in titleize The regexp used in titleize matches saxon genitive and other contractions, only to call capitalize on the captured text and have the apostrophe upcased which yields the apostrophe itself. It is more clear that the regexp matches just what it has to match. --- activesupport/lib/active_support/inflector/methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 54d3b4f5ca..61876d89a9 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -114,7 +114,7 @@ module ActiveSupport # "TheManWithoutAPast".titleize # => "The Man Without A Past" # "raiders_of_the_lost_ark".titleize # => "Raiders Of The Lost Ark" def titleize(word) - humanize(underscore(word)).gsub(/\b(['’`]?[a-z])/) { $1.capitalize } + humanize(underscore(word)).gsub(/\b(? Date: Sat, 7 Apr 2012 18:05:36 -0500 Subject: update stdlib doc urls in comments - active_support/core_ext/[integer|numeric]/time.rb http://stdlib.rubyonrails.org/ last updated in 2005 --- activesupport/lib/active_support/core_ext/integer/time.rb | 6 +++--- activesupport/lib/active_support/core_ext/numeric/time.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/integer/time.rb b/activesupport/lib/active_support/core_ext/integer/time.rb index c677400396..894b5d0696 100644 --- a/activesupport/lib/active_support/core_ext/integer/time.rb +++ b/activesupport/lib/active_support/core_ext/integer/time.rb @@ -24,9 +24,9 @@ class Integer # 1.year.to_f.from_now # # In such cases, Ruby's core - # Date[http://stdlib.rubyonrails.org/libdoc/date/rdoc/index.html] and - # Time[http://stdlib.rubyonrails.org/libdoc/time/rdoc/index.html] should be used for precision - # date and time arithmetic + # Date[http://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and + # Time[http://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision + # date and time arithmetic. def months ActiveSupport::Duration.new(self * 30.days, [[:months, self]]) end diff --git a/activesupport/lib/active_support/core_ext/numeric/time.rb b/activesupport/lib/active_support/core_ext/numeric/time.rb index 58a03d508e..822f766af7 100644 --- a/activesupport/lib/active_support/core_ext/numeric/time.rb +++ b/activesupport/lib/active_support/core_ext/numeric/time.rb @@ -28,9 +28,9 @@ class Numeric # 1.year.to_f.from_now # # In such cases, Ruby's core - # Date[http://stdlib.rubyonrails.org/libdoc/date/rdoc/index.html] and - # Time[http://stdlib.rubyonrails.org/libdoc/time/rdoc/index.html] should be used for precision - # date and time arithmetic + # Date[http://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and + # Time[http://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision + # date and time arithmetic. def seconds ActiveSupport::Duration.new(self, [[:seconds, self]]) end -- cgit v1.2.3 From 2c72a4abde55c595f286defb84b37de1fdffb3a5 Mon Sep 17 00:00:00 2001 From: Jan Xie Date: Sun, 8 Apr 2012 19:21:10 +0800 Subject: fix doc for ActiveSupport::Callbacks::Callback#define_conditional_callback --- activesupport/lib/active_support/callbacks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 6e36edee4f..2a569d9a9b 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -187,7 +187,7 @@ module ActiveSupport # Compile around filters with conditions into proxy methods # that contain the conditions. # - # For `around_save :filter_name, :if => :condition': + # For `set_callback :save, :around, :filter_name, :if => :condition': # # def _conditional_callback_save_17 # if condition -- cgit v1.2.3 From 2e431599596913e24d7a5b053b632d0eae83517b Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 8 Apr 2012 22:10:03 -0300 Subject: Remove Fixnum#to_sym support in 1.8.7 --- activesupport/lib/active_support/core_ext/hash/keys.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb index d8748b1138..da7c3dfbe8 100644 --- a/activesupport/lib/active_support/core_ext/hash/keys.rb +++ b/activesupport/lib/active_support/core_ext/hash/keys.rb @@ -22,7 +22,7 @@ class Hash # to +to_sym+. def symbolize_keys! keys.each do |key| - self[(key.to_sym rescue key) || key] = delete(key) + self[(key.to_sym rescue key)] = delete(key) end self end -- cgit v1.2.3 From 6ddbd1844a6fd6aca2992f5f75c9f605cf89808f Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 8 Apr 2012 22:30:18 -0300 Subject: Inline the symbolize_keys/stringify_keys methods user system total real symbolize_keys 5.980000 0.070000 6.050000 ( 6.048187) new_symbolize_keys 4.310000 0.050000 4.360000 ( 4.364745) --- activesupport/lib/active_support/core_ext/hash/keys.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb index da7c3dfbe8..65c3736593 100644 --- a/activesupport/lib/active_support/core_ext/hash/keys.rb +++ b/activesupport/lib/active_support/core_ext/hash/keys.rb @@ -1,7 +1,11 @@ class Hash # Return a new hash with all keys converted to strings. def stringify_keys - dup.stringify_keys! + result = {} + keys.each do |key| + result[key.to_s] = self[key] + end + result end # Destructively convert all keys to strings. @@ -15,7 +19,11 @@ class Hash # Return a new hash with all keys converted to symbols, as long as # they respond to +to_sym+. def symbolize_keys - dup.symbolize_keys! + result = {} + keys.each do |key| + result[(key.to_sym rescue key)] = self[key] + end + result end # Destructively convert all keys to symbols, as long as they respond -- cgit v1.2.3 From 1bac04e854b42fc0e47162e251105434d356d2b4 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Mon, 29 Aug 2011 13:07:03 +0200 Subject: Optimize the performance of #delegate Remove the use of #__send__ in order to boost performance. This also means that you can no longer delegate to private methods on the target object. --- .../active_support/core_ext/module/delegation.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index af92b869fd..0ea58d4224 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -124,23 +124,27 @@ class Module file, line = caller.first.split(':', 2) line = line.to_i - if allow_nil - methods.each do |method| + methods.each do |method| + method = method.to_s + + # Attribute writer methods only accept one argument. Makes sure []= + # methods still accept two arguments. + definition = (method =~ /[^\]]=$/) ? "arg" : "*args, &block" + + if allow_nil module_eval(<<-EOS, file, line - 2) - def #{method_prefix}#{method}(*args, &block) # def customer_name(*args, &block) + def #{method_prefix}#{method}(#{definition}) # def customer_name(*args, &block) if #{to} || #{to}.respond_to?(:#{method}) # if client || client.respond_to?(:name) - #{to}.__send__(:#{method}, *args, &block) # client.__send__(:name, *args, &block) + #{to}.#{method}(#{definition}) # client.name(*args, &block) end # end end # end EOS - end - else - methods.each do |method| + else exception = %(raise "#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}") module_eval(<<-EOS, file, line - 1) - def #{method_prefix}#{method}(*args, &block) # def customer_name(*args, &block) - #{to}.__send__(:#{method}, *args, &block) # client.__send__(:name, *args, &block) + def #{method_prefix}#{method}(#{definition}) # def customer_name(*args, &block) + #{to}.#{method}(#{definition}) # client.name(*args, &block) rescue NoMethodError # rescue NoMethodError if #{to}.nil? # if client.nil? #{exception} # # add helpful message to the exception -- cgit v1.2.3 From 2310db373ba915e77fdc1dcd780068ad98d242cd Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Thu, 1 Sep 2011 15:07:40 +0200 Subject: Change API docs regarding delegation to non-public methods --- activesupport/lib/active_support/core_ext/module/delegation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index 0ea58d4224..ee8adae1cb 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -1,5 +1,5 @@ class Module - # Provides a delegate class method to easily expose contained objects' methods + # Provides a delegate class method to easily expose contained objects' public methods # as your own. Pass one or more methods (specified as symbols or strings) # and the name of the target object via the :to option (also a symbol # or string). At least one method and the :to option are required. -- cgit v1.2.3 From 402a119ddb886cc60b6e6c120aff964a6d4780af Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Tue, 11 Oct 2011 15:38:17 +0200 Subject: Add back the old `deprecate` method as `deprecate!` --- .../active_support/core_ext/module/delegation.rb | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index ee8adae1cb..b927059c6b 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -156,4 +156,56 @@ class Module end end end + + def delegate!(*methods) + ActiveSupport::Deprecation.warn('Delegating to non-public methods is deprecated.', caller) + + options = methods.pop + unless options.is_a?(Hash) && to = options[:to] + raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)." + end + prefix, to, allow_nil = options[:prefix], options[:to], options[:allow_nil] + + if prefix == true && to.to_s =~ /^[^a-z_]/ + raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method." + end + + method_prefix = + if prefix + "#{prefix == true ? to : prefix}_" + else + '' + end + + file, line = caller.first.split(':', 2) + line = line.to_i + + methods.each do |method| + method = method.to_s + + if allow_nil + module_eval(<<-EOS, file, line - 2) + def #{method_prefix}#{method}(*args, &block) # def customer_name(*args, &block) + if #{to} || #{to}.respond_to?(:#{method}) # if client || client.respond_to?(:name) + #{to}.__send__(:#{method}, *args, &block) # client.__send__(:name, *args, &block) + end # end + end # end + EOS + else + exception = %(raise "#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}") + + module_eval(<<-EOS, file, line - 1) + def #{method_prefix}#{method}(*args, &block) # def customer_name(*args, &block) + #{to}.__send__(:#{method}, *args, &block) # client.__send__(:name, *args, &block) + rescue NoMethodError # rescue NoMethodError + if #{to}.nil? # if client.nil? + #{exception} # # add helpful message to the exception + else # else + raise # raise + end # end + end # end + EOS + end + end + end end -- cgit v1.2.3 From 5fb6bd8b22327b00061602b64af8c08886abc581 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Thu, 12 Apr 2012 14:55:30 +0200 Subject: Remove Module#delegate! --- .../active_support/core_ext/module/delegation.rb | 52 ---------------------- 1 file changed, 52 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index b927059c6b..ee8adae1cb 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -156,56 +156,4 @@ class Module end end end - - def delegate!(*methods) - ActiveSupport::Deprecation.warn('Delegating to non-public methods is deprecated.', caller) - - options = methods.pop - unless options.is_a?(Hash) && to = options[:to] - raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)." - end - prefix, to, allow_nil = options[:prefix], options[:to], options[:allow_nil] - - if prefix == true && to.to_s =~ /^[^a-z_]/ - raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method." - end - - method_prefix = - if prefix - "#{prefix == true ? to : prefix}_" - else - '' - end - - file, line = caller.first.split(':', 2) - line = line.to_i - - methods.each do |method| - method = method.to_s - - if allow_nil - module_eval(<<-EOS, file, line - 2) - def #{method_prefix}#{method}(*args, &block) # def customer_name(*args, &block) - if #{to} || #{to}.respond_to?(:#{method}) # if client || client.respond_to?(:name) - #{to}.__send__(:#{method}, *args, &block) # client.__send__(:name, *args, &block) - end # end - end # end - EOS - else - exception = %(raise "#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}") - - module_eval(<<-EOS, file, line - 1) - def #{method_prefix}#{method}(*args, &block) # def customer_name(*args, &block) - #{to}.__send__(:#{method}, *args, &block) # client.__send__(:name, *args, &block) - rescue NoMethodError # rescue NoMethodError - if #{to}.nil? # if client.nil? - #{exception} # # add helpful message to the exception - else # else - raise # raise - end # end - end # end - EOS - end - end - end end -- cgit v1.2.3 From 702d25e34d104a6ed5ddc14b4d7740c8a43bbcdb Mon Sep 17 00:00:00 2001 From: Michael de Silva Date: Fri, 13 Apr 2012 00:44:14 +0300 Subject: Fix rdoc typo in ActiveSupport::Notifications --- activesupport/lib/active_support/notifications.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 8cf7bdafda..9794527752 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -4,7 +4,7 @@ require 'active_support/notifications/fanout' module ActiveSupport # = Notifications # - # +ActiveSupport::Notifications+ provides an instrumentation API for Ruby. + # ActiveSupport::Notifications provides an instrumentation API for Ruby. # # == Instrumenters # -- cgit v1.2.3 From 32df31317397adb573766ae349a53d0cda362edc Mon Sep 17 00:00:00 2001 From: Michael de Silva Date: Fri, 13 Apr 2012 00:48:53 +0300 Subject: Fix further typos in ActiveSupport::Notifications --- activesupport/lib/active_support/notifications.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 9794527752..521245e195 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -44,16 +44,16 @@ module ActiveSupport # event.duration # => 10 (in milliseconds) # event.payload # => { :extra => :information } # - # The block in the +subscribe+ call gets the name of the event, start + # The block in the subscribe call gets the name of the event, start # timestamp, end timestamp, a string with a unique identifier for that event # (something like "535801666f04d0298cd6"), and a hash with the payload, in # that order. # # If an exception happens during that particular instrumentation the payload will - # have a key +:exception+ with an array of two elements as value: a string with + # have a key :exception with an array of two elements as value: a string with # the name of the exception class, and the exception message. # - # As the previous example depicts, the class +ActiveSupport::Notifications::Event+ + # As the previous example depicts, the class ActiveSupport::Notifications::Event # is able to take the arguments as they come and provide an object-oriented # interface to that data. # @@ -63,7 +63,7 @@ module ActiveSupport # ... # end # - # and even pass no argument to +subscribe+, in which case you are subscribing + # and even pass no argument to subscribe, in which case you are subscribing # to all events. # # == Temporary Subscriptions -- cgit v1.2.3 From b744199cc23a40b48c78e2b4353250da8fb55450 Mon Sep 17 00:00:00 2001 From: Michael de Silva Date: Fri, 13 Apr 2012 01:24:43 +0300 Subject: Add documentation to detail passing of an object as the second parameter passed to the ActiveSupport::Notifications.subscribe method instead of a block Example code sample and output is provided as well. --- activesupport/lib/active_support/notifications.rb | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 521245e195..6735c561d3 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -57,6 +57,33 @@ module ActiveSupport # is able to take the arguments as they come and provide an object-oriented # interface to that data. # + # It is also possible to pass an object as the second parameter passed to the + # subscribe method instead of a block: + # + # module ActionController + # class PageRequest + # def call(name, started, finished, unique_id, payload) + # Rails.logger.debug ["notification:", name, started, finished, unique_id, payload].join(" ") + # end + # end + # end + # + # ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new) + # + # resulting in the following output within the logs including a hash with the payload: + # + # notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 { + # :controller=>"Devise::SessionsController", + # :action=>"new", + # :params=>{"action"=>"new", "controller"=>"devise/sessions"}, + # :format=>:html, + # :method=>"GET", + # :path=>"/login/sign_in", + # :status=>200, + # :view_runtime=>279.3080806732178, + # :db_runtime=>40.053 + # } + # # You can also subscribe to all events whose name matches a certain regexp: # # ActiveSupport::Notifications.subscribe(/render/) do |*args| -- cgit v1.2.3 From 6a6b79939d3a54c0e62c81aac0ee98eedf940b80 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sun, 15 Apr 2012 23:37:16 +0200 Subject: Add missing require in Active Support time zones (fixes #5854) I also removed the other require as it's already present in `activesupport/core_ext/time/calculations` --- activesupport/lib/active_support/core_ext/time/zones.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb index 0c5962858e..dc632c2e53 100644 --- a/activesupport/lib/active_support/core_ext/time/zones.rb +++ b/activesupport/lib/active_support/core_ext/time/zones.rb @@ -1,4 +1,4 @@ -require 'active_support/time_with_zone' +require 'active_support/core_ext/time/calculations' class Time class << self -- cgit v1.2.3 From 9a4bfd04a376efe91e8b80e754e6eab1e332eb69 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sun, 15 Apr 2012 23:43:48 +0200 Subject: Require for time_with_zone should stay in core_ext/time_zones :bomb: --- activesupport/lib/active_support/core_ext/time/zones.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb index dc632c2e53..b4ed74a7b0 100644 --- a/activesupport/lib/active_support/core_ext/time/zones.rb +++ b/activesupport/lib/active_support/core_ext/time/zones.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/time/calculations' +require 'active_support/time_with_zone' class Time class << self -- cgit v1.2.3 From 57baa0e97aa4b444706007fe5b9e9ecb5e462df5 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Mon, 16 Apr 2012 19:10:04 +0530 Subject: fixed broken build after multi_json upgrade Multi_json also upgraded. --- activesupport/lib/active_support/json/decoding.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb index cbeb6c0a28..986a764479 100644 --- a/activesupport/lib/active_support/json/decoding.rb +++ b/activesupport/lib/active_support/json/decoding.rb @@ -9,7 +9,7 @@ module ActiveSupport module JSON class << self def decode(json, options ={}) - data = MultiJson.decode(json, options) + data = MultiJson.load(json, options) if ActiveSupport.parse_json_times convert_dates_from(data) else @@ -18,12 +18,12 @@ module ActiveSupport end def engine - MultiJson.engine + MultiJson.adapter end alias :backend :engine def engine=(name) - MultiJson.engine = name + MultiJson.use(name) end alias :backend= :engine= -- cgit v1.2.3 From 387d4e7ee071f7968ef0f7b503289b509858b468 Mon Sep 17 00:00:00 2001 From: Vishnu Atrai Date: Mon, 16 Apr 2012 22:22:36 +0530 Subject: remove autoload for OrderedHash, usages removed already --- activesupport/lib/active_support.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index dbf0c25c5c..fb0cc517a5 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -65,7 +65,6 @@ module ActiveSupport autoload :MessageVerifier autoload :Multibyte autoload :OptionMerger - autoload :OrderedHash autoload :OrderedOptions autoload :Rescuable autoload :StringInquirer -- cgit v1.2.3 From 0232543e0d885902b5b3ea9c4cf0638d76583a35 Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Tue, 17 Apr 2012 15:31:05 +0530 Subject: stamp out ruby-debug19 with extreme prejudice :) --- activesupport/lib/active_support/core_ext/kernel/debugger.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index d5b590e9f0..a2347111b5 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -1,8 +1,8 @@ module Kernel unless respond_to?(:debugger) - # Starts a debugging session if ruby-debug has been loaded (call rails server --debugger to do load it). + # Starts a debugging session if debugger has been loaded (call rails server --debugger to do load it). def debugger - message = "\n***** Debugger requested, but was not available (ensure ruby-debug19 is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" + message = "\n***** Debugger requested, but was not available (ensure debugger is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message) end alias breakpoint debugger unless respond_to?(:breakpoint) -- cgit v1.2.3 From 1d26fcb9f896a3dc98d90ad734aa5da7ac2bbcda Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 17 Apr 2012 06:31:44 -0700 Subject: Revert "Merge pull request #5864 from vatrai/remove_ordered_hash_autoload" This reverts commit 86c640a1625aa3a8ec8728c2f1c640c9718fcb0b, reversing changes made to a0c2cfdc51e16fc39c1d3b1e78bdd257188fa04e. --- activesupport/lib/active_support.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index fb0cc517a5..dbf0c25c5c 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -65,6 +65,7 @@ module ActiveSupport autoload :MessageVerifier autoload :Multibyte autoload :OptionMerger + autoload :OrderedHash autoload :OrderedOptions autoload :Rescuable autoload :StringInquirer -- cgit v1.2.3 From 6f80ea2aec83523640b505ddd5b6e87f0100a85b Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Wed, 18 Apr 2012 00:48:59 +0530 Subject: review changes for #5875 --- activesupport/lib/active_support/core_ext/kernel/debugger.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index a2347111b5..0d9456641a 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -1,6 +1,6 @@ module Kernel unless respond_to?(:debugger) - # Starts a debugging session if debugger has been loaded (call rails server --debugger to do load it). + # Starts a debugging session if +debugger+ gem has been loaded (call rails server --debugger to do load it). def debugger message = "\n***** Debugger requested, but was not available (ensure debugger is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message) -- cgit v1.2.3 From 67ede880550836ce9f66164c56c8afeb397a54da Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Wed, 18 Apr 2012 02:24:44 +0530 Subject: another attempt at the language --- activesupport/lib/active_support/core_ext/kernel/debugger.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index 0d9456641a..2273cf7c2c 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -1,6 +1,6 @@ module Kernel unless respond_to?(:debugger) - # Starts a debugging session if +debugger+ gem has been loaded (call rails server --debugger to do load it). + # Starts a debugging session if a debugger has been loaded (call rails server --debugger to do load it). def debugger message = "\n***** Debugger requested, but was not available (ensure debugger is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message) -- cgit v1.2.3 From 8f1a0af7385e7332b958d030fe054b6ff0f8637b Mon Sep 17 00:00:00 2001 From: kennyj Date: Thu, 19 Apr 2012 00:19:39 +0900 Subject: Remove unused code. We should use 'active_support/time'. --- activesupport/lib/active_support/time/autoload.rb | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 activesupport/lib/active_support/time/autoload.rb (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/time/autoload.rb b/activesupport/lib/active_support/time/autoload.rb deleted file mode 100644 index c9a7731b39..0000000000 --- a/activesupport/lib/active_support/time/autoload.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ActiveSupport - autoload :Duration, 'active_support/duration' - autoload :TimeWithZone, 'active_support/time_with_zone' - autoload :TimeZone, 'active_support/values/time_zone' -end -- cgit v1.2.3 From f98d929e675fb68a4f031ff09ccc8b1dfe00454e Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Sat, 21 Apr 2012 10:50:38 +0200 Subject: Remove circular require of time/zones --- activesupport/lib/active_support/core_ext/time/calculations.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 5076697c04..7add47be44 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -1,5 +1,4 @@ require 'active_support/duration' -require 'active_support/core_ext/time/zones' require 'active_support/core_ext/time/conversions' class Time -- cgit v1.2.3 From d6c831c198baee2542a070c62f1608f88fe60e34 Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Tue, 24 Apr 2012 21:56:41 -0500 Subject: and one more time --- activesupport/lib/active_support/core_ext/kernel/debugger.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index 2273cf7c2c..2073cac98d 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -1,8 +1,8 @@ module Kernel unless respond_to?(:debugger) - # Starts a debugging session if a debugger has been loaded (call rails server --debugger to do load it). + # Starts a debugging session if the +debugger+ gem has been loaded (call rails server --debugger to do load it). def debugger - message = "\n***** Debugger requested, but was not available (ensure debugger is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" + message = "\n***** Debugger requested, but was not available (ensure the debugger gem is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message) end alias breakpoint debugger unless respond_to?(:breakpoint) -- cgit v1.2.3 From 6659252d9f0e6d77bee268adf587e03cfeb8f9ad Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Sat, 28 Apr 2012 23:04:36 -0500 Subject: fix typo in ActiveSupport::Inflector#titleize --- activesupport/lib/active_support/inflector/methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 61876d89a9..4fcd32edf2 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -106,7 +106,7 @@ module ActiveSupport # a nicer looking title. +titleize+ is meant for creating pretty output. It is not # used in the Rails internals. # - # +titleize+ is also aliased as as +titlecase+. + # +titleize+ is also aliased as +titlecase+. # # Examples: # "man from the boondocks".titleize # => "Man From The Boondocks" -- cgit v1.2.3