Class: I18nliner::Processors::ErbProcessor

Inherits:
RubyProcessor show all
Defined in:
lib/i18nliner/processors/erb_processor.rb

Constant Summary collapse

VIEW_PATH =
%r{\A(.*/)?app/views/(.*?)\.(erb|html\.erb)\z}

Constants inherited from RubyProcessor

RubyProcessor::CONTROLLER_PATH

Instance Attribute Summary

Attributes inherited from AbstractProcessor

#file_count, #translation_count

Instance Method Summary collapse

Methods inherited from RubyProcessor

#check_contents, #source_for

Methods inherited from AbstractProcessor

#check_file, #check_files, default_pattern, #files, inherited, #initialize, #noop_checker

Constructor Details

This class inherits a constructor from I18nliner::Processors::AbstractProcessor

Instance Method Details

#pre_process(source) ⇒ Object


15
16
17
# File 'lib/i18nliner/processors/erb_processor.rb', line 15

def pre_process(source)
  I18nliner::Erubis.new(source).src
end

#scope_for(path) ⇒ Object


26
27
28
29
30
31
32
33
34
# File 'lib/i18nliner/processors/erb_processor.rb', line 26

def scope_for(path)
  scope = path.dup
  if scope.sub!(VIEW_PATH, '\2')
    scope = scope.gsub(/\/_?/, '.')
    Scope.new(scope, :allow_relative => true, :remove_whitespace => true, :context => self)
  else
    Scope.root
  end
end