shaik
shaik

Reputation: 153

What is the use of expand_path

I came across the following line of code

@base_dir = File.expand_path(".")

Can anyone tell what the use is of expand_path and the "." as a parameter?

Upvotes: 0

Views: 80

Answers (1)

DWilches
DWilches

Reputation: 23015

File.expand_path() receives a directory (like "." that denotes the current directory) and returns the absolute path of that same directory.

So in this case it will return the absolute path of the current working directory.

Look here the documentation of this method: http://ruby-doc.org/core-1.9.3/File.html

Upvotes: 2

Related Questions