Class: Configure::TemplateDir

Inherits:
Object
  • Object
show all
Defined in:
lib/ngi/configure.rb

Overview

An extraction of the template file/directory for the generator… This way it can be separated, redefined, and tested.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component, language, template) ⇒ TemplateDir

Returns a new instance of TemplateDir.



55
56
57
58
59
# File 'lib/ngi/configure.rb', line 55

def initialize(component, language, template)
  @d = "#{Utils::CurrentDir.dir}/templates/"
  @d << "#{component['type']}/#{language}"
  @d << "/user/#{template}"
end

Instance Attribute Details

#dObject (readonly)

Returns the value of attribute d.



53
54
55
# File 'lib/ngi/configure.rb', line 53

def d
  @d
end

Instance Method Details

#readObject



61
62
63
64
65
66
67
# File 'lib/ngi/configure.rb', line 61

def read
  f = File.open(@d)
  content = f.read
  f.close

  content
end