| 
									
										
										
										
											2013-02-22 16:44:37 +01:00
										 |  |  | require 'irb/completion' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-07 14:49:42 +02:00
										 |  |  | # interactive editor: use vim from within irb | 
					
						
							|  |  |  | begin | 
					
						
							|  |  |  |   require 'interactive_editor' | 
					
						
							|  |  |  | rescue LoadError => err | 
					
						
							|  |  |  |   warn "Couldn't load interactive_editor: #{err}" | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2013-02-22 16:44:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-07 14:49:42 +02:00
										 |  |  | # awesome print | 
					
						
							|  |  |  | begin | 
					
						
							|  |  |  |   require 'awesome_print' | 
					
						
							|  |  |  | rescue LoadError => err | 
					
						
							|  |  |  |   warn "Couldn't load awesome_print: #{err}" | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # configure irb | 
					
						
							| 
									
										
										
										
											2013-02-22 16:44:37 +01:00
										 |  |  | IRB.conf[:AUTO_INDENT]=true | 
					
						
							| 
									
										
										
										
											2014-07-07 14:49:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # irb history | 
					
						
							|  |  |  | IRB.conf[:EVAL_HISTORY] = 1000 | 
					
						
							|  |  |  | IRB.conf[:SAVE_HISTORY] = 1000 | 
					
						
							|  |  |  | IRB.conf[:HISTORY_FILE] = File.expand_path("~/.irb_history") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # load .irbrc_rails in rails environments | 
					
						
							|  |  |  | railsrc_path = File.expand_path('~/.irb-railsrc') | 
					
						
							|  |  |  | if (ENV['RAILS_ENV'] || defined? Rails) && File.exist?(railsrc_path) | 
					
						
							|  |  |  |   begin | 
					
						
							|  |  |  |     load railsrc_path | 
					
						
							|  |  |  |   rescue Exception | 
					
						
							|  |  |  |     warn "Could not load: #{ railsrc_path } because of #{$!.message}" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Object | 
					
						
							|  |  |  |   def interesting_methods | 
					
						
							|  |  |  |     case self.class | 
					
						
							|  |  |  |     when Class | 
					
						
							|  |  |  |       self.public_methods.sort - Object.public_methods | 
					
						
							|  |  |  |     when Module | 
					
						
							|  |  |  |       self.public_methods.sort - Module.public_methods | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       self.public_methods.sort - Object.new.public_methods | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |