class I18nChecker::Locale::Collector::Ruby

Attributes

file_caches[R]

Public Class Methods

new(file_caches = I18nChecker::Cache::Files.new) click to toggle source
# File lib/i18n_checker/locale/collector/ruby.rb, line 15
def initialize(file_caches = I18nChecker::Cache::Files.new)
  @file_caches = file_caches
end

Public Instance Methods

collect(source_file) click to toggle source
# File lib/i18n_checker/locale/collector/ruby.rb, line 19
def collect(source_file)
  I18nChecker::Locale::Texts.new(process(source_file))
end

Private Instance Methods

buffer_of(source_file) click to toggle source
# File lib/i18n_checker/locale/collector/ruby.rb, line 25
def buffer_of(source_file)
  source = file_caches.read(source_file).to_s
  source_buffer = Parser::Source::Buffer.new('(string)')
  source_buffer.source = source
  source_buffer
end
parse_source(source_file) click to toggle source
# File lib/i18n_checker/locale/collector/ruby.rb, line 32
def parse_source(source_file)
  parser = Parser::CurrentRuby.new
  parser.parse(buffer_of(source_file))
end
process(source_file) click to toggle source
# File lib/i18n_checker/locale/collector/ruby.rb, line 37
def process(source_file)
  processor = I18nChecker::Locale::TextProcessor.new(file: source_file)
  processor.process(parse_source(source_file))
  processor.locale_texts
end