Class: Ascii::Codepoint
- Inherits:
-
Object
- Object
- Ascii::Codepoint
- Defined in:
- lib/ascii/codepoint.rb
Overview
The class responsible for translating a Unicode char to its ASCII representation
Instance Attribute Summary collapse
-
#code ⇒ Integer
readonly
The code of the unicode character.
Instance Method Summary collapse
-
#decode ⇒ String
An ASCII representation of input.
-
#initialize(char) ⇒ Codepoint
constructor
A new instance of Codepoint.
Constructor Details
#initialize(char) ⇒ Codepoint
Returns a new instance of Codepoint.
12 13 14 |
# File 'lib/ascii/codepoint.rb', line 12 def initialize(char) @code = char.unpack("U").first end |
Instance Attribute Details
#code ⇒ Integer (readonly)
Returns the code of the unicode character.
9 10 11 |
# File 'lib/ascii/codepoint.rb', line 9 def code @code end |
Instance Method Details
#decode ⇒ String
Returns an ASCII representation of input.
17 18 19 |
# File 'lib/ascii/codepoint.rb', line 17 def decode group.at(group_index) end |