title: Ruby: Get filename without the extensions
body: <p>How can I get the filename without the extensions? For example, input of <code>&quot;/dir1/dir2/test.html.erb&quot;</code> should return <code>&quot;test&quot;</code>.</p>
  <p>In actual code I will passing in <code>__FILE__</code> instead of <code>&quot;/dir1/dir2/test.html.erb&quot;</code>.</p>