module Cottus::Forward

Public Instance Methods

forward(*args) click to toggle source
# File lib/cottus/forward.rb, line 5
def forward(*args)
  options = args.pop
  to, through = options.values_at(:to, :through)

  args.each do |verb|
    define_method(verb) do |path, opts={}|
      if to && through
        instance_variable_get(to).send(through, verb, path, opts)
      else
        self.send(to, verb, path, opts)
      end
    end
  end
end