Method: JSI::Util::Arraylike#assoc

Defined in:
lib/jsi/util/typelike.rb

#assoc(obj) ⇒ Object



189
190
191
192
193
# File 'lib/jsi/util/typelike.rb', line 189

def assoc(obj)
  # note: assoc implemented here (instead of delegated) due to inconsistencies in whether
  # other implementations expect each element to be an Array or to respond to #to_ary
  detect { |e| e.respond_to?(:to_ary) and e[0] == obj }
end