Class: Haml::MagicTranslations::RGetText::HamlParser::Parser
- Inherits:
-
Object
- Object
- Haml::MagicTranslations::RGetText::HamlParser::Parser
- Defined in:
- lib/haml/magic_translations/rgettext/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) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(file) ⇒ Parser
Returns a new instance of Parser.
29 30 31 32 33 34 35 36 37 |
# File 'lib/haml/magic_translations/rgettext/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/rgettext/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/rgettext/haml_parser.rb', line 27 def file @file end |
Instance Method Details
#parse ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/haml/magic_translations/rgettext/haml_parser.rb', line 39 def parse Haml::Engine.send(:include, RGetTextEngine) engine = Haml::Engine.new( content, :filename => @file, :rgettext => true, :magic_translations => false).targets end |