Skip to main content

Featured

Ruby Tips - How to figure out where a method is defined

The other day when I was dabbling with the huge codebase, I was wondering where a particular method was being declared for a specific method. I wanted to know this because my greps didn't turn out to volatile and didn't return any results



The Solution The Ruby interpreter has certain methods that can be used for identifying under which module or class, the particular method is being defined. See the example below.

So using the .source_location you will be able to figure which file it has been declared.

How to show full file path in the status bar or title bar in Sublime and Visual Studio Code

You can see that the full file path is being show at the top title bar.

If you feel that you want to show the full file paths in your favorite editors - Sublime Text and Visual Studio Code, follow the simple steps below:

Sublime Text (on a Mac):

Goto Sublime Text -> Preferences -> Settings and add the following:

{
    "show_full_path": true
}

Visual Studio Code (on a Mac):

Goto Visual Studio, Code -> Preferences -> Settings and add the following:

{
    "window.title": "${activeEditorLong}"
}

As a small tweak, i added the following into my visual studio title, as it allows any custom string:

{
    "window.title": "${activeEditorLong} - work hard, play harder"
}

Now you can see the full path of the files in the top title bar.

Comments

preston said…
got mine working too.

Popular Posts

You will receive wonderful short stories written by him and inspirational articles once every month.