Class: Twittbot::TemplateLister
- Inherits:
-
Object
- Object
- Twittbot::TemplateLister
- Includes:
- Thor::Shell
- Defined in:
- lib/twittbot/template_lister.rb
Overview
Class to list available templates
Instance Method Summary collapse
-
#initialize(options) ⇒ TemplateLister
constructor
A new instance of TemplateLister.
-
#list ⇒ Object
Prints the available templates to stdout.
Constructor Details
#initialize(options) ⇒ TemplateLister
Returns a new instance of TemplateLister.
7 8 9 10 |
# File 'lib/twittbot/template_lister.rb', line 7 def initialize() @options = {}.merge() @options['templates_dir'] = File. "../generators/templates", __FILE__ end |
Instance Method Details
#list ⇒ Object
Prints the available templates to stdout.
13 14 15 16 17 18 19 20 |
# File 'lib/twittbot/template_lister.rb', line 13 def list dirs = Dir["#{@options['templates_dir']}/*"] dirs.each do |dir| if File.exist? dir and File.directory? dir say File.basename(dir).gsub('_', '-') end end end |