mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
stop subclassing string
This commit is contained in:
parent
e76ced0620
commit
188cc90af9
2 changed files with 11 additions and 4 deletions
|
@ -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 @@ module ActionView
|
|||
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 @@ class NullResolverTest < ActiveSupport::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue