Sha256: a127826c70d82647c3bf2af3ac9edaf312d155abd6537b4d8d6bef0d8d95435b

Contents?: true

Size: 517 Bytes

Versions: 2

Compression:

Stored size: 517 Bytes

Contents

# encoding: UTF-8

# Extentions to the core `String` class
#
class String
  # Convert a file name to a Sinatra-compliant template name
  #
  # @example
  #   "blog.haml".templatize              #=> :blog
  #   "blog/home.erb".templatize          #=> :"blog/home"
  #   "page.html.liquid".templatize       #=> :"page.html"
  #   "article/post.html.haml".templatize #=> :"article/post.html"
  #
  # @return [Symbol] A Sinatra-compliant template name
  #
  def templatize
    self.rpartition(".").shift.to_sym
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mango-0.6.3 lib/mango/core_ext/string.rb
mango-0.6.2 lib/mango/core_ext/string.rb