Class: Veewee::Template

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path, env) ⇒ Template

Returns a new instance of Template.



8
9
10
11
12
13
# File 'lib/veewee/template.rb', line 8

def initialize(name, path, env)
  @name = name
  @path = path
  @env = env
  return self
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



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

def env
  @env
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


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

def exists?
  filename = Dir.glob("#{path}/definition.rb")
  if filename.length != 0
    env.logger.debug("[Template] template '#{name}' is valid")
    return true
  else
    return false
  end
end