提交 188cc90a 编写于 作者: A Aaron Patterson

stop subclassing string

上级 e76ced06
......@@ -7,7 +7,7 @@ module ActionView
# = Action View Resolver
class Resolver
# Keeps all information about view path and builds virtual path.
class Path < String
class Path
attr_reader :name, :prefix, :partial, :virtual
alias_method :partial?, :partial
......@@ -19,9 +19,16 @@ def self.build(name, prefix, partial)
end
def initialize(name, prefix, partial, virtual)
@name, @prefix, @partial = name, prefix, partial
super(virtual)
@name = name
@prefix = prefix
@partial = partial
@virtual = virtual
end
def to_str
@virtual
end
alias :to_s :to_str
end
cattr_accessor :caching
......
......@@ -6,7 +6,7 @@ def test_should_return_template_for_any_path
templates = resolver.find_all("path.erb", "arbitrary", false, {:locale => [], :formats => [:html], :handlers => []})
assert_equal 1, templates.size, "expected one template"
assert_equal "Template generated by Null Resolver", templates.first.source
assert_equal "arbitrary/path.erb", templates.first.virtual_path
assert_equal "arbitrary/path.erb", templates.first.virtual_path.to_s
assert_equal [:html], templates.first.formats
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册