Module GetText::ErbContainer
In: lib/gettext/erb.rb

This module provides basic functions to evaluate plural ERB files(.rhtml) in a TextDomain. You need to implement a class which includes GetText::ErbContainer.

See simple examples below:

 require 'gettext/erb'
 class SimpleContainer
   include GetText::ErbContainer

   def initialize(domainname, domainpath = nil, locale = nil, charset = nil)
     bindtextdomain(domainname, domainpath, locale)
   end
 end

 container = SimpleContainer.new("helloerb1", "locale")
 puts container.eval_file("/your/erb/file.rhtml")

This module is an example for template engines such as ERB. You can implement another implementation easily to read gettext/erb.rb.

Methods

Included Modules

GetText

Public Instance methods

Evaluates ERB file in the instance and returns the result HTML.

  • rhtml: an ERB file
  • Returns: the Evaluated ERB result

[Source]

    # File lib/gettext/erb.rb, line 52
52:     def eval_file(rhtmlpath)
53:       eval_src(IO.read(rhtmlpath))
54:     end

Evaluates ERB source(String) in the instance and returns the result HTML.

  • rhtml: an ERB source
  • Returns: the Evaluated ERB result

[Source]

    # File lib/gettext/erb.rb, line 43
43:     def eval_src(rhtml)
44:       erb = ERB.new(rhtml).src
45:       eval(erb, binding)
46:     end

[Validate]