Sha256: 000fa7fe1c3c47709245a41d7e41f11680607ae9737ff154e460d5d4a80bd959

Contents?: true

Size: 184 Bytes

Versions: 4

Compression:

Stored size: 184 Bytes

Contents

require 'freighthopper/soft_send'

class Object  
  def or_if_blank(val = nil)
    if soft_send :blank?
      val || (block_given? ? yield : nil)
    else
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
freighthopper-0.1.14 lib/freighthopper/or_if_blank.rb
freighthopper-0.1.13 lib/freighthopper/or_if_blank.rb
freighthopper-0.1.12 lib/freighthopper/or_if_blank.rb
freighthopper-0.1.11 lib/freighthopper/or_if_blank.rb