Module: Crowdfunder::Fundable

Included in:
Project
Defined in:
lib/crowdfunder/fundable.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other_project) ⇒ Object



24
25
26
# File 'lib/crowdfunder/fundable.rb', line 24

def <=>(other_project)
  other_project.total_required_funds <=> total_required_funds
end

#add_fundsObject



4
5
6
7
# File 'lib/crowdfunder/fundable.rb', line 4

def add_funds
  self.initial_fund += 25
  puts "#{name} got more funds!"
end

#fully_funded?Boolean

Returns:

  • (Boolean)


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

def fully_funded?
  total_funding_outstanding <= 0
end

#remove_fundsObject



9
10
11
12
# File 'lib/crowdfunder/fundable.rb', line 9

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

#total_funding_outstandingObject



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

def total_funding_outstanding
  self.target_fund - total_funds
end

#total_required_fundsObject



28
29
30
# File 'lib/crowdfunder/fundable.rb', line 28

def total_required_funds
  self.target_fund - self.initial_fund
end