Module: RubyGettextExtractor

Extended by:
RubyGettextExtractor
Included in:
RubyGettextExtractor
Defined in:
lib/gettext_i18n_rails/ruby_gettext_extractor.rb

Defined Under Namespace

Modules: ExtractorMethods Classes: Extractor18, Extractor19

Instance Method Summary collapse

Instance Method Details

#parse(file, targets = []) ⇒ Object

:nodoc:



7
8
9
10
# File 'lib/gettext_i18n_rails/ruby_gettext_extractor.rb', line 7

def parse(file, targets = [])  # :nodoc:
  content = File.read(file)
  parse_string(content, file, targets)
end

#parse_string(content, file, targets = []) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/gettext_i18n_rails/ruby_gettext_extractor.rb', line 12

def parse_string(content, file, targets=[])
  # file is just for information in error messages

  parser = if RUBY_VERSION =~ /^1\.8/
    Extractor18.new(file, targets)
  else
    Extractor19.new(file, targets)
  end
  parser.run(content)
end

#target?(file) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


23
24
25
# File 'lib/gettext_i18n_rails/ruby_gettext_extractor.rb', line 23

def target?(file)  # :nodoc:
  return file =~ /\.rb$/
end