Class: Generator::TemplateDir
- Inherits:
-
Object
- Object
- Generator::TemplateDir
- Defined in:
- lib/ngi/generator.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
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
-
#initialize(component) ⇒ TemplateDir
constructor
A new instance of TemplateDir.
- #read ⇒ Object
Constructor Details
#initialize(component) ⇒ TemplateDir
Returns a new instance of TemplateDir.
58 59 60 61 62 |
# File 'lib/ngi/generator.rb', line 58 def initialize(component) @dir = "#{Utils::CurrentDir.dir}/templates/" @dir << "#{component['type']}/#{component['language']}" @dir << "/#{component['using']}/#{component['template']}" end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
56 57 58 |
# File 'lib/ngi/generator.rb', line 56 def dir @dir end |
Instance Method Details
#read ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/ngi/generator.rb', line 64 def read f = File.open(@dir) content = f.read f.close content end |