Class: LogStash::Config::File

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Util::Loggable
Defined in:
lib/logstash/config/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ File

Returns a new instance of File.



11
12
13
14
# File 'lib/logstash/config/file.rb', line 11

def initialize(text)
  @text = text
  @config = parse(text)
end

Instance Method Details

#eachObject



30
31
32
# File 'lib/logstash/config/file.rb', line 30

def each
  @config.recursive_select(LogStash::Config::AST::Plugin)
end

#parse(text) ⇒ Object

def initialize



16
17
18
19
20
21
22
23
# File 'lib/logstash/config/file.rb', line 16

def parse(text)
  grammar = LogStashConfigParser.new
  result = grammar.parse(text)
  if result.nil?
    raise LogStash::ConfigurationError, grammar.failure_reason
  end
  return result
end

#plugin(plugin_type, name, *args) ⇒ Object

def parse



25
26
27
28
# File 'lib/logstash/config/file.rb', line 25

def plugin(plugin_type, name, *args)
  klass = LogStash::Plugin.lookup(plugin_type, name)
  return klass.new(*args)
end