Class: CrowdFund::MatchingProject
- Inherits:
-
Project
- Object
- Project
- CrowdFund::MatchingProject
show all
- Defined in:
- lib/crowdfund/matching_project.rb
Instance Attribute Summary
Attributes inherited from Project
#funding, #name, #target
Instance Method Summary
collapse
Methods inherited from Project
#<=>, #each_pledge_donated, #funded?, #funding_needed, #funds, #pledges_made, #to_s
Methods included from Fundable
#remove_funds
Constructor Details
#initialize(name, target, funding = 0) ⇒ MatchingProject
5
6
7
8
|
# File 'lib/crowdfund/matching_project.rb', line 5
def initialize(name, target, funding=0)
super(name, target, funding)
@halfway_funded = target / 2
end
|
Instance Method Details
#add_funds ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/crowdfund/matching_project.rb', line 14
def add_funds
if halfway_funded?
@funding += (25*2)
puts "#{@name} has received at least half its funding!" if halfway_funded?
else
super
end
end
|
#halfway_funded? ⇒ Boolean
10
11
12
|
# File 'lib/crowdfund/matching_project.rb', line 10
def halfway_funded?
@halfway_funded <= funding
end
|