class FundRaise::ProjectMatch

Public Class Methods

new(name, target=1000, funding=0) click to toggle source
Calls superclass method
# File lib/fund_raise/match_project.rb, line 7
def initialize (name, target=1000, 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
# File lib/fund_raise/match_project.rb, line 12
def add_funds(add_funding=25, pledge=false)
  if match_funds?
    super(add_funding * 2)
  else
    if (@current_funding = add_funding) >= (@target_funding / 2)
      difference = (@current_funding + add_funding) - @halfway_funded
      super(difference * 2)
    end
  end
end
match_funds?() click to toggle source
# File lib/fund_raise/match_project.rb, line 23
def match_funds?
  @current_funding >= @target_funding/2
end