Sha256: 1e84bd575e39c091a8d331b17f990e4159f9a15b457c2745c0c040435025fdbb

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

module GitObjectBrowser

  module Models

    class PlainFile
      def initialize(input)
        @in = input
      end

      def parse
        @content = @in.read(nil)
        @content = @content.force_encoding('UTF-8')
        @content = '(not UTF-8)' unless @content.valid_encoding?
        @content = @content[0, 3000] + "\n..." if @content.length > 3000
        self
      end

      def to_hash
        return { 'content' => @content }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-object-browser-0.0.2 lib/git-object-browser/models/plain_file.rb