Sha256: d9a548beb59b0c66bf277240c34f3eb3af0802106f05b36e0753ff9c303b75d5

Contents?: true

Size: 473 Bytes

Versions: 2

Compression:

Stored size: 473 Bytes

Contents

module OpenNlp
  class Model
    include JavaClass

    attr_reader :j_model

    def initialize(model)
      @j_model = self.class.java_class.new(model_stream(model))
    end

    private

    def model_stream(model)
      case model
      when java.io.FileInputStream
        model
      when String
        java.io.FileInputStream.new(model)
      else
        fail ArgumentError, 'Model must be either a string or a java.io.FileInputStream'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open_nlp-0.2.0-java lib/open_nlp/model.rb
open_nlp-0.1.0-java lib/open_nlp/model.rb