Class: TranslatableString

Inherits:
String
  • Object
show all
Defined in:
lib/translate_self/translatable_string.rb

Overview

A class that let’s you translate strings with the language and to_language params even if you happen to freeze them. Aliased to TString.

Constant Summary

Constants included from Translation

Translation::LANGUAGES

Instance Attribute Summary

Attributes included from Translation

#language

Instance Method Summary collapse

Methods included from Translation

#available_languages, #lan, #to_language, #to_language=, #translate, #translate!

Constructor Details

#initialize(str, language: nil, to_language: nil) ⇒ TranslatableString

Returns a new instance of TranslatableString.



5
6
7
8
9
# File 'lib/translate_self/translatable_string.rb', line 5

def initialize(str, language: nil, to_language: nil)
  super str
  self.language = language
  self.to_language = to_language
end