Module: Crowdfunder::Fundable
- Included in:
- Project
- Defined in:
- lib/crowdfunder/fundable.rb
Instance Method Summary collapse
- #<=>(other_project) ⇒ Object
- #add_funds ⇒ Object
- #fully_funded? ⇒ Boolean
- #remove_funds ⇒ Object
- #total_funding_outstanding ⇒ Object
- #total_required_funds ⇒ Object
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_funds ⇒ Object
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
19 20 21 |
# File 'lib/crowdfunder/fundable.rb', line 19 def fully_funded? total_funding_outstanding <= 0 end |
#remove_funds ⇒ Object
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_outstanding ⇒ Object
15 16 17 |
# File 'lib/crowdfunder/fundable.rb', line 15 def total_funding_outstanding self.target_fund - total_funds end |
#total_required_funds ⇒ Object
28 29 30 |
# File 'lib/crowdfunder/fundable.rb', line 28 def total_required_funds self.target_fund - self.initial_fund end |