Class: Ascii::Unidecoder
- Inherits:
-
Object
- Object
- Ascii::Unidecoder
- Defined in:
- lib/ascii/unidecoder.rb
Overview
The class resposible for generating ASCII representation of the given string
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
-
#initialize(input) ⇒ Unidecoder
constructor
A new instance of Unidecoder.
-
#to_ascii ⇒ String
Processes input string and returns ASCII.
Constructor Details
#initialize(input) ⇒ Unidecoder
Returns a new instance of Unidecoder.
11 12 13 |
# File 'lib/ascii/unidecoder.rb', line 11 def initialize(input) @input = input.to_s end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
8 9 10 |
# File 'lib/ascii/unidecoder.rb', line 8 def input @input end |
Instance Method Details
#to_ascii ⇒ String
Processes input string and returns ASCII
18 19 20 |
# File 'lib/ascii/unidecoder.rb', line 18 def to_ascii input.gsub(/[^\x00-\x7f]/u, &method(:decode)).strip end |