Sha256: a9948c3c9ab5ab02bc8d56fa3f75132fce9e792e4ac1bc381be2ff697d40686b

Contents?: true

Size: 237 Bytes

Versions: 200

Compression:

Stored size: 237 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/compact'

class Object
  # If +self+ is a Proc, return the value of +.call+. If not, return +self+.
  # @return [Object]
  def call_if_proc
    is_a?(::Proc) ? call : self
  end
end

Version data entries

200 entries across 200 versions & 4 rubygems

Version Path
eac_ruby_utils-0.124.0 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.97.2 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.123.0 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.121.0 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.120.0 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.76.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.76.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.75.2 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.119.2 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.75.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.75.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.119.1 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.74.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.74.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.73.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.119.0 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.72.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.118.1 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_ruby_utils-0.118.0 lib/eac_ruby_utils/patches/object/call_if_proc.rb
eac_tools-0.70.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb