Sha256: 79c3279983d2c3a3debe0b008fcaa34084472ce1758ca2e7577708a23bc37b8e

Contents?: true

Size: 498 Bytes

Versions: 4

Compression:

Stored size: 498 Bytes

Contents

# 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

4 entries across 4 versions & 1 rubygems

Version Path
mango-0.9.0 lib/mango/core_ext/string.rb
mango-0.8.0 lib/mango/core_ext/string.rb
mango-0.7.1 lib/mango/core_ext/string.rb
mango-0.7.0 lib/mango/core_ext/string.rb