Class: Translatomatic::Extractor::Base
- Inherits:
-
Object
- Object
- Translatomatic::Extractor::Base
- Defined in:
- lib/translatomatic/extractor/base.rb
Overview
Base class for string extraction functionality
Direct Known Subclasses
Instance Method Summary collapse
-
#extract ⇒ Array<String>
All strings found.
-
#initialize(path) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(path) ⇒ Base
5 6 7 8 |
# File 'lib/translatomatic/extractor/base.rb', line 5 def initialize(path) @path = path.kind_of?(Pathname) ? path : Pathname.new(path) @contents = @path.read end |
Instance Method Details
#extract ⇒ Array<String>
11 12 13 |
# File 'lib/translatomatic/extractor/base.rb', line 11 def extract @contents.scan(/\"(.*?[^\\])"|'(.*?[^\\])'/).flatten.compact end |