class Mhc::EnumMerger
Public Class Methods
new(&block)
click to toggle source
# File lib/mhc/date_enumerator.rb, line 8 def initialize(&block) @enumerators = [] @enumerators << Enumerator.new(&block) if block end
Public Instance Methods
<<(o)
click to toggle source
# File lib/mhc/date_enumerator.rb, line 13 def <<(o) @enumerators << o return self end
each() { |next| ... }
click to toggle source
# File lib/mhc/date_enumerator.rb, line 18 def each rewind loop do yield self.next end end
next()
click to toggle source
def feed ; end
# File lib/mhc/date_enumerator.rb, line 27 def next raise StopIteration if @enumerators.empty? minimum_enumrator.next end
peek()
click to toggle source
def next_values ; end
# File lib/mhc/date_enumerator.rb, line 34 def peek raise StopIteration if @enumerators.empty? minimum_enumrator.peek end
rewind()
click to toggle source
def peek_values ; end
# File lib/mhc/date_enumerator.rb, line 41 def rewind send_all(:rewind) end
send_all(method, *args)
click to toggle source
# File lib/mhc/date_enumerator.rb, line 45 def send_all(method, *args) @enumerators.map{|e| e.send(method, *args)} end
Private Instance Methods
minimum_enumrator()
click to toggle source
# File lib/mhc/date_enumerator.rb, line 51 def minimum_enumrator min_e, min_v = @enumerators.first, nil @enumerators.each do |e| v = e.peek rescue nil if v and (min_v.nil? or v < min_v) min_e, min_v = e, v end end return min_e end