Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

only typecast what we need to typecast

  • Loading branch information...
commit 7cd3772fe65702b6fd0574a5f435efe33c60818c 1 parent b14f1c3
Aaron Patterson tenderlove authored
Showing with 9 additions and 11 deletions.
  1. +9 −11 actionpack/lib/action_view/path_set.rb
20 actionpack/lib/action_view/path_set.rb
View
@@ -6,8 +6,7 @@ class PathSet #:nodoc:
attr_reader :paths
def initialize(paths = [])
- @paths = paths
- typecast!
+ @paths = typecast paths
end
def initialize_copy(other)
@@ -19,10 +18,6 @@ def to_ary
paths.dup
end
- def +(array)
- PathSet.new(paths + array)
- end
-
def include?(item)
paths.include? item
end
@@ -35,19 +30,22 @@ def size
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 @@ def exists?(path, prefixes, *args)
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)
Please sign in to comment.
Something went wrong with that request. Please try again.