Module: CrowdFund::Fundable

Included in:
Project, SchoolProject
Defined in:
lib/crowdfund/fundable.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



23
24
25
# File 'lib/crowdfund/fundable.rb', line 23

def <=>(other)
    other.need <=> need
end

#funded?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/crowdfund/fundable.rb', line 19

def funded?
    fund >= goal
end

#gainedObject



5
6
7
8
# File 'lib/crowdfund/fundable.rb', line 5

def gained
    self.fund += 25
    puts "Project #{name} got more funds!"
end

#lostObject



10
11
12
13
# File 'lib/crowdfund/fundable.rb', line 10

def lost
    self.fund -= 15
    puts "Project #{name} lost some funds!"
end

#needObject



15
16
17
# File 'lib/crowdfund/fundable.rb', line 15

def need
    goal - fund
end