Class: P::Template

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, name) ⇒ Template

Returns a new instance of Template.



7
8
9
10
11
12
# File 'lib/p/template.rb', line 7

def initialize(template, name)
  @template = template
  @path = find_template(template)
  @directory = File.join(File.dirname(@path), template)
  @name = name
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



5
6
7
# File 'lib/p/template.rb', line 5

def directory
  @directory
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/p/template.rb', line 5

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/p/template.rb', line 5

def path
  @path
end

#templateObject (readonly)

Returns the value of attribute template.



5
6
7
# File 'lib/p/template.rb', line 5

def template
  @template
end

Instance Method Details

#variablesObject



14
15
16
# File 'lib/p/template.rb', line 14

def variables
  { name: name }
end