Sha256: 0c9d95a49c8c1a0e7cc90f5d9992c1f8a700895248a27d0a3cf9e8f6abcf06cb

Contents?: true

Size: 411 Bytes

Versions: 7

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

require 'image_size/reader'

class ImageSize
  class StringReader # :nodoc:
    include Reader

    def initialize(string)
      @string = if string.respond_to?(:encoding) && string.encoding.name != 'ASCII-8BIT'
        string.dup.force_encoding('ASCII-8BIT')
      else
        string
      end
    end

    def [](offset, length)
      @string[offset, length]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
image_size-3.4.0 lib/image_size/string_reader.rb
image_size-3.3.0 lib/image_size/string_reader.rb
image_size-3.2.0 lib/image_size/string_reader.rb
image_size-3.1.0 lib/image_size/string_reader.rb
image_size-3.0.2 lib/image_size/string_reader.rb
image_size-3.0.1 lib/image_size/string_reader.rb
image_size-3.0.0 lib/image_size/string_reader.rb