#What is the purpose of reading the original code at Ruby's pry's dollar mark? It is a show-source.
[3] pry(main)> $ Class
From: /Users/yumainaura/.rbenv/versions/2.6.1/lib/ruby/2.6.0/json/common.rb @ line 448:
Class name: Class
Number of lines: 9
class ::Class
# Returns true if this class can be used to create an instance
# from a serialised JSON string. The class has to implement a class
# method _json_create_ that expects a hash as first parameter. The hash
# should include the required data.
def json_creatable?
respond_to?(:json_create)
end
end
[2] pry(main)> show-source Class
From: /Users/yumainaura/.rbenv/versions/2.6.1/lib/ruby/2.6.0/json/common.rb @ line 448:
Class name: Class
Number of lines: 9
class ::Class
# Returns true if this class can be used to create an instance
# from a serialised JSON string. The class has to implement a class
# method _json_create_ that expects a hash as first parameter. The hash
# should include the required data.
def json_creatable?
respond_to?(:json_create)
end
end
Original by Github issue
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。