Module: Poesie
- Defined in:
- lib/log.rb,
lib/poesie.rb,
lib/filters.rb,
lib/version.rb,
lib/exporter.rb,
lib/apple_formatter.rb,
lib/android_formatter.rb,
lib/context_formatter.rb
Defined Under Namespace
Modules: AndroidFormatter, AppleFormatter, ContextFormatter, Filters, Log Classes: Exporter
Constant Summary collapse
- VERSION =
'1.5.2'
Class Method Summary collapse
- .exit_with_error(message) ⇒ Object
-
.process(text, substitutions) ⇒ Object
Apply the list of text substitutions to the given string.
Class Method Details
.exit_with_error(message) ⇒ Object
11 12 13 14 |
# File 'lib/poesie.rb', line 11 def self.exit_with_error() Log::error exit 1 end |
.process(text, substitutions) ⇒ Object
Apply the list of text substitutions to the given string
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/poesie.rb', line 23 def self.process(text, substitutions) return text if substitutions.nil? replaced = text.dup list = substitutions list = [substitutions] if substitutions.is_a?(Hash) list.each do |hash| hash.each do |k,v| # If the key is surrounding by slashes, interpret as a RegExp k = Regexp.new($1) if k =~ %r(^/(.*)/$) replaced.gsub!(k, v) end end replaced end |