[RUBY] When reading the source code

When you enter an existing project, you will need to check what methods each Class has.

At that time, I would like to describe below how I am confirming.

[environment] Ruby Rails Solidus

This time, I would like to explain using Rails' Solidus gem. download.png

$rails c Enter the console with.

Therefore, as described above, the object is assigned to an arbitrary character. (Spree :: Taxon is an object)

$a.methods Execute. By executing it, the method that the object has is displayed.

download (1).png

$a.methods.grep /product/ Then, only the method related to product can be obtained. By using grep as described above, you can narrow down the search results and search, so I think that there are many opportunities to use it.

download (2).png

$a.method(:before_remove_for_products=).source_location As mentioned above, by setting method (method name) .source_location, You can also find out in which file the method is located.

Recommended Posts

When reading the source code
Java source code reading java.lang.Math class
Pre-written source code for the activity
Specify the character code of the source when building with Maven
Technology for reading source code (cheat sheet)
When deploying the source used twitter4j failed
[Docker] How to build when the source code is bind-mounted on the container
Technology for reading Java source code in Eclipse
[IntelliJ IDEA] How to format only local changes when saving the source code
CRuby code reading (2): rb_newobj_of
When entering eclipse Java source code, auto activation triggers
Include the source code generated by Doma in the source JAR
[Java] When writing the source ... A memorandum of understanding ①
Differences in code when using the length system in Java
Oracle Live for the Code
A summary of what Java programmers find when reading Kotlin source for the first time
CRuby code reading (1): LIKELY / UNLIKELY
I tried source code analysis
Until the code is executed
[Reference example] Copyright is described in the comment of the source code.
Guess the character code in Java
Rails 5 Code Reading Part 2 ~ Action View ~
I read the source of ArrayList I read
Once you see the fucking code
I read the source of Integer
I read the source of Long
When will you do the refactoring?
I read the source of Short
I read the source of Byte
I read the source of String
Basic structure of Java source code
Do you know Carbon, which displays the source code coolly on Twitter?
Source code for finding an orthonormal basis with the Gram-Schmidt orthogonalization method