{"issue":{"created_at":"2011-12-05T00:04:34Z","state":"open","updated_at":"2011-12-08T06:51:20Z","comments":4,"user":{"gravatar_id":"e9e852b18079792bc5f4ec52b8e37c53","id":7371,"url":"https://api.github.com/users/mcmire","avatar_url":"https://secure.gravatar.com/avatar/e9e852b18079792bc5f4ec52b8e37c53?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"mcmire"},"body":"I just get confused every time I use Padrino.root because I expect it to work like Rails.root, in that you can say `Rails.root.join(foo, bar)` as an alias for `\"#{Rails.root}/#{foo}/#{bar}\"`, which I really like because no need to reimplement functionality that Pathname already gives you. I know this would break everything (and that's the last thing I want to do), but OTOH I figure if we can reduce the number of API differences between Rails and Padrino, the better it is for everyone. Is this something you could possibly consider for 1.0?","assignee":null,"id":2444573,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":730,"title":"Padrino.root should return a Pathname","html_url":"https://github.com/padrino/padrino-framework/issues/730","closed_at":null,"url":"https://api.github.com/repos/padrino/padrino-framework/issues/730","milestone":{"created_at":"2011-04-10T03:33:40Z","state":"open","closed_issues":2,"due_on":"2011-12-31T08:00:00Z","creator":{"gravatar_id":"5107da17070b85827213aef1129ef61f","id":24772,"url":"https://api.github.com/users/achiu","avatar_url":"https://secure.gravatar.com/avatar/5107da17070b85827213aef1129ef61f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"achiu"},"number":10,"description":"First Stable Release","title":"1.0.0","url":"https://api.github.com/repos/padrino/padrino-framework/milestones/10","open_issues":9}},"action":"created","comment":{"created_at":"2011-12-08T06:51:20Z","updated_at":"2011-12-08T06:51:20Z","user":{"gravatar_id":"e9e852b18079792bc5f4ec52b8e37c53","id":7371,"url":"https://api.github.com/users/mcmire","avatar_url":"https://secure.gravatar.com/avatar/e9e852b18079792bc5f4ec52b8e37c53?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"mcmire"},"body":"> What's wrong with the current Padrino.root(*args)?\r\n\r\nPeople that work in Rails every day and then switch to Padrino are going to expect one thing and get another, especially since .root is such a core method. It's even *named* after Rails.root and it doesn't work the same way.\r\n\r\n> Yep, and also this require an extra class to manage all magick things of Rails class\r\n\r\nTrue, although there's nothing really magic about it. What about something like this?\r\n\r\n~~~ ruby\r\nclass Pathnamelike < String\r\n  def initialize(*args); super(PADRINO_ROOT + _path_join(args)); end\r\n  def join(*args); self << _path_join(args); end\r\n  def _path_join(args); str = \"\"; args.each {|arg| str << \"/\" + arg }; str; end\r\nend\r\n\r\nmodule Padrino\r\n  def self.root(*args)\r\n    Pathnamelike.new(*args)\r\n  end\r\nend\r\n~~~\r\n\r\nSo now all of these should work:\r\n\r\n~~~ ruby\r\nPadrino.root\r\nPadrino.root + 'foo/bar'\r\nPadrino.root.join('foo/bar')\r\nPadrino.root('foo/bar') + 'baz/quux'\r\n~~~\r\n\r\nJust an idea....","id":3058600,"url":"https://api.github.com/repos/padrino/padrino-framework/issues/comments/3058600"}}