defined? function
July 04, 2019
NoMethodError
ใๅ้ฟใใใฎใซๅญๅจใ็ขบ่ชใใใฐใใใจๆใฃใใใใฉใใใฎๆใฏdefined?
ใๅฅใงไฝฟใๅฟ ่ฆใใใ- ใใใใใชๆธใๆนใใใใฎใฏ้ฃใใ
# NoMethodError
if a.b.preset?
a.b(c)
end
defined?(bacon)
# nil
Written by Keisuke Kan who lives and works in Japan building useful things. You should follow him on Twitter