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 wich changes query to query.method

Parameters:

  • name (#to_sym)

    name of method on query

  • as (#to_sym) (defaults to: name)

    name of method defined



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

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