Class: Mysql::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/flydata/fluent-plugins/mysql/context.rb

Constant Summary collapse

MANDATORY_OPTS =
[
  :database, :tables, :tag, :sync_fm, :omit_events
]
OPTIONAL_OPTS =
[
  :current_binlog_file
]

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Context

Returns a new instance of Context.



14
15
16
17
18
19
20
21
22
23
# File 'lib/flydata/fluent-plugins/mysql/context.rb', line 14

def initialize(opts)
  missing_opts = MANDATORY_OPTS - opts.keys
  unless (missing_opts.empty?)
    raise "Mandatory option(s) are missing: #{missing_opts.join(', ')}"
  end

  opts.each do |k, v|
    self.instance_variable_set(:"@#{k}", v)
  end
end