Method: GetText::RGetText.add_parser

Defined in:
lib/gettext/tools/rgettext.rb

.add_parser(klass) ⇒ Object

Add an option parser the option parser module requires to have target?(file) and parser(file, ary) method.

require 'gettext/tools/rgettext'
module FooParser
  module_function
  def target?(file)
    File.extname(file) == '.foo'  # *.foo file only.
  end
  def parse(file, ary)
    :
    return ary # [["msgid1", "foo.rb:200"], ["msgid2", "bar.rb:300", "baz.rb:400"], ...]
  end
end

GetText::RGetText.add_parser(FooParser)


63
64
65
# File 'lib/gettext/tools/rgettext.rb', line 63

def add_parser(klass)
  @ex_parsers.insert(0, klass)
end