Here is an example of the Rails team making it easier for developers to access much needed tools: you can now inspect the source code for a method right from irb. Say you had the following source code:
class Flower < ApplicationRecord # opens the flower def bud puts 'budding' end end
In irb you can do:
Flower.instance_method(:bud).source => " def bud\n puts 'budding'\n end\n" Flower.instance_method(:bud).comment => "# opens the flower\n"
This functionality is from a gem called method_source, which is one component of a developer console (alternative to irb) called pry. The method_source gem is now included in the development section of the Gemfile generated by Rails when you create a new application. This makes it easier for developers to quickly access this bit of functionality without having to switch to using pry.
The tests for this gem show all the ins and outs of using it:
https://github.com/banister/method_source/blob/master/test/test.rb
You can read more about the motivations and discussion around this feature on the PR:
https://github.com/rails/rails/issues/18473