Class: Wookie::Translator
- Inherits:
-
Object
- Object
- Wookie::Translator
- Defined in:
- lib/wookie/translator.rb
Overview
Translates a given string either from wookie to english or vice versa.
Instance Method Summary collapse
-
#from_wookie(str) ⇒ String
Translates a string from wookiespeak to english using the dialect given to the initializer.
-
#initialize(options = { :dialect => Wookie::Dialect::Simple }) ⇒ Translator
constructor
Contructor, defines the dialect (Dialect::Simple by default).
-
#to_wookie(str) ⇒ String
Translates an english string to wookiespeak using the dialect given to the initializer.
Constructor Details
#initialize(options = { :dialect => Wookie::Dialect::Simple }) ⇒ Translator
Contructor, defines the dialect (Dialect::Simple by default).
9 10 11 |
# File 'lib/wookie/translator.rb', line 9 def initialize(={ :dialect => Wookie::Dialect::Simple }) @dialect = [:dialect].new end |
Instance Method Details
#from_wookie(str) ⇒ String
Translates a string from wookiespeak to english using the dialect given to the initializer.
27 28 29 |
# File 'lib/wookie/translator.rb', line 27 def from_wookie(str) @dialect.from_wookie(str.to_s) end |
#to_wookie(str) ⇒ String
Translates an english string to wookiespeak using the dialect given to the initializer.
18 19 20 |
# File 'lib/wookie/translator.rb', line 18 def to_wookie(str) @dialect.to_wookie(str.to_s) end |