Class: Translatomatic::Extractor::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/translatomatic/extractor/base.rb

Overview

Base class for string extraction functionality

Direct Known Subclasses

Ruby

Instance Method Summary collapse

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

#extractArray<String>



11
12
13
# File 'lib/translatomatic/extractor/base.rb', line 11

def extract
  @contents.scan(/\"(.*?[^\\])"|'(.*?[^\\])'/).flatten.compact
end