Class: GettextI18nRails::BaseParser

### Home Classes Methods

### In Files

- lib/gettext_i18n_rails/base_parser.rb

### Parent

Object

### Methods

- ::load_library
- ::parse
- ::target?

### Class/Module Index

Quicksearch

- GettextI18nRails
- GettextI18nRails::Backend
- GettextI18nRails::BaseParser
- GettextI18nRails::GettextHooks
- GettextI18nRails::HamlParser
- GettextI18nRails::HtmlSafeTranslations
- GettextI18nRails::ModelAttributesFinder
- GettextI18nRails::Railtie
- GettextI18nRails::SlimParser
- RubyGettextExtractor
- RubyGettextExtractor::Extractor18
- RubyGettextExtractor::Extractor19
- RubyGettextExtractor::ExtractorMethods
- ActionController
- ActionController::Base
- ActiveModel
- ActiveModel::Translation
- ActiveRecord
- ActiveRecord::Base
- I18n
- I18n::Config
- Object
- String

No matching classes.

# GettextI18nRails::BaseParser

### Public Class Methods

load_library() click to toggle source

    # File lib/gettext_i18n_rails/base_parser.rb, line 18
    def self.load_library
      return true if @library_loaded

      begin
        require extension
      rescue LoadError
        puts "A #{extension} file was found, but #{extension} library could not be found, so nothing will be parsed..."
        return false
      end

      require 'gettext_i18n_rails/ruby_gettext_extractor'
      @library_loaded = true
    end

parse(file, msgids = []) click to toggle source

    # File lib/gettext_i18n_rails/base_parser.rb, line 9
    def self.parse(file, msgids = [])
      return msgids unless load_library
      code = convert_to_code(File.read(file))
      RubyGettextExtractor.parse_string(code, file, msgids)
    rescue Racc::ParseError => e
      $stderr.puts "file ignored: ruby_parser cannot read #{extension} files with 1.9 syntax --- #{file}: (#{e.message.strip})"
      return msgids
    end

target?(file) click to toggle source

    # File lib/gettext_i18n_rails/base_parser.rb, line 5
    def self.target?(file)
      File.extname(file) == ".#{extension}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.