Module: CrowdFund::FundingRound

Defined in:
lib/crowdfund/funding_round.rb

Class Method Summary collapse

Class Method Details

.fund_project(project) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/crowdfund/funding_round.rb', line 7

def self.fund_project(project)
  coin = Coin.new
  flip_result = coin.flip
  
  if flip_result == 'heads'
    project.add_funds
  elsif flip_result == 'tails'
    project.remove_funds
  end
  
  pledge = PledgePool.random
  project.make_pledge(pledge)
end