Class: LogStash::Config::File

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

Instance Method Summary collapse

Methods included from Util::Loggable

included, #logger, #slow_logger

Constructor Details

#initialize(text) ⇒ File

Returns a new instance of File.



13
14
15
16
# File 'lib/logstash/config/file.rb', line 13

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

Instance Method Details

#eachObject



32
33
34
# File 'lib/logstash/config/file.rb', line 32

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

#parse(text) ⇒ Object

def initialize



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

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



27
28
29
30
# File 'lib/logstash/config/file.rb', line 27

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