Class: Object

Inherits:
BasicObject
Defined in:
lib/sugarcube/activesupport.rb,
lib/sugarcube/nsuserdefaults.rb

Overview

Thanks ruby on rails!

These are all blatent, unapologetic rip offs of RoR extensions, and they behave in exactly the same way.

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/sugarcube/activesupport.rb', line 8

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

#in(*list) ⇒ Object Also known as: in?

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.



19
20
21
22
23
24
25
# File 'lib/sugarcube/activesupport.rb', line 19

def in(*list)
  if list.length == 1
    return list[0].include?(self)
  else
    return list.include?(self)
  end
end

#present?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/sugarcube/activesupport.rb', line 12

def present?
  !blank?
end

#to_nsuserdefaultsObject



29
30
31
# File 'lib/sugarcube/nsuserdefaults.rb', line 29

def to_nsuserdefaults
  self
end