class EncoderTools::Util::TextReader

Constants

ENCODING_MARKER

Public Class Methods

new(input) click to toggle source
# File lib/encoder-tools/util/text_reader.rb, line 6
def initialize(input)
  @input = input
end
read(input) click to toggle source
# File lib/encoder-tools/util/text_reader.rb, line 15
def self.read(input)
  new(input).read
end

Public Instance Methods

read() click to toggle source
# File lib/encoder-tools/util/text_reader.rb, line 10
def read
  strip_encoding_marker(
    @input.respond_to?(:read) ?  @input.read : @input)
end

Private Instance Methods

strip_encoding_marker(string) click to toggle source
# File lib/encoder-tools/util/text_reader.rb, line 20
def strip_encoding_marker(string)
  string[0, ENCODING_MARKER.size] == ENCODING_MARKER ?
    string[ENCODING_MARKER.size..-1] : string
end