Sha256: f3ba1f0f680a821e7397a805a8eff41ad60818230a2c877054a3510358cd2a5b

Contents?: true

Size: 482 Bytes

Versions: 4

Compression:

Stored size: 482 Bytes

Contents

require "json"
require "forwardable"

module Tika

  class Result
    extend Forwardable

    attr_reader :output, :error, :status

    def_delegator :status, :success?

    def initialize(output, error, status)
      @output, @error, @status = output, error, status
    end

    def render
      output
    end
  end

  class TextResult < Result
    def render
      output.strip
    end
  end

  class JSONResult < Result
    def render
      JSON.load(output)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tika-app-0.2.1 lib/tika/result.rb
tika-app-0.2.0 lib/tika/result.rb
tika-app-0.1.1 lib/tika/result.rb
tika-app-0.1.0 lib/tika/result.rb