Sha256: df99287a808eef38d56b9cb7be8d622ed9c409c951f09a6c61af1032cb95a09c
Contents?: true
Size: 547 Bytes
Versions: 7
Compression:
Stored size: 547 Bytes
Contents
module PunchingBag require 'punching_bag/engine' if defined?(Rails) require 'punching_bag/acts_as_punchable' require 'voight_kampff' def self.punch(punchable, request=nil) if request.try(:bot?) false else p = Punch.new p.punchable = punchable p.save ? p : false end end def self.average_time(*punches) total_time = 0 hits = 0 punches.each do |punch| total_time += punch.average_time.to_f * punch.hits hits += punch.hits end Time.zone.at(total_time / hits) end end
Version data entries
7 entries across 7 versions & 1 rubygems