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.19.4 lib/sugarcube/activesupport.rb
sugarcube-0.19.2 lib/sugarcube/activesupport.rb
sugarcube-0.19.0 lib/sugarcube/activesupport.rb
sugarcube-0.18.21 lib/sugarcube/activesupport.rb
sugarcube-0.18.20 lib/sugarcube/activesupport.rb
sugarcube-0.18.19 lib/sugarcube/activesupport.rb
sugarcube-0.18.18 lib/sugarcube/activesupport.rb
sugarcube-0.18.17 lib/sugarcube/activesupport.rb
sugarcube-0.18.16 lib/sugarcube/activesupport.rb
sugarcube-0.18.12 lib/sugarcube/activesupport.rb
sugarcube-0.18.11 lib/sugarcube/activesupport.rb
sugarcube-0.18.10 lib/sugarcube/activesupport.rb
sugarcube-0.18.9 lib/sugarcube/activesupport.rb
sugarcube-0.18.8 lib/sugarcube/activesupport.rb
sugarcube-0.18.7 lib/sugarcube/activesupport.rb
sugarcube-0.18.6 lib/sugarcube/activesupport.rb
sugarcube-0.18.5 lib/sugarcube/activesupport.rb
sugarcube-0.18.4 lib/sugarcube/activesupport.rb
sugarcube-0.18.3 lib/sugarcube/activesupport.rb
sugarcube-0.18.2 lib/sugarcube/activesupport.rb