Class: CrowdFund::SecureProject

Inherits:
Project
  • Object
show all
Defined in:
lib/crowd_fund/secure_project.rb

Instance Attribute Summary

Attributes inherited from Project

#amount, #name, #target

Instance Method Summary collapse

Methods inherited from Project

#each_pledge_received, #initialize, #receive_pledge, #total_pledges

Methods included from Printable

#to_s

Methods included from Fundable

#<=>, #full?, #remove, #stats, #total_to_fund

Constructor Details

This class inherits a constructor from CrowdFund::Project

Instance Method Details

#add(amount_to_add) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/crowd_fund/secure_project.rb', line 10

def add(amount_to_add)
  if halfway?
    super(total_to_fund)
    puts "\n#{@name} has received a matching fund."
  else
    super(amount_to_add)
  end
end

#halfway?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/crowd_fund/secure_project.rb', line 6

def halfway?
  @amount == target / 2
end