vendor/bundle/ruby/2.3.0/gems/tilt-2.0.8/lib/tilt/mapping.rb
# Registers a lazy template implementation by file extension. You
# can have multiple lazy template implementations defined on the
# same file extension, in which case the template implementation
# defined *last* will be attempted loaded *first*.
#
# @param class_name [String] Class name of a template class.
# @param file [String] Filename where the template class is defined.
# @param extensions [Array<String>] List of extensions.
# @return [void]
#
# @example
#   mapping.register_lazy 'MyEngine::Template', 'my_engine/template',  'mt'
#
#   defined?(MyEngine::Template) # => false
#   mapping['index.mt'] # => MyEngine::Template
#   defined?(MyEngine::Template) # => true
Registers a lazy template implementation by file extension. You
can have multiple lazy template implementations defined on the
same file extension, in which case the template implementation
defined *last* will be attempted loaded *first*.
Registers a lazy template implementation by file extension . You can have multiple lazy template implementations defined on the same file extension in which case the template implementation defined * last * will be attempted loaded * first * .
def register_lazy(class_name, file, *extensions)
      if class_name.is_a?(Symbol)
        Tilt.autoload class_name, file
        class_name = "Tilt::#{class_name}"
      end
      extensions.each do |ext|
        @lazy_map[ext].unshift([class_name, file])
      end
    end
def register_lazy ( class_name , file , * extensions ) if class_name . is_a? ( Symbol ) Tilt . autoload class_name , file class_name = "Tilt::#{class_name}" end extensions . each do | ext | @lazy_map [ ext ] . unshift ( [ class_name , file ] ) end end
Registers a lazy template implementation by file extension.
Registers a lazy template implementation by file extension .
# Internal API
None
void
class_name
Class name of a template class.
Class name of a template class .
file
Filename where the template class is defined.
Filename where the template class is defined .
extensions
List of extensions.
List of extensions .
example
mapping.register_lazy 'MyEngine::Template', 'my_engine/template', 'mt' defined?(MyEngine::Template) # => false mapping['index.mt'] # => MyEngine::Template defined?(MyEngine::Template) # => true
mapping . register_lazy ' MyEngine :: Template ' ' my_engine / template ' ' mt ' defined? ( MyEngine :: Template ) # = > false mapping [ ' index . mt ' ] # = > MyEngine :: Template defined? ( MyEngine :: Template ) # = > true