Class: MorseCode::Encoders::Chinese
- Defined in:
- lib/morse_code/encoders/chinese.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
inherited, #initialize, #supported_class, #supported_classes
Constructor Details
This class inherits a constructor from MorseCode::Base
Instance Method Details
#call ⇒ Object
13 14 15 |
# File 'lib/morse_code/encoders/chinese.rb', line 13 def call word.ord.to_s(2).tr!('0', '.').tr!('1', '-') end |
#supported? ⇒ Boolean
9 10 11 |
# File 'lib/morse_code/encoders/chinese.rb', line 9 def supported? !/\p{Han}/.match(word).nil? # \u4e00-\u9fa5 end |