Class: LearnGenerate::TemplateLoader

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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.expand_path('~/.learn-generate')
  @local_path = File.expand_path('~/.learn-generate/templates')

  set_templates
end

Instance Attribute Details

#internetObject (readonly)

Returns the value of attribute internet.



3
4
5
# File 'lib/learn_generate/template_loader.rb', line 3

def internet
  @internet
end

#local_dirObject (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_pathObject (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

#templatesObject

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_listObject



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