aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-08-09 11:26:44 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-08-09 11:26:44 -0700
commit7cd3772fe65702b6fd0574a5f435efe33c60818c (patch)
treedea24c7dcc31932ebb974e21ddd4b2b966b9ec07 /actionpack
parentb14f1c3ad72f7aeef4f725637b835da56bcd7d39 (diff)
downloadrails-7cd3772fe65702b6fd0574a5f435efe33c60818c.tar.gz
rails-7cd3772fe65702b6fd0574a5f435efe33c60818c.tar.bz2
rails-7cd3772fe65702b6fd0574a5f435efe33c60818c.zip
only typecast what we need to typecast
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/path_set.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/path_set.rb b/actionpack/lib/action_view/path_set.rb
index b84d9431a4..e9773120c7 100644
--- a/actionpack/lib/action_view/path_set.rb
+++ b/actionpack/lib/action_view/path_set.rb
@@ -6,8 +6,7 @@ module ActionView #:nodoc:
attr_reader :paths
def initialize(paths = [])
- @paths = paths
- typecast!
+ @paths = typecast paths
end
def initialize_copy(other)
@@ -19,10 +18,6 @@ module ActionView #:nodoc:
paths.dup
end
- def +(array)
- PathSet.new(paths + array)
- end
-
def include?(item)
paths.include? item
end
@@ -35,19 +30,22 @@ module ActionView #:nodoc:
paths.size
end
+ def each(&block)
+ paths.each(&block)
+ end
+
def compact
PathSet.new paths.compact
end
- def each(&block)
- paths.each(&block)
+ def +(array)
+ PathSet.new(paths + array)
end
%w(<< concat push insert unshift).each do |method|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{method}(*args)
- paths.#{method}(*args)
- typecast!
+ paths.#{method}(*typecast(args))
end
METHOD
end
@@ -73,7 +71,7 @@ module ActionView #:nodoc:
protected
- def typecast!
+ def typecast(paths)
paths.each_with_index do |path, i|
path = path.to_s if path.is_a?(Pathname)
next unless path.is_a?(String)