Class: Crowdfund::MatchProject
- Defined in:
- lib/crowdfund/match_project.rb
Instance Attribute Summary
Attributes inherited from Project
#funding, #goal, #name, #pledges
Instance Method Summary collapse
Methods inherited from Project
#<=>, #each_pledge, #initialize, #to_s
Methods included from Fundable
#fully_funded?, #funds_needed, #lose_funds
Constructor Details
This class inherits a constructor from Crowdfund::Project
Instance Method Details
#add_funds(amount = 25) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/crowdfund/match_project.rb', line 10 def add_funds(amount=25) if match? super(amount * 2) else super end end |
#match? ⇒ Boolean
6 7 8 |
# File 'lib/crowdfund/match_project.rb', line 6 def match? @funding >= @goal / 2.0 end |
#receive_pledge ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/crowdfund/match_project.rb', line 18 def receive_pledge if match? match_factor = 2 super(match_factor) else super end end |