Module: LogStash::PluginMixins::EventSupport::EventFactoryAdapter::FallbackImpl

Defined in:
lib/logstash/plugin_mixins/event_support/event_factory_adapter/fallback_impl.rb

Instance Method Summary collapse

Instance Method Details

#event_factoryObject

The event_factory method is effectively final and should not be re-defined by plugins.

Returns:

  • an event factory object with a new_event(Hash) API



8
9
10
# File 'lib/logstash/plugin_mixins/event_support/event_factory_adapter/fallback_impl.rb', line 8

def event_factory
  @_event_factory ||= BasicEventFactory::INSTANCE
end

#targeted_event_factoryObject

The targeted_event_factory method is effectively final and should not be re-defined. If the plugin defines a target => ... option than this method will return a factory that respects the set target, otherwise (no target) returns #event_factory.

Returns:

  • an event factory object with a new_event(Hash) API



17
18
19
20
21
22
# File 'lib/logstash/plugin_mixins/event_support/event_factory_adapter/fallback_impl.rb', line 17

def targeted_event_factory
  @_targeted_event_factory ||= begin # not synchronized - fine to initialize twice
                                 raise ArgumentError.new('config(:target) not present') unless respond_to?(:target)
                                 target.nil? ? event_factory : TargetedEventFactory.new(event_factory, target)
                               end
end