class Twittbot::TemplateLister

Class to list available templates

Public Class Methods

new(options) click to toggle source

@param options [Hash] The CLI options from Thor

# File lib/twittbot/template_lister.rb, line 7
def initialize(options)
  @options = {}.merge(options)
  @options['templates_dir'] = File.expand_path "../generators/templates", __FILE__
end

Public Instance Methods

list() click to toggle source

Prints the available templates to stdout.

# 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