Method: Sequel::Plugins::SqlComments.def_sql_commend_method

Defined in:
lib/sequel/plugins/sql_comments.rb

.def_sql_commend_method(mod, model, method_type, meth) ⇒ Object

Define a method meth on the given module mod that will use automatic SQL comments with the given model, method_type, and method.



60
61
62
63
64
65
66
67
68
69
# File 'lib/sequel/plugins/sql_comments.rb', line 60

def self.def_sql_commend_method(mod, model, method_type, meth)
  mod.send(:define_method, meth) do |*a, &block|
    model.db.with_comments(:model=>model, :method_type=>method_type, :method=>meth) do
      super(*a, &block)
    end
  end
  # :nocov:
  mod.send(:ruby2_keywords, meth) if mod.respond_to?(:ruby2_keywords, true)
  # :nocov:
end