diff options
Diffstat (limited to 'activesupport/lib/active_support')
8 files changed, 20 insertions, 39 deletions
diff --git a/activesupport/lib/active_support/base64.rb b/activesupport/lib/active_support/base64.rb deleted file mode 100644 index 41a1a3469d..0000000000 --- a/activesupport/lib/active_support/base64.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'base64' - -module ActiveSupport - Base64 = ::Base64 - - # *DEPRECATED*: Use +Base64.strict_encode64+ instead. - # - # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters - # or memcache keys without further processing. - # - # ActiveSupport::Base64.encode64s("Original unencoded string") - # # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==" - def Base64.encode64s(value) - ActiveSupport::Deprecation.warn "encode64s " \ - "is deprecated. Use Base64.strict_encode64 instead", caller - strict_encode64(value) - end -end diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 45bec264ff..305ed4964b 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -110,6 +110,6 @@ class Class private def singleton_class? - !name || '' == name + ancestors.first != self end end diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index 7516f41e0b..d5b590e9f0 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -2,7 +2,7 @@ module Kernel unless respond_to?(:debugger) # Starts a debugging session if ruby-debug has been loaded (call rails server --debugger to do load it). def debugger - message = "\n***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n" + 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" defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message) end alias breakpoint debugger unless respond_to?(:breakpoint) diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index d7181035d3..07b6a940c6 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -206,6 +206,10 @@ module Enumerable end end +class Range + def as_json(options = nil) to_s end #:nodoc: +end + class Array def as_json(options = nil) #:nodoc: # use encoder as a proxy to call as_json on all elements, to protect from circular references diff --git a/activesupport/lib/active_support/message_encryptor.rb b/activesupport/lib/active_support/message_encryptor.rb index 476ba0b3d1..6ec5a04933 100644 --- a/activesupport/lib/active_support/message_encryptor.rb +++ b/activesupport/lib/active_support/message_encryptor.rb @@ -1,5 +1,5 @@ require 'openssl' -require 'active_support/base64' +require 'base64' module ActiveSupport # MessageEncryptor is a simple way to encrypt values which get stored somewhere @@ -56,12 +56,12 @@ module ActiveSupport encrypted_data = cipher.update(@serializer.dump(value)) encrypted_data << cipher.final - [encrypted_data, iv].map {|v| ActiveSupport::Base64.strict_encode64(v)}.join("--") + [encrypted_data, iv].map {|v| ::Base64.strict_encode64(v)}.join("--") end def _decrypt(encrypted_message) cipher = new_cipher - encrypted_data, iv = encrypted_message.split("--").map {|v| ActiveSupport::Base64.decode64(v)} + encrypted_data, iv = encrypted_message.split("--").map {|v| ::Base64.decode64(v)} cipher.decrypt cipher.key = @secret diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb index 7cb5b1e82d..3b27089fa0 100644 --- a/activesupport/lib/active_support/message_verifier.rb +++ b/activesupport/lib/active_support/message_verifier.rb @@ -1,4 +1,4 @@ -require 'active_support/base64' +require 'base64' require 'active_support/core_ext/object/blank' module ActiveSupport @@ -37,14 +37,14 @@ module ActiveSupport data, digest = signed_message.split("--") if data.present? && digest.present? && secure_compare(digest, generate_digest(data)) - @serializer.load(ActiveSupport::Base64.decode64(data)) + @serializer.load(::Base64.decode64(data)) else raise InvalidSignature end end def generate(value) - data = ActiveSupport::Base64.strict_encode64(@serializer.dump(value)) + data = ::Base64.strict_encode64(@serializer.dump(value)) "#{data}--#{generate_digest(data)}" end diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 8d6c27e381..707544e594 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -10,15 +10,9 @@ require 'active_support/core_ext/kernel/reporting' module ActiveSupport class TestCase < ::Test::Unit::TestCase - if defined? MiniTest - Assertion = MiniTest::Assertion - alias_method :method_name, :name if method_defined? :name - alias_method :method_name, :__name__ if method_defined? :__name__ - else - Assertion = Test::Unit::AssertionFailedError - - undef :default_test - end + Assertion = MiniTest::Assertion + alias_method :method_name, :name if method_defined? :name + alias_method :method_name, :__name__ if method_defined? :__name__ $tags = {} def self.for_tag(tag) diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb index 1ea9a9d7e1..677e9910bb 100644 --- a/activesupport/lib/active_support/xml_mini.rb +++ b/activesupport/lib/active_support/xml_mini.rb @@ -1,4 +1,5 @@ require 'time' +require 'base64' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/string/inflections' @@ -48,7 +49,7 @@ module ActiveSupport "symbol" => Proc.new { |symbol| symbol.to_s }, "date" => Proc.new { |date| date.to_s(:db) }, "datetime" => Proc.new { |time| time.xmlschema }, - "binary" => Proc.new { |binary| ActiveSupport::Base64.encode64(binary) }, + "binary" => Proc.new { |binary| ::Base64.encode64(binary) }, "yaml" => Proc.new { |yaml| yaml.to_yaml } } unless defined?(FORMATTING) @@ -64,7 +65,7 @@ module ActiveSupport "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) }, "string" => Proc.new { |string| string.to_s }, "yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml }, - "base64Binary" => Proc.new { |bin| ActiveSupport::Base64.decode64(bin) }, + "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) }, "binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) }, "file" => Proc.new { |file, entity| _parse_file(file, entity) } } @@ -148,14 +149,14 @@ module ActiveSupport def _parse_binary(bin, entity) #:nodoc: case entity['encoding'] when 'base64' - ActiveSupport::Base64.decode64(bin) + ::Base64.decode64(bin) else bin end end def _parse_file(file, entity) - f = StringIO.new(ActiveSupport::Base64.decode64(file)) + f = StringIO.new(::Base64.decode64(file)) f.extend(FileLike) f.original_filename = entity['name'] f.content_type = entity['content_type'] |