diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-06-21 12:13:13 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-06-21 12:13:13 -0700 |
commit | 188cc90af9b29d5520564af7bd7bbcdc647953ca (patch) | |
tree | 55b2a83fb9f3963abd16a6467d40a7042f27e4b0 /actionpack | |
parent | e76ced062078e1aeffcb963d28f144fe5e169139 (diff) | |
download | rails-188cc90af9b29d5520564af7bd7bbcdc647953ca.tar.gz rails-188cc90af9b29d5520564af7bd7bbcdc647953ca.tar.bz2 rails-188cc90af9b29d5520564af7bd7bbcdc647953ca.zip |
stop subclassing string
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/template/resolver.rb | 13 | ||||
-rw-r--r-- | actionpack/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 |