Class: Configure::TemplateDir
- Inherits:
-
Object
- Object
- Configure::TemplateDir
- 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
-
#d ⇒ Object
readonly
Returns the value of attribute d.
Instance Method Summary collapse
-
#initialize(component, language, template) ⇒ TemplateDir
constructor
A new instance of TemplateDir.
- #read ⇒ Object
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
#d ⇒ Object (readonly)
Returns the value of attribute d.
53 54 55 |
# File 'lib/ngi/configure.rb', line 53 def d @d end |
Instance Method Details
#read ⇒ Object
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 |