Class: Object

Inherits:
BasicObject
Defined in:
lib/repub/app/utility.rb

Overview

Convenience method to avoid long ifs with nil? and empty? If receiver is nil or empty? is true, returns value Otherwise, returns self

Instance Method Summary collapse

Instance Method Details

#if_blank(value) ⇒ Object



8
9
10
# File 'lib/repub/app/utility.rb', line 8

def if_blank(value)
  self.nil? || self.empty? ? value : self
end