# Written by Dmitry Sabanin <dmitry@sabanin.ru>
# URLs: http://apricode.ru | http://sabanin.ru/en
#
# Description in russian: http://rubybrothers.ru/2007/3/31/simple-emptiness
# Includes examples in Ruby, so you'll be able to read them.

# Feel free to do anything you want with this code, but send
# me changes, if you feel they will be interesting to
# community.
#
# Disclaimer: I'm not responsible for anything that might go wrong with
# your code after you require this file. I cannot be held accountable 
# for any damages induced by this code, including plane crashes, 
# global warming increase, national security issues or DMCA lawsuits.


class Object

  def |(oth)
    self
  end
  
end

class NilClass

  def |(oth)
    oth
  end
  
end

class TrueClass

  def |(oth)
    self
  end
  
end

class FalseClass

  def |(oth)
    oth
  end
  
end

class Hash
    
  def |(oth)
    self.empty? ? oth : self
  end
  
end

class String

  def |(oth)
    self.strip.empty? ? oth : self
  end
  
end

