Sha256: 6c2a46daea239d025711125b2dc881f5df0e3ea0127ea364b4aee2881313881d
Contents?: true
Size: 560 Bytes
Versions: 1
Compression:
Stored size: 560 Bytes
Contents
require "ascii/codepoint" module Ascii # The class resposible for generating ASCII representation of the # given string class Unidecoder attr_reader :input # @param input [String] string to process def initialize(input) @input = input.to_s end # Processes input string and returns ASCII # # @return [String] An ASCII approximation of input string def to_ascii input.gsub(/[^\x00-\x7f]/u, &method(:decode)).strip end private def decode(char) Codepoint.new(char).decode end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ascii-1.0.1 | lib/ascii/unidecoder.rb |