Method: XQuery::Abstract.wrap_method

Defined in:
lib/xquery/abstract.rb

.wrap_method(name, as: name) ⇒ Object

Defines method, __method and q.method. Both of witch changes query to query.method

Parameters:

  • name (#to_sym)

    name of method on query

  • as (Hash) (defaults to: name)

    a customizable set of options

Options Hash (as:):

  • name (#to_sym)

    of method defined



29
30
31
32
# File 'lib/xquery/abstract.rb', line 29

def self.wrap_method(name, as: name)
  define_method(as) { |*args, &block| _update_query(name, *args, &block) }
  alias_on_q(as, true)
end