Sha256: 544b3e52c357bf44a456b86fcc7567fc7bbe88c726c71674f690ab14c085d498

Contents?: true

Size: 766 Bytes

Versions: 9

Compression:

Stored size: 766 Bytes

Contents

require "logstash/namespace"
require "logstash/ruby_fixes"
require "uri"

module LogStash::Inputs
  # Given a URL, try to load the class that supports it.
  # That is, if we have an input of "foo://blah/" then
  # we will try to load logstash/inputs/foo and will
  # expect a class LogStash::Inputs::Foo
  public
  def self.from_url(url, type, &block)
    # Assume file paths if we start with "/"
    url = "file://#{url}" if url.start_with?("/")

    uri = URI.parse(url)
    # TODO(sissel): Add error handling
    # TODO(sissel): Allow plugin paths
    klass = uri.scheme.capitalize
    file = uri.scheme.downcase
    require "logstash/inputs/#{file}"
    LogStash::Inputs.const_get(klass).new(uri, type, &block)
  end # def from_url
end # module LogStash::Inputs

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-lite-0.2.20110505142231 lib/logstash/inputs.rb
logstash-lite-0.2.20110422152244 lib/logstash/inputs.rb
logstash-lite-0.2.20110405105201 lib/logstash/inputs.rb
logstash-lite-0.2.20110331121236 lib/logstash/inputs.rb
logstash-lite-0.2.20110329105411 lib/logstash/inputs.rb
logstash-lite-0.2.20110206003603 lib/logstash/inputs.rb
logstash-lite-0.2.20110203130400 lib/logstash/inputs.rb
logstash-lite-0.2.20110122143801 lib/logstash/inputs.rb
logstash-lite-0.2.20110112115019 lib/logstash/inputs.rb