Sha256: b0bd469014b25a18ceefc23d2a93e70738e29f23b5aa8322af45d522e467c351

Contents?: true

Size: 313 Bytes

Versions: 1

Compression:

Stored size: 313 Bytes

Contents

require "ascii/codepoint"

module Ascii
  class Unidecoder
    attr_reader :input

    def initialize(input)
      @input = input.to_s
    end

    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.0 lib/ascii/unidecoder.rb