Class: Wookie::Dialect::Base
- Inherits:
-
Object
- Object
- Wookie::Dialect::Base
- Defined in:
- lib/wookie/dialect.rb
Overview
Basic class to be inherited from, when building new dialects. Though currently not implemented, a future version of the Translator may check, if any given dialect is actually a subclass of Base.
Direct Known Subclasses
Class Method Summary collapse
-
.inherited(sub) ⇒ Object
Keeps track of available subclasses.
-
.subclasses ⇒ Array
Returns the known subclasses.
Instance Method Summary collapse
-
#from_wookie(str) ⇒ String
Translates a wookiespeak string to english.
-
#to_wookie(str) ⇒ String
Translates an english string to wookiespeack.
Class Method Details
.inherited(sub) ⇒ Object
Keeps track of available subclasses.
12 13 14 15 |
# File 'lib/wookie/dialect.rb', line 12 def self.inherited(sub) @@subclasses ||= [] @@subclasses << sub end |
.subclasses ⇒ Array
Returns the known subclasses
19 20 21 |
# File 'lib/wookie/dialect.rb', line 19 def self.subclasses @@subclasses end |
Instance Method Details
#from_wookie(str) ⇒ String
Note:
Must be implemented in the sub class.
Translates a wookiespeak string to english.
39 40 41 |
# File 'lib/wookie/dialect.rb', line 39 def from_wookie(str) raise NotImplementedError end |
#to_wookie(str) ⇒ String
Note:
Must be implemented in the sub class.
Translates an english string to wookiespeack.
29 30 31 |
# File 'lib/wookie/dialect.rb', line 29 def to_wookie(str) raise NotImplementedError end |