Class: CrowdFund::MatchingProject

Inherits:
Project
  • Object
show all
Defined in:
lib/crowdfund/matching_project.rb

Instance Attribute Summary

Attributes inherited from Project

#funding, #name, #target_funding

Instance Method Summary collapse

Methods inherited from Project

#<=>, #each_received_pledge, #initialize, #received_pledge, #to_s, #total_pledges

Methods included from Fundable

#fully_funded?, #funding_needed, #remove_fund

Constructor Details

This class inherits a constructor from CrowdFund::Project

Instance Method Details

#add_fund(amount = 25) ⇒ Object



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

def add_fund(amount=25)
  amount = (amount * 2) if secured_half_funding?
  super(amount)
end

#half_fundingObject



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

def half_funding
  @target_funding / 2.0
end

#secured_half_funding?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/crowdfund/matching_project.rb', line 14

def secured_half_funding?
  @funding >= half_funding
end