Class: SportDb::Model::MatchCursor

Inherits:
Object
  • Object
show all
Defined in:
lib/sportdb/models/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(matches) ⇒ MatchCursor

Returns a new instance of MatchCursor.



7
8
9
# File 'lib/sportdb/models/utils.rb', line 7

def initialize( matches )
  @matches = matches
end

Instance Method Details

#eachObject



11
12
13
14
15
16
17
18
# File 'lib/sportdb/models/utils.rb', line 11

def each
  state = MatchCursorState.new

  @matches.each do |match|
    state.next( match )
    yield( match, state )   # e.g. lets you use state.new_date?  or state.new_week? or state.new_year? etc.
  end
end