GettextI18nRails::HamlParser

Public Instance Methods

load_haml() click to toggle source
# File lib/gettext_i18n_rails/haml_parser.rb, line 27
def load_haml
  return true if @haml_loaded
  begin
    require "#{::Rails.root.to_s}/vendor/plugins/haml/lib/haml"
  rescue LoadError
    begin
      require 'haml'  # From gem
    rescue LoadError
      puts "A haml file was found, but haml library could not be found, so nothing will be parsed..."
      return false
    end
  end
  @haml_loaded = true
end
parse(file, msgids = []) click to toggle source
# File lib/gettext_i18n_rails/haml_parser.rb, line 16
def parse(file, msgids = [])
  return msgids unless load_haml
  require 'gettext_i18n_rails/ruby_gettext_extractor'

  text = IO.readlines(file).join

  haml = Haml::Engine.new(text)
  code = haml.precompiled
  return RubyGettextExtractor.parse_string(code, file, msgids)
end
target?(file) click to toggle source
# File lib/gettext_i18n_rails/haml_parser.rb, line 12
def target?(file)
  File.extname(file) == '.haml'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.