Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mango/core_ext/string.rb

Overview

Extentions to the core String class

Instance Method Summary collapse

Instance Method Details

#templatizeSymbol

Convert a file name to a Sinatra-compliant template name

Examples:

"blog.haml".templatize              #=> :blog
"blog/home.erb".templatize          #=> :"blog/home"
"page.html.liquid".templatize       #=> :"page.html"
"article/post.html.haml".templatize #=> :"article/post.html"

14
15
16
# File 'lib/mango/core_ext/string.rb', line 14

def templatize
  self.rpartition(".").shift.to_sym
end