Sha256: 032ad78897d4488e374b19a6f4c8f0635769436568a61cc84238eac68a108130
Contents?: true
Size: 892 Bytes
Versions: 5
Compression:
Stored size: 892 Bytes
Contents
module RTanque class Match class TickGroup include Enumerable def initialize @members = [] @pre_tick = nil @post_tick = nil end def each(&block) @members.each(&block) end def all_but(*to_exclude) self.to_a - to_exclude end def delete_if(&block) @members.delete_if(&block) end def add(*members) @members += members.flatten end def pre_tick(&block) @pre_tick = block end def post_tick(&block) @post_tick = block end def tick self.delete_if do |member| if member.dead? true else @pre_tick.call(member) if @pre_tick member.tick @post_tick.call(member) if @post_tick false end end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems