Sha256: c84037f13906a86ba136bb66d4be2013c35ac4cbd10155ebdc7aac528680ba4f

Contents?: true

Size: 614 Bytes

Versions: 54

Compression:

Stored size: 614 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_workaround(args)
    args.include?(self)
  rescue NoMethodError
    raise ArgumentError.new("The parameter passed to #in? must respond to #include?")
  end
  alias in? __in_workaround

end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
sugarcube-4.0.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.5.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.4.2 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.4.1 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.4.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.7 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.6 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.5 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.4 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.3 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.2 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.1 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.3.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.2.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.1.1 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.1.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.0.8 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.0.7 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.0.6 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-3.0.5 lib/all/sugarcube-legacy/activesupport.rb