lib/punching_bag.rb in punching_bag-0.4.0 vs lib/punching_bag.rb in punching_bag-0.5.0
- old
+ new
@@ -1,16 +1,17 @@
module PunchingBag
require 'punching_bag/engine' if defined?(Rails)
require 'punching_bag/acts_as_punchable'
require 'voight_kampff'
- def self.punch(punchable, request=nil)
+ def self.punch(punchable, request = nil, count = 1)
if request.try(:bot?)
false
else
p = Punch.new
p.punchable = punchable
+ p.hits = count
p.save ? p : false
end
end
def self.average_time(*punches)
@@ -20,6 +21,6 @@
total_time += punch.average_time.to_f * punch.hits
hits += punch.hits
end
Time.zone.at(total_time / hits)
end
-end
\ No newline at end of file
+end