Class: AwesomeTranslations::ErbInspector
- Inherits:
-
Object
- Object
- AwesomeTranslations::ErbInspector
- Defined in:
- lib/awesome_translations/erb_inspector.rb
Overview
Used to find translations in the Rails app by inspecting .erb- and .haml-files.
Defined Under Namespace
Classes: FileInspector, TranslationInspector
Instance Method Summary collapse
- #file(root_path, file_path) ⇒ Object
-
#files ⇒ Object
Yields all relevant .erb- and .haml-files.
-
#initialize(args = {}) ⇒ ErbInspector
constructor
A new instance of ErbInspector.
Constructor Details
#initialize(args = {}) ⇒ ErbInspector
Returns a new instance of ErbInspector.
5 6 7 8 9 10 11 |
# File 'lib/awesome_translations/erb_inspector.rb', line 5 def initialize(args = {}) @args = args @args[:exts] ||= [".erb", ".haml", ".liquid", ".markerb", ".rb", ".rake", ".slim"] + AwesomeTranslations::ErbInspector::FileInspector::JS_FILE_EXTS @dirs = @args[:dirs] || AwesomeTranslations.config.paths_to_translate @ignored_folders = @args[:ignored_folders] || AwesomeTranslations.config.ignored_paths end |
Instance Method Details
#file(root_path, file_path) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/awesome_translations/erb_inspector.rb', line 22 def file(root_path, file_path) AwesomeTranslations::ErbInspector::FileInspector.new( file_path: file_path, root_path: root_path ) end |
#files ⇒ Object
Yields all relevant .erb- and .haml-files.
14 15 16 17 18 19 20 |
# File 'lib/awesome_translations/erb_inspector.rb', line 14 def files Enumerator.new do |yielder| @dirs.each do |dir| scan_dir("", dir, yielder) end end end |