Sha256: ca9e8e81838b3a87bdbc07ed6e03b10da8416893708a00a262cf04814de84d49
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 Bytes
Contents
# -*- encoding: utf-8 -*- # Translates a given string either from wookie to english or vice versa. class Wookie::Translator # Contructor, defines the dialect ({Wookie::Dialect::Simple} by default). # @param [Hash] options The instance options. # @option options [#to_wookie,#from_wookie] :dialect A wookie dialect. def initialize(options={ :dialect => Wookie::Dialect::Simple }) @dialect = options[:dialect].new end # Translates an english string to wookiespeak using the dialect given to the # initializer. # # @param [#to_s] str The string to be translated. # @return [String] The translated string. def to_wookie(str) @dialect.to_wookie(str.to_s) end # Translates a string from wookiespeak to english using the dialect given to # the initializer. # # @param [#to_s] str The string to be translated. # @return [String] The english translation. def from_wookie(str) @dialect.from_wookie(str.to_s) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wookie-translator-0.1.1 | lib/wookie/translator.rb |