Class: Autolang::TranslationEscaper
- Inherits:
-
Object
- Object
- Autolang::TranslationEscaper
- 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
-
#escaped ⇒ Object
Returns the value of attribute escaped.
Instance Method Summary collapse
-
#initialize(text) ⇒ TranslationEscaper
constructor
A new instance of TranslationEscaper.
- #unescape(translation) ⇒ Object
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
#escaped ⇒ Object
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 |