From 188cc90af9b29d5520564af7bd7bbcdc647953ca Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 21 Jun 2012 12:13:13 -0700 Subject: [PATCH] stop subclassing string --- actionpack/lib/action_view/template/resolver.rb | 13 ++++++++++--- .../test/template/testing/null_resolver_test.rb | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index fa2038f78d..9c50d94624 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -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 diff --git a/actionpack/test/template/testing/null_resolver_test.rb b/actionpack/test/template/testing/null_resolver_test.rb index 535ad3ab14..55ec36e753 100644 --- a/actionpack/test/template/testing/null_resolver_test.rb +++ b/actionpack/test/template/testing/null_resolver_test.rb @@ -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