Sha256: e46f3eb397ff5a7a4a730e45653da141ab3566246ed3c30e1ec9297926317332
Contents?: true
Size: 774 Bytes
Versions: 8
Compression:
Stored size: 774 Bytes
Contents
require 'lotus/utils/string' module Lotus module View module Rendering # @since 0.2.0 class TemplateName NAMESPACE_SEPARATOR = '::'.freeze def initialize(name, namespace) @name = name compile!(namespace) end def to_s @name end private def compile!(namespace) tokens(namespace) {|token| replace!(token) } @name = Utils::String.new(@name).underscore end def tokens(namespace) namespace.to_s.split(NAMESPACE_SEPARATOR).each do |token| yield token end end def replace!(token) @name.gsub!(%r{\A#{ token }#{ NAMESPACE_SEPARATOR }}, '') end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems