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-2.4.2 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.4.1 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.4.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.3.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.2.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.1.5 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.1.4 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.1.3 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.1.2 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.1.1 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.1.0 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.0.2 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.0.1 lib/all/sugarcube-legacy/activesupport.rb
sugarcube-2.0.0 lib/all/sugarcube-legacy/activesupport.rb