lib/grape/api.rb in grape-0.2.0 vs lib/grape/api.rb in grape-0.2.1
- old
+ new
@@ -206,12 +206,17 @@
# def current_user
# User.find_by_id(params[:token])
# end
# end
# end
- def helpers(mod = nil, &block)
- if block_given? || mod
- mod ||= settings.peek[:helpers] || Module.new
+ def helpers(new_mod = nil, &block)
+ if block_given? || new_mod
+ mod = settings.peek[:helpers] || Module.new
+ if new_mod
+ mod.class_eval do
+ include new_mod
+ end
+ end
mod.class_eval &block if block_given?
set(:helpers, mod)
else
mod = Module.new
settings.stack.each do |s|