Class: LearnGenerate::TemplateLoader
- Inherits:
-
Object
- Object
- LearnGenerate::TemplateLoader
- Defined in:
- lib/learn_generate/template_loader.rb
Constant Summary collapse
- BASE_TEMPLATES =
[ 'fundamental-ruby', 'command-line', 'sql', 'activerecord', 'rake', 'erb-static-site', 'rack', 'sinatra-classic', 'sinatra-classic-db', 'sinatra-mvc', 'js', 'front-end', 'kids', 'readme' ]
Instance Attribute Summary collapse
-
#internet ⇒ Object
readonly
Returns the value of attribute internet.
-
#local_dir ⇒ Object
readonly
Returns the value of attribute local_dir.
-
#local_path ⇒ Object
readonly
Returns the value of attribute local_path.
-
#templates ⇒ Object
Returns the value of attribute templates.
Instance Method Summary collapse
-
#initialize(internet) ⇒ TemplateLoader
constructor
A new instance of TemplateLoader.
- #printable_list ⇒ Object
Constructor Details
#initialize(internet) ⇒ TemplateLoader
Returns a new instance of TemplateLoader.
23 24 25 26 27 28 29 |
# File 'lib/learn_generate/template_loader.rb', line 23 def initialize(internet) @internet = internet @local_dir = File.('~/.learn-generate') @local_path = File.('~/.learn-generate/templates') set_templates end |
Instance Attribute Details
#internet ⇒ Object (readonly)
Returns the value of attribute internet.
3 4 5 |
# File 'lib/learn_generate/template_loader.rb', line 3 def internet @internet end |
#local_dir ⇒ Object (readonly)
Returns the value of attribute local_dir.
3 4 5 |
# File 'lib/learn_generate/template_loader.rb', line 3 def local_dir @local_dir end |
#local_path ⇒ Object (readonly)
Returns the value of attribute local_path.
3 4 5 |
# File 'lib/learn_generate/template_loader.rb', line 3 def local_path @local_path end |
#templates ⇒ Object
Returns the value of attribute templates.
4 5 6 |
# File 'lib/learn_generate/template_loader.rb', line 4 def templates @templates end |
Instance Method Details
#printable_list ⇒ Object
31 32 33 34 35 |
# File 'lib/learn_generate/template_loader.rb', line 31 def printable_list templates.map.with_index do |template, index| "#{index+1}. #{template}" end.join("\n ") end |