Sha256: 85f31ad337a28437943517d625c9757930ae561e5830ce24e10ec8a32ed76a9b
Contents?: true
Size: 538 Bytes
Versions: 9
Compression:
Stored size: 538 Bytes
Contents
module Mysql class Context MANDATORY_OPTS = [ :database, :tables, :tag, :sync_fm, ] OPTIONAL_OPTS = [ :current_binlog_file, ] (MANDATORY_OPTS + OPTIONAL_OPTS).each do |opt| attr_accessor opt end 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 end end
Version data entries
9 entries across 9 versions & 1 rubygems