Class: Languages

Inherits:
Object
  • Object
show all
Defined in:
lib/languages.rb

Class Method Summary collapse

Class Method Details

.currentObject



11
12
13
14
# File 'lib/languages.rb', line 11

def self.current
  langs = Dir.entries(File.join(File.dirname(__FILE__), "../app_generators"))
  langs.reject {|i| ((i == ".") or (i == ".."))}
end

.parse(args) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/languages.rb', line 3

def self.parse(args)
  lang = args.find {|arg| ((arg =~ /-l=/) or (arg =~ /--language=/)) }
  lang = "-l=ruby" if lang.nil?
  lang = lang.split('=')[1]
  raise "Supported languages: #{current.inspect}" if (!current.member?(lang))
  lang
end


16
17
18
19
20
# File 'lib/languages.rb', line 16

def self.print
  list = ""
  current.each {|lang| list << lang << '|'}
  list.chomp('|')
end