Class: ReadyForI18N::I18nGenerator
- Inherits:
-
Object
- Object
- ReadyForI18N::I18nGenerator
- Defined in:
- lib/i18n_generator.rb
Constant Summary collapse
- EXTRACTORS =
[ErbHelperExtractor,HtmlTextExtractor,HtmlAttrExtractor]
- PATH_PATTERN =
/\/views\/(.*)/
Class Method Summary collapse
Class Method Details
.excute(opt) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/i18n_generator.rb', line 6 def self.excute(opt) setupOptions(opt) Dir.glob(File.join(@src_path,"**#{File::SEPARATOR}*#{@ext}")).each do |f| path = f.match(PATH_PATTERN)[1].gsub(/#{@ext}$/,'').split '/' if opt['dot'] && f =~ PATH_PATTERN result = EXTRACTORS.inject(File.read(f)) do |buffer,extractor| extractor.new.extract(buffer){|k,v| @dict.push(k,v,path)} end write_target_file(f,result) if @target_path end @dict.write_to STDOUT end |