From: "Mr. Bill" Date: 2011-01-17T23:45:03+09:00 Subject: Re: what's the difference between these two snippets of ruby? Got it. Thank you much. Josh Cheek wrote in post #975146: > On Sat, Jan 15, 2011 at 8:06 AM, Mr. Bill wrote: > >> File.dirname(yaml_path)) >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > The second version modifies config['parent'] > > If you want the second version, which is much easier to understand, imo. > But > don't want the side effect of changing the config hash, then use gsub > without the bang, and assign it to a local variable: > > parent = config['parent'].gsub("${project_dir}", PROJECT_ROOT) > parent_path = File.expand_path( parent , File.dirname(yaml_path) ) -- Posted via http://www.ruby-forum.com/.