module Origin::Forwardable

Allows for easy delegation of origin queryable instance methods to a specific method.

Public Instance Methods

select_with(receiver) click to toggle source

Tells origin with method on the class to delegate to when calling an original selectable or optional method on the class.

@example Tell origin where to select from.

class Band
  extend Origin::Forwardable
  select_with :criteria

  def self.criteria
    Query.new
  end
end

@param [ Symbol ] receiver The name of the receiver method.

@return [ Array<Symbol> ] The names of the forwarded methods.

@since 1.0.0

# File lib/origin/forwardable.rb, line 25
def select_with(receiver)
  (Selectable.forwardables + Optional.forwardables).each do |name|
    __forward__(name, receiver)
  end
end