Module:MatchesBuilder

--- -- @author Vogan for Liquipedia --

local MatchesBuilder = {}

local Matches = require('Module:Matches')

-- required params MatchesBuilder.div = nil MatchesBuilder.data = nil

--- MatchesBuilder class -- Class that uses the builder pattern to construct an instance of the Matches class function MatchesBuilder.new local this = {} this.data = nil

-- Optional this.func_tournament = nil this.func_tournament_link = nil this.func_tournament_name = nil

--- Constructor. Contains the required params. -- @param data: The match data from LPDB function this.init(data) this.data = data end

-- Optional parameters

-- @param func_tournament_link: link to function that provides the link to the -- tournament if needed. Pass nil if not needed. function this.set_tournament_link_function(func) this.func_tournament_link = func end

-- @param func_tournament_text: link to function that creates tournament text (link + icon) function this.set_tournament_function(func) this.func_tournament = func end

-- @param func_tournament_text: link to function that wraps tournament text function this.set_tournament_name_function(func) this.func_tournament_name = func end

--- Produces the instance of the Matches class function this.build local matches = Matches:new matches.init(this) return matches end

return this end

return MatchesBuilder