class FundRaise::ProjectMatch

Public Class Methods

new(name, target, funding=0) click to toggle source
Calls superclass method FundRaise::Project::new
# File lib/fund_raise/project_match.rb, line 5
def initialize (name, target, funding=0)
  super(name, target, funding)
  @halfway_funded = target / 2
end

Public Instance Methods

add_funds(add_funding=25, pledge=false) click to toggle source
Calls superclass method FundRaise::Fundable#add_funds
# File lib/fund_raise/project_match.rb, line 10
def add_funds(add_funding=25, pledge=false)
  if halfway_funded?
    super(add_funding * 2)
  else
    if (@current_funding + add_funding) >= @halfway_funded
      difference = @current_funding + add_funding - @halfway_funded
      super(difference * 2)
    end
  end
end
halfway_funded?() click to toggle source
# File lib/fund_raise/project_match.rb, line 21
def halfway_funded?
  @current_funding >= @halfway_funded
end