Sha256: 467ab87af650ca4240f58eaab8e73810ff64bb545ec1a2fb87701e5c42a3411d
Contents?: true
Size: 482 Bytes
Versions: 78
Compression:
Stored size: 482 Bytes
Contents
module Puppeteer::IfPresent # Similar to #try in ActiveSupport::CoreExt. # # Evaluate block with the target, only if target is not nil. # Returns nil if target is nil. # # -------- # if_present(params['target']) do |target| # Point.new(target['x'], target['y']) # end # -------- def if_present(target, &block) raise ArgumentError.new('block must be provided for #if_present') if block.nil? return nil if target.nil? block.call(target) end end
Version data entries
78 entries across 78 versions & 1 rubygems