class LogStash::PluginMixins::JdbcStreaming::ParameterHandler

Attributes

given_value[R]

Public Class Methods

build_bind_value_handler(given_value) click to toggle source
# File lib/logstash/plugin_mixins/jdbc_streaming/parameter_handler.rb, line 19
def self.build_bind_value_handler(given_value)
  handler = ConstantParameter.new(given_value)

  return handler unless given_value.is_a?(String) # allow non String constants

  first_percent_curly = given_value.index("%{")
  if first_percent_curly && given_value.index("}", first_percent_curly)
    return InterpolatedParameter.new(given_value)
  end

  if given_value =~ /\A\s*\[[^\]]+\]\s*\z/
    return FieldParameter.new(given_value)
  end

  handler
end
build_parameter_handler(given_value) click to toggle source
# File lib/logstash/plugin_mixins/jdbc_streaming/parameter_handler.rb, line 6
def self.build_parameter_handler(given_value)
  # does it really make sense to deal with normal parameters differently?
  handler = FieldParameter.new(given_value)
  return handler unless given_value.is_a?(String)

  first_percent_curly = given_value.index("%{")
  if first_percent_curly && given_value.index("}", first_percent_curly)
    return InterpolatedParameter.new(given_value)
  end

  handler
end
new(given_value) click to toggle source
# File lib/logstash/plugin_mixins/jdbc_streaming/parameter_handler.rb, line 38
def initialize(given_value)
  @given_value = given_value
end

Public Instance Methods

extract_from(event) click to toggle source
# File lib/logstash/plugin_mixins/jdbc_streaming/parameter_handler.rb, line 42
def extract_from(event)
  # override in subclass
end