Class: Haml::MagicTranslations::XGetText::HamlParser::XGetTextParser
- Inherits:
-
Object
- Object
- Haml::MagicTranslations::XGetText::HamlParser::XGetTextParser
- Defined in:
- lib/haml/magic_translations/xgettext/haml_parser.rb
Overview
:nodoc:all
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(file) ⇒ XGetTextParser
constructor
A new instance of XGetTextParser.
- #parse ⇒ Object
Constructor Details
#initialize(file) ⇒ XGetTextParser
Returns a new instance of XGetTextParser.
29 30 31 32 33 34 35 36 37 |
# File 'lib/haml/magic_translations/xgettext/haml_parser.rb', line 29 def initialize(file) if file.respond_to? :read @file = '(haml)' @content = file.read else @file = file @content = File.open(file).read end end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
28 29 30 |
# File 'lib/haml/magic_translations/xgettext/haml_parser.rb', line 28 def content @content end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
27 28 29 |
# File 'lib/haml/magic_translations/xgettext/haml_parser.rb', line 27 def file @file end |
Instance Method Details
#parse ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/haml/magic_translations/xgettext/haml_parser.rb', line 39 def parse # Engine#initialize parses and compiles HamlEngineCompiler.filename = @file Haml::Engine.new( content, :filename => @file, :parser_class => HamlEngineParser, :compiler_class => HamlEngineCompiler) targets = HamlEngineCompiler.targets HamlEngineCompiler.reset_targets targets end |