summaryrefslogtreecommitdiff
path: root/inits.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-09-13 08:27:59 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-10-07 15:18:51 +0900
commit0097c7f3887ad8dd5493cb3696ac6368dc4a1014 (patch)
tree1dc23f79efaf436a1ba97550add50f6dee15848a /inits.c
parent755d99e8789b84a7d73d5a30f6b5d582e06f7f45 (diff)
[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: ```ruby begin addr = Fiddle::Handle.sym("something") # do something rescue Fiddle::DLError end ``` I want to write this: ```ruby if Fiddle::Handle.sym_defined?("something") addr = Fiddle::Handle.sym("something") # do something end ``` https://github.com/ruby/fiddle/commit/9d3371de13 Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Diffstat (limited to 'inits.c')
0 files changed, 0 insertions, 0 deletions