Skip to content

Commit

Permalink
Merge pull request #5617 from Empact/paths
Browse files Browse the repository at this point in the history
Spring cleaning in Rails::Paths
  • Loading branch information
tenderlove committed Mar 29, 2012
2 parents e51322a + cec170b commit 1555023
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
6 changes: 1 addition & 5 deletions railties/lib/rails/paths.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'set'

module Rails
module Paths
# This object is an extended hash that behaves as root of the <tt>Rails::Paths</tt> system.
Expand Down Expand Up @@ -47,15 +45,13 @@ class Root
attr_accessor :path

def initialize(path)
raise "Argument should be a String of the physical root path" if path.is_a?(Array)
@current = nil
@path = path
@root = {}
end

def []=(path, value)
value = Path.new(self, path, [value].flatten) unless value.is_a?(Path)
@root[path] = value
add(path, :with => value)
end

def add(path, options={})
Expand Down
4 changes: 0 additions & 4 deletions railties/test/paths_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ def setup
assert_equal ["/foo/bar/app2", "/foo/bar/app"], @root["app"].to_a
end

test "the root can only have one physical path" do
assert_raise(RuntimeError) { Rails::Paths::Root.new(["/fiz", "/biz"]) }
end

test "it is possible to add a path that should be autoloaded only once" do
@root.add "app", :with => "/app"
@root["app"].autoload_once!
Expand Down

0 comments on commit 1555023

Please sign in to comment.