Sha256: f9688d4e8a0bce5710368fcb071c433ed65a92463c4d18f56ab4b929774aa1b9

Contents?: true

Size: 568 Bytes

Versions: 44

Compression:

Stored size: 568 Bytes

Contents

# Thanks ruby on rails!
#
# These are all blatent, unapologetic rip offs of RoR extensions, and they
# behave in exactly the same way.

class Object

  def blank?
    respond_to?(:empty?) ? empty? : !self
  end

  def present?
    !blank?
  end

  # okay, this is strange, but `rake spec` fails if I define the method as `in?`
  # but passes if I alias it, as I do below.  weird, but I don't want to fight
  # it.
  def in(*list)
    if list.length == 1
      return list[0].include?(self)
    else
      return list.include?(self)
    end
  end
  alias :in? :in

end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
sugarcube-0.18.1 lib/sugarcube/activesupport.rb
sugarcube-0.18.0 lib/sugarcube/activesupport.rb
sugarcube-0.16.9 lib/sugarcube/activesupport.rb
sugarcube-0.16.5 lib/sugarcube/activesupport.rb