aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-05-31 22:43:53 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-05-31 22:43:53 +0000
commitd31830cf9cc863ed2f98c2d4cb90cf0e5d93e73e (patch)
treef9c47331207411fea435c5057dea209e869f5c13 /activesupport/lib
parent05a17dc6b57e77171976a009b331511eae95200f (diff)
downloadrails-d31830cf9cc863ed2f98c2d4cb90cf0e5d93e73e.tar.gz
rails-d31830cf9cc863ed2f98c2d4cb90cf0e5d93e73e.tar.bz2
rails-d31830cf9cc863ed2f98c2d4cb90cf0e5d93e73e.zip
fix test warnings
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4386 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/load_error.rb6
-rw-r--r--activesupport/lib/active_support/ordered_options.rb46
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb2
3 files changed, 28 insertions, 26 deletions
diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb
index fac4639eed..6165e95443 100644
--- a/activesupport/lib/active_support/core_ext/load_error.rb
+++ b/activesupport/lib/active_support/core_ext/load_error.rb
@@ -8,7 +8,7 @@ class MissingSourceFile < LoadError #:nodoc:
def is_missing?(path)
path.gsub(/\.rb$/, '') == self.path.gsub(/\.rb$/, '')
end
-
+
def self.from_message(message)
REGEXPS.each do |regexp, capture|
match = regexp.match(message)
@@ -16,12 +16,12 @@ class MissingSourceFile < LoadError #:nodoc:
end
nil
end
-
+
REGEXPS = [
[/^no such file to load -- (.+)$/i, 1],
[/^Missing \w+ (file\s*)?([^\s]+.rb)$/i, 2],
[/^Missing API definition file in (.+)$/i, 1]
- ]
+ ] unless defined?(REGEXPS)
end
module ActiveSupport #:nodoc:
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb
index 1e925145aa..48b5c92454 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -1,35 +1,37 @@
# OrderedHash is namespaced to prevent conflicts with other implementations
-class ActiveSupport::OrderedHash < Array #:nodoc:
- def []=(key, value)
- if pair = find_pair(key)
- pair.pop
- pair << value
- else
- self << [key, value]
+module ActiveSupport
+ class OrderedHash < Array #:nodoc:
+ def []=(key, value)
+ if pair = find_pair(key)
+ pair.pop
+ pair << value
+ else
+ self << [key, value]
+ end
end
- end
-
- def [](key)
- pair = find_pair(key)
- pair ? pair.last : nil
- end
- def keys
- self.collect { |i| i.first }
- end
+ def [](key)
+ pair = find_pair(key)
+ pair ? pair.last : nil
+ end
- private
- def find_pair(key)
- self.each { |i| return i if i.first == key }
- return false
+ def keys
+ self.collect { |i| i.first }
end
+
+ private
+ def find_pair(key)
+ self.each { |i| return i if i.first == key }
+ return false
+ end
+ end
end
class OrderedOptions < ActiveSupport::OrderedHash #:nodoc:
def []=(key, value)
super(key.to_sym, value)
end
-
+
def [](key)
super(key.to_sym)
end
@@ -41,4 +43,4 @@ class OrderedOptions < ActiveSupport::OrderedHash #:nodoc:
self[name]
end
end
-end \ No newline at end of file
+end
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 3aa135c28f..c67af60926 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -169,7 +169,7 @@ class TimeZone
# A regular expression that matches the names of all time zones in
# the USA.
- US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/
+ US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/ unless defined?(US_ZONES)
# A convenience method for returning a collection of TimeZone objects
# for time zones in the USA.