by jack_jennings · 9y ago · 0 comments
state = behavior.respond_to? :init ? behavior.init : {}
Asking an object if something is "callable" in Ruby is probably unnecesarily verbose, as you are most likely dealing with a method for any attribute access.
No comments yet.