Guest User

Untitled

a guest
Feb 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. require 'rubygems'
  2. require 'irb/completion'
  3. require 'map_by_method'
  4. require 'what_methods'
  5. require 'pp'
  6. IRB.conf[:AUTO_INDENT]=true
  7. #require 'wirble'
  8.  
  9. # start wirble (with color)
  10. #Wirble.init
  11. #Wirble.colorize
  12.  
  13. def Object.method_added(method)
  14. return super(method) unless method == :helper
  15. (class<<self;self;end).send(:remove_method, :method_added)
  16.  
  17. def helper(*helper_names)
  18. returning $helper_proxy ||= Object.new do |helper|
  19. helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
  20. end
  21. end
  22.  
  23. helper.instance_variable_set("@controller", ActionController::Integration::Session.new)
  24.  
  25. def helper.method_missing(method, *args, &block)
  26. @controller.send(method, *args, &block) if @controller && method.to_s =~ /_path$|_url$/
  27. end
  28.  
  29. helper :application rescue nil
  30. end if ENV['RAILS_ENV']
  31.  
  32. class Object
  33. def tap
  34. yield self
  35. self
  36. end
  37. end
Add Comment
Please, Sign In to add comment