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.20.20 lib/sugarcube/activesupport.rb
sugarcube-0.20.19 lib/sugarcube/activesupport.rb
sugarcube-0.20.18 lib/sugarcube/activesupport.rb
sugarcube-0.20.17 lib/sugarcube/activesupport.rb
sugarcube-0.20.16 lib/sugarcube/activesupport.rb
sugarcube-0.20.15 lib/sugarcube/activesupport.rb
sugarcube-0.20.13 lib/sugarcube/activesupport.rb
sugarcube-0.20.12 lib/sugarcube/activesupport.rb
sugarcube-0.20.11 lib/sugarcube/activesupport.rb
sugarcube-0.20.10 lib/sugarcube/activesupport.rb
sugarcube-0.20.9 lib/sugarcube/activesupport.rb
sugarcube-0.20.8 lib/sugarcube/activesupport.rb
sugarcube-0.20.7 lib/sugarcube/activesupport.rb
sugarcube-0.20.6 lib/sugarcube/activesupport.rb
sugarcube-0.20.5 lib/sugarcube/activesupport.rb
sugarcube-0.20.4 lib/sugarcube/activesupport.rb
sugarcube-0.20.3 lib/sugarcube/activesupport.rb
sugarcube-0.20.1 lib/sugarcube/activesupport.rb
sugarcube-0.20.0 lib/sugarcube/activesupport.rb
sugarcube-0.19.5 lib/sugarcube/activesupport.rb