Class: Autolang::TranslationEscaper

Inherits:
Object
  • Object
show all
Defined in:
lib/autolang.rb

Overview

protects text from evil translation robots by ensuring phrases that should not be translated (Car|Engine, %name, …) stay untranslated

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ TranslationEscaper

Returns a new instance of TranslationEscaper.



102
103
104
105
# File 'lib/autolang.rb', line 102

def initialize(text)
  @text = text
  self.escaped = escape_text
end

Instance Attribute Details

#escapedObject

Returns the value of attribute escaped.



100
101
102
# File 'lib/autolang.rb', line 100

def escaped
  @escaped
end

Instance Method Details

#unescape(translation) ⇒ Object



107
108
109
# File 'lib/autolang.rb', line 107

def unescape(translation)
  remove_placeholders(translation)
end