class Fundraise::MatchProject

Public Class Methods

new(name, target=200, funding=0) click to toggle source
Calls superclass method
# File lib/fundraise/match_project.rb, line 7
def initialize(name, target=200, funding=0)
  super(name, target, funding)
  @halfway_funded = target/2
end

Public Instance Methods

gain(gain=25, pledge=false) click to toggle source
Calls superclass method
# File lib/fundraise/match_project.rb, line 16
  def gain(gain=25, pledge=false)
    if halfway_funded?
#    @current_funding = @current_funding + gain*2
     super(gain*2)
    else
     if (@current_funding + gain) >= @halfway_funded
       difference = @current_funding + gain -@halfway_funded
       super(difference*2)
     end
    end
  end
halfway_funded?() click to toggle source
# File lib/fundraise/match_project.rb, line 12
def halfway_funded?
 @current_funding >= @halfway_funded
end