activesupport 3.2.8 → 3.2.9.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

@@ -149,7 +149,7 @@ class String
149
149
  # @person = Person.find(1)
150
150
  # # => #<Person id: 1, name: "Donald E. Knuth">
151
151
  #
152
- # <%= link_to(@person.name, person_path %>
152
+ # <%= link_to(@person.name, person_path) %>
153
153
  # # => <a href="/person/1-donald-e-knuth">Donald E. Knuth</a>
154
154
  def parameterize(sep = '-')
155
155
  ActiveSupport::Inflector.parameterize(self, sep)
@@ -498,7 +498,7 @@ module ActiveSupport #:nodoc:
498
498
 
499
499
  file_path = search_for_file(path_suffix)
500
500
 
501
- if file_path && ! loaded.include?(File.expand_path(file_path)) # We found a matching file to load
501
+ if file_path && ! loaded.include?(File.expand_path(file_path).sub(/\.rb\z/, '')) # We found a matching file to load
502
502
  require_or_load file_path
503
503
  raise LoadError, "Expected #{file_path} to define #{qualified_name}" unless local_const_defined?(from_mod, const_name)
504
504
  return from_mod.const_get(const_name)
@@ -15,16 +15,27 @@ module ActiveSupport
15
15
  class TaggedLogging
16
16
  def initialize(logger)
17
17
  @logger = logger
18
- @tags = Hash.new { |h,k| h[k] = [] }
19
18
  end
20
19
 
21
- def tagged(*new_tags)
22
- tags = current_tags
23
- new_tags = Array.wrap(new_tags).flatten.reject(&:blank?)
24
- tags.concat new_tags
25
- yield
20
+ def tagged(*tags)
21
+ new_tags = push_tags(*tags)
22
+ yield self
26
23
  ensure
27
- new_tags.size.times { tags.pop }
24
+ pop_tags(new_tags.size)
25
+ end
26
+
27
+ def push_tags(*tags)
28
+ tags.flatten.reject(&:blank?).tap do |new_tags|
29
+ current_tags.concat new_tags
30
+ end
31
+ end
32
+
33
+ def pop_tags(size = 1)
34
+ current_tags.pop size
35
+ end
36
+
37
+ def clear_tags!
38
+ current_tags.clear
28
39
  end
29
40
 
30
41
  def silence(temporary_level = Logger::ERROR, &block)
@@ -46,7 +57,7 @@ module ActiveSupport
46
57
  end
47
58
 
48
59
  def flush
49
- @tags.delete(Thread.current)
60
+ clear_tags!
50
61
  @logger.flush if @logger.respond_to?(:flush)
51
62
  end
52
63
 
@@ -54,17 +65,16 @@ module ActiveSupport
54
65
  @logger.send(method, *args)
55
66
  end
56
67
 
57
- protected
58
-
59
- def tags_text
60
- tags = current_tags
61
- if tags.any?
62
- tags.collect { |tag| "[#{tag}]" }.join(" ") + " "
68
+ private
69
+ def tags_text
70
+ tags = current_tags
71
+ if tags.any?
72
+ tags.collect { |tag| "[#{tag}] " }.join
73
+ end
63
74
  end
64
- end
65
75
 
66
- def current_tags
67
- @tags[Thread.current]
68
- end
76
+ def current_tags
77
+ Thread.current[:activesupport_tagged_logging_tags] ||= []
78
+ end
69
79
  end
70
80
  end
@@ -177,7 +177,11 @@ module ActiveSupport
177
177
  # Replaces <tt>%Z</tt> and <tt>%z</tt> directives with +zone+ and +formatted_offset+, respectively, before passing to
178
178
  # Time#strftime, so that zone information is correct
179
179
  def strftime(format)
180
- format = format.gsub('%Z', zone).gsub('%z', formatted_offset(false))
180
+ format = format.gsub('%Z', zone).
181
+ gsub('%z', formatted_offset(false)).
182
+ gsub('%:z', formatted_offset(true)).
183
+ gsub('%::z', formatted_offset(true) + ":00")
184
+
181
185
  time.strftime(format)
182
186
  end
183
187
 
@@ -2,8 +2,8 @@ module ActiveSupport
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 8
6
- PRE = nil
5
+ TINY = 9
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.8
5
- prerelease:
4
+ version: 3.2.9.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Heinemeier Hansson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-09 00:00:00.000000000 Z
12
+ date: 2012-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -281,12 +281,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
281
  required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  none: false
283
283
  requirements:
284
- - - ! '>='
284
+ - - ! '>'
285
285
  - !ruby/object:Gem::Version
286
- version: '0'
287
- segments:
288
- - 0
289
- hash: -279525722930636109
286
+ version: 1.3.1
290
287
  requirements: []
291
288
  rubyforge_project:
292
289
  rubygems_version: 1.8.24