All right.
My friends we've got our CSB follow reader all put together in a very reusable state.
It's not the last thing we have to do is implement our load method on match reader.
The Load method is going to load up our information through the CSB file reader and then do the actual
conversion process so let's get to it back inside my code.
Ed I'm going to find my match reader T.S. file right underneath the constructor.
I'm going to define a new function called load.
This is not going to take any arguments and it's not going to return any values either so inside of
here we're going to take a look at the reader that we were provided.
Remember the entire idea here is that reader can be maybe the CSB file reader or an API reader or some
other source of information.
So whatever reader we were given we're going to call this dot reader dot read.
That's essentially the entire loading process that's going to tell the CSB file reader to go get the
CSB file pass all the information inside of it and produce that 2 dimensional array of strings.
So after we call read we can then take a look at this dot reader dot data which again is the 2 dimensional
array of strings and we'll do the actual transformation process where we take those two D strings and
we turn them into all the appropriate values like the date and the numbers and the match result and
so on.
So to do that step we can uncommon at the dot map statement we saved.
Cut it and pasted onto this dot reader dot data.
OK.
So just like before we're looking at the two dimensional array of strings we're going to map over it
and produce a new array where every element inside the new Array is going to be a match data trouble.
Now one last thing here.
Remember a mapping function doesn't mutate the underlying array.
Instead it gives us a new array back.
So this entire statement is going to give us a new array.
We have to save somewhere.
Let's save it as a property of the class.
To do so we need to first define a new property on the class itself.
So I'm going to say that this is going to have some property like matches.
It's going to be an array of match data couples.
And I'm going to initialize it to be an empty array so then after we do that mapping operation I'll
assign all that transform data to this dot matches like so and that's pretty much it OK.
So that's all we have to do here.
So now the last thing we have to do is update our index dot test file to make use of match reader and
CSP file reader.
Let's take a quick pause and then update the index out test file in the next video.