I would like to check if a symbol is defined before trying to access it.
Some symbols aren't available on all platforms, so instead of raising an
exception, I want to check if it's defined first.
Today we have to do:
beginaddr=Fiddle::Handle.sym("something")# do somethingrescueFiddle::DLErrorend
I want to write this:
ifFiddle::Handle.sym_defined?("something")addr=Fiddle::Handle.sym("something")# do somethingend
[ruby/fiddle] Add
sym_defined?
methods to test if a symbol is defined (https://github.com/ruby/fiddle/pull/108)I would like to check if a symbol is defined before trying to access it.
Some symbols aren't available on all platforms, so instead of raising an
exception, I want to check if it's defined first.
Today we have to do:
I want to write this:
https://github.com/ruby/fiddle/commit/9d3371de13
Co-authored-by: Sutou Kouhei [email protected]