class Stevenson::Template::Loader

Attributes

options[R]
template_name[R]

Public Class Methods

new(template_name, options) click to toggle source
# File lib/stevenson/template/loader.rb, line 6
def initialize(template_name, options)
  @template_name, @options = template_name, options
end

Public Instance Methods

template() click to toggle source
# File lib/stevenson/template/loader.rb, line 10
def template
  return Template.load(matching_alias.name, matching_alias.options) if matching_alias?

  template_klass.new template_name, options
end
template_klass() click to toggle source
# File lib/stevenson/template/loader.rb, line 16
def template_klass
  case template_name
  when /^.*\.git$/
    Template::Git
  else
    Template::Local
  end
end

Private Instance Methods

matching_alias() click to toggle source
# File lib/stevenson/template/loader.rb, line 27
def matching_alias
  Stevenson.dotfile.template_aliases.fetch(template_name, nil)
end
matching_alias?() click to toggle source
# File lib/stevenson/template/loader.rb, line 31
def matching_alias?
  !!matching_alias
end