Class: MorseCode::Decoders::Chinese

Inherits:
Base
  • Object
show all
Defined in:
lib/morse_code/decoders/chinese.rb

Constant Summary collapse

MIN_CHINESE_CODEPOINT =

u4e00

19_968
MAX_CHINESE_CODEPOINT =

u9fa5

40_869

Instance Attribute Summary

Attributes inherited from Base

#word

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, #supported_class

Constructor Details

This class inherits a constructor from MorseCode::Decoders::Base

Instance Method Details

#decodeObject



15
16
17
# File 'lib/morse_code/decoders/chinese.rb', line 15

def decode
  decode_binary_word.chr('UTF-8')
end

#supported?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/morse_code/decoders/chinese.rb', line 11

def supported?
  decode_binary_word >= MIN_CHINESE_CODEPOINT && decode_binary_word <= MAX_CHINESE_CODEPOINT
end