Class: Stevenson::Template::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/stevenson/template/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_name, options) ⇒ Loader

Returns a new instance of Loader.



6
7
8
# File 'lib/stevenson/template/loader.rb', line 6

def initialize(template_name, options)
  @template_name, @options = template_name, options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/stevenson/template/loader.rb', line 4

def options
  @options
end

#template_nameObject (readonly)

Returns the value of attribute template_name.



4
5
6
# File 'lib/stevenson/template/loader.rb', line 4

def template_name
  @template_name
end

Instance Method Details

#templateObject



10
11
12
13
14
# 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_klassObject



16
17
18
19
20
21
22
23
# File 'lib/stevenson/template/loader.rb', line 16

def template_klass
  case template_name
  when /^.*\.git$/
    Template::Git
  else
    Template::Local
  end
end