Sha256: 93e1f9aff089ac31e5b0448eab81ecb2aebc711cd2860e46214eab60c6e861f8
Contents?: true
Size: 452 Bytes
Versions: 9
Compression:
Stored size: 452 Bytes
Contents
# frozen_string_literal: true # From ActiveSupport unless Object.method_defined? :try class Object def try(*a, &b) if a.empty? || respond_to?(a.first) if a.empty? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(*a, &b) end end end end class NilClass def try(*args) nil end end end
Version data entries
9 entries across 9 versions & 3 rubygems