 7.30 pagi, tapi mari kita tunggu sekejap lagi Kita ada 9 orang di sini Saya tidak tahu kita ada 30 orang RSVP Mungkin mari kita tunggu 5-4 minit Mike, kamu akan dapat makan malam atau jalan jauh? Ijaga, betul? Untuk orang yang baru datang, mari kita tunggu sekejap lagi Selepas ini, kita akan mulakan Selepas ini, sekejap lagi Okey, mari kita mulakan Tapi tidak ada banyak orang baru datang Helo, selamat datang Saya juga melihat nama baru Bagus untuk melihat Mari kita mulakan hari ini Jadi kerja untuk hari ini Kerja untuk hari ini Sebaiknya hari ini, saya melakukan banyak kerja untuk setiap sekejap Sebaiknya hari ini, kita akan berhati-hati Dan sejak kita hanya ada satu pagi hari ini Jadi saya fikir mungkin kita boleh melihat video RSVP Jadi saya fikir ini tidak adalah kerja Dan sesuatu yang saya bincangkan hari ini Jika kita perlu berhati-hati, kita boleh melihat video RSVP Mungkin ada beberapa kerja Jadi ini kerja Kita akan mulakan dengan semua kerja Kemudian jauh-jauh menjelaskan Dan beberapa kerja Dan beberapa kerja Jika ada orang yang berhati-hati, kita berhati-hati Baiklah, mari kita mulakan Maafkan saya, apa yang berlaku? Michael pergi ke rumah untuk berhati-hati Jadi ini berhati-hati Ini untuk Kailah untuk berhati-hati Hari ini adalah berhati-hati oleh seseorang yang berhati-hati Mungkin saya tidak berhati-hati Terima kasih untuk mereka untuk bantuan saya Untuk membantu ini dalam sebuah session online Kemudian lagi, kita ada rubi SGE Telegram Group Jadi kita boleh menggunakan link Saya tahu anda tidak boleh menggunakan link Anda boleh mencari link di dalam tab Meetup.com Di deskripsi Jadi, menikmati rubi SGE Telegram Group jika anda tidak ada Dan beberapa kerja web Ia untuk menggunakan diri diri diri Sebenarnya ia hanya menggunakan diri diri Apabila anda akan beritahu sesuatu Ia untuk menghubungi ruang Sebelum saya bermula menggunakan event online Banyak orang berkata bahawa ia tidak mungkin Untuk menggunakan bot online Mereka akan berkata bahawa ia berlaku Saya tidak berkata dengan diri saya Tapi sejak orang berkata bahawa ia sangat berlaku Sebelum saya berkata bahawa ia sangat berlaku Saya hanya akan menjelaskannya di sini Jadi, beberapa pemerintah Dengan diri diri diri Dan tentu saja, kerja web ini sangat berlaku Ini tidak berlaku-laku Jadi, anda tidak dapat melihat anda Dan anda mungkin tidak dapat menggunakan diri Jadi, ia sangat berlaku dan berlaku Jadi, kami dapat tahu bersama-sama Mungkin hanya melihat orang-orang yang berlaku Okey, jadi Itu semua untuk staf admin Jadi, hari ini hanya ada satu staf yang berlaku Saya berpikir saya akan selalu bersama-sama Staf admin Kemudian, jika anda ada sesuatu yang anda ingin berkongsi Tolong beritahu kami Kita akan membuat ini lebih berkata-kongsi Dan berharap kita semua Mereka berkongsi bersama-sama Okey Jadi, hari ini saya akan bercakap tentang Bersama-sama dengan staf yang berlaku Mungkin, staf yang berbasik Bukan seperti staf yang berlaku Jadi, saya hanya ingin menggunakan staf yang berlaku Untuk menggunakan staf yang berlaku Jadi, mari kita mulakan Mari saya buka staf yang saya berlaku Saya rasa saya perlu berkongsi Okey, anda semua... Tidak, tidak Okey, anda semua lihat staf yang saya berlaku Mungkin, seseorang boleh membuat staf yang berlaku Okey, staf yang berlaku Okey Okey, jadi Untuk hari ini saya akan Menjelaskan staf yang berlaku Seperti yang saya kata Mungkin, anda tidak perlu membuat staf yang berlaku Kerana Ruby sudah mempunyai staf yang berlaku Tetapi, saya hanya ingin menjelaskan staf yang berlaku Dan ia hanya sebuah latihan yang muda Saya menemukan staf yang sangat menarik Okey, jadi Saya akan mulakan dengan Bercakap tentang staf yang berlaku Saya pasti, anda semua sudah melihat staf yang berlaku Anda boleh berlaku dengan anda, anda juga dapat melihat staf yang berlaku Melihat staf yang berlaku Anda yesak untuk membuat sesuatu dengan atau mengajak sesuatu atau sebagainya Jadi, saya akan... Saya ada sebuah pertanyaan untuk sayaYakah anda ada meminta? Macam mana berlaku dengan Staf yang berlaku? Kemudian, akan akan berlaku dengan être sebegitu yang paling biasa Di mana yang paling terkenal adalah menyebabkan setiap pembentangan. Di contoh kanan, jika anda menyebabkan setiap pembentangan. Sebenarnya, bagaimanapun ia menyebabkan setiap pembentangan. Jadi, setiap pembentangan adalah sebuah konsep. Dan ia juga sebuah kelas rubi. Mereka menyebabkan sebuah kelas untuk menyebabkan. Jadi anda dapat menyebabkan di sebuah pembentangan. Mereka mempunyai sebuah pembentangan. Maksudnya ia seperti sebuah kelas. Okey, sebuah pembentangan yang sangat kuat tentang penyelamatan itu. Anda dapat menyebabkan setiap pembentangan dan mencari perlukan. Jadi, sebuah contoh ini, jika anda tidak perlu melakukan ini, saya hanya menyebabkan sesuatu saja untuk menunjukkan bahawa anda dapat menyebabkan setiap pembentangan. Jadi, anda dapat menyebabkan sebuah contoh ini. Anda dapat menyebabkan sebuah contoh ini. Anda dapat menyebabkan setiap pembentangan. Anda dapat menyebabkan setiap pembentangan yang lebih daripada 0.1. Dan kemudian menyebabkan setiap pembentangan yang lebih daripada 3. Jadi, anda dapat menyebabkan setiap pembentangan di dalam perang. Dan anda dapat menyebabkan dan mengambil masa. Sudah tentu saya rasa anda ada sebuah lebih baik cara membuat ini. Ini adalah sebuah contoh yang hanya ingin menunjukkan kelas untuk membuat perlukan. Jadi, bagaimana kita dapat membuat kelas kita menjadi sebuah pembentangan? Anda dapat menyebabkan sebuah kelas. Jadi, saya ada sebuah kelas perlukan. Jadi, jika kita mempunyai kelas perlukan, mesti ada banyak perlukan di dalam perlukan. Dan kemudian, apabila kita mempunyai kelas perlukan, kita dapat menyebabkan semua perlukan di dalam perlukan. Jadi, cara yang paling mudah, cara yang paling mudah adalah menggunakan kelas perlukan. Dan kelas perlukan adalah sebenarnya sesuatu yang diberikan oleh Ruby Core. Sebab itulah saya juga mempunyai kelas perlukan di dalam perlukan. Jadi, dengan mempunyai kelas perlukan, anda dapat membuat kelas perlukan. Ya, anda dapat idea. Jadi, cara yang paling mudah berlaku? Saya rasa yang paling banyak orang, mungkin banyak orang, orang yang berkenal dengan kelas perlukan yang mudah, adalah apabila kita mempunyai kelas perlukan, anda hanya perlu mempunyai kelas perlukan di dalam perlukan. Dan kemudian, apabila kelas perlukan, jika anda melihat kelas perlukan di dalam perlukan, anda akan melihat kelas perlukan. Mereka hanya perlu mempunyai kelas perlukan. Jadi, anda perlu terus melihat kelas perlukan. Dan kemudian, apabila kelas perlukan, kelas perlukan atau kelas perlukan dan mencari kelas perlukan, semuanya akan datang pada masa yang sama. Jadi, seperti kelas perlukan, kelas perlukan, etc. Semuanya tiba-tiba dalam perlukan. Mereka semuanya akan berjalan-jalan, kemudian ia hanya berfungsi untuk beberapa sebab, sedangkan dari sebab anda perlu mengalami setiap perlukan untuk semua ini bekerja, saya rasa ia berkata banyak tentang bagaimana setiap perlukan melalui perlukan, apa sebuah perkara yang mencari, yang sepatutnya ialah setiap perlukan. So the next way to do it which is a bit less way less magic is to this is method 2.1 is to use the enumerable enumerator class itself so the enumerator because it's a class and in Ruby everything is OOP right so there is definitely a new method to this class and then you can call new so this is how it works you call new you pass in a block and then and then you just need to do that why arrow arrow and then put it in something like that so it's either you so every time you call we want to use this enumerator every time you want to go to the next item next item next item is determined but why is the next arrow arrow in so the first one will be the new apple to then the next one is the banana one that the next class college tree but one interesting thing about this method this calling new enumerator.new way is that actually in the documentation itself ruby ruby.org itself it says that this form is this courage not sure why is it this courage but then yeah basically it's there is the official sense is that it's this courage and it says that to use object enam for or object to enam instead so so actually enam for and to enam is just alias i forgot is which one is aliasin which one but it basically is the same thing okay so this this this idea.new i just want to go through this method just to let you know that it is a class like all other ruby or ruby thing so it's worthwhile to know how to use how to use it like that and then okay then this is the 2.2 this is the more official way of using the enumerator class okay so so this i'm not sure how many of you i've seen this this this what is it this pattern okay you have the the method each and then you return the in return enam for and then you pass in the the symbol that represents that method if there is no block given so enam for is an actually a method on the object class so the object is like the parent class of all classes right it's like the root class and then that's why when you have enam for that and even if you create a new class like class uh my custom class uh then you will definitely still have this method this method basically is everyone is in every class so to create an enumerator what what happens is that if you don't pass in a block like for example the code below code basket.new.each then you will return an enam for and each and then what happens is that every time you call next on this enumerator right it will just uh you you the things below it so it's a bit of magic here but we're not going to go into like how it works but i think maybe something something simple that we can deduce from this pattern is that it will this enumerator it will given pass given that you're passing the each symbol to that enumerator then you will keep calling each probably with it will call each probably with a block and you can go down to the yield part right if not you will still return an enumerator so i think this i'm uh this is probably something that we can infer but uh but not now it's not clear yet okay oh so so i i've talked about this enam for actually creates an enumerator if you enumerate by calling the method the given method which is each on on this object itself then that's how it gets to the yield new apple to banana one orange tree this all those values that supposed to be are supposed to enumerate true okay then the question is why would you choose to use this approach over the enumerable right because the enumerable is like very easy you just include the enumerable mod you and then you just implement it each day you have then you have everything done so it's likely your full party will come like a full full scale feature like a array like that but uh one reason you might not want to do that is you might want to you might not want everything you just want one method like one each or just one one select and then then that might be a reason why you might not why will you choose such a method so you implement each method by itself instead of just having all the everything popular then another reason but why is you might have some aha moment some some some good idea that you want some enumeration logic special one that you want to implement then you probably can name it a full name lah instead of each also that effect or reject then you can do some some magic after you buy yourself so there is another reason that i can think of why you want to do do this second method okay so then then this is the part where it's like the brain exercise given that we have seen the patterns of how to how this innumerable works right but we have not seen like how how does it work inside so for the maybe for the more experience will be for you when you look at it then you might already add oh it must it can be done like that can be done like that can be done like that actually there's a lot of ways to do it but it's a worthwhile exercise to think about it because we probably use innumerators like every day without knowing right like writing each using select using map and all the stuff so to create our own enumerator so the approach that i'm going to take is i'm going to replicate the the current enumerator so so the current one is the each written enum for each if not block given right instead of doing that then i want to replicate it by doing the same thing so i will return my custom enum and then we have which has a enum for method which takes in a method specified method if not block given so uh yeah so the the approach i'm going to take is i'm going to replicate it just so just to learn ah just to have some brain exercise final how this can be done okay and then of course after you remain your own enough then the enumerator has many many methods right then it's up to you to see how far you want to go or what interests you how to do it those more more interesting enumerator methods okay so i have a short coding demo i just realized that i only shared the the window for the for the slides so probably you all cannot see my my editor so i'm going to share my whole screen again sorry this is my whole first slide okay so i i i hope that y'all can see my whole editor here okay so so uh in order to replicate the feature of of the of the enumerator the default enumerator right like what's a better way than that probably isn't a better way than writing test first so so i i wrote all the tests already so for example in this one each for the each method is the default enum for and then i wrote wrote some uh just three basic tests that when you call the when you call each so the enum is subject.each then you return the enumerator class object and then you can call next and next and next it returns the basically the next next thing like apple banana orange and then after the end you can call you call next again then you will raise the stop iteration error so this is very basic three three three features of this enumerator what this enumerator can do so i copied the test i didn't want to overwrite it so i copied the test and then basically what change is just this one this custom enumerator part so so which means that we just need to get this thing to pass then it means that everything is working right so so it's not surprising that the custom is failing la because i haven't wrote any code yet for this thing so let's start by by creating the the custom each method and then it should be returning calling enum for like i said just now i want to replicate whatever whatever is already whatever is done by the normal normal method so i can call custom enumerator dot enum for and then custom each so this one is also replicating this one the method here and the simple here should match if not block even so and then we should have all the u also okay so this is obviously going to fail because the custom enumerator doesn't have the enum for method uh and then what i'm going to put here is i'm going to put self here is because enum four is the object class method object method right so of course it got it got the method has access to itself the full basket instance but then for my custom enumerator because my method is outside of the object class is my own class right so i'm going to pass in the object instance yeah it's like a hack behind over it so in my custom enumerator class then i definitely has to i don't know why my computer is writing that thing i think it's a zoom so cluster enum four and then i have an object and then a method method in here okay so in order to pass the first one of course it has to return the custom enumerator class object so i'm going to do is i'm going to do custom enumerator.nu and then i pass in the object method and so it's just tossing true okay and then pass to get that work i must take in the object method here right okay so let's run the test yeah so we got the first one working which is it returns that custom enumerator class object but then it still it still doesn't enumerate over everything lah okay so so then now by calling there's a method here called next right and then next actually enumerates every time you call next it will go through the the fruits one by one and of course then it also means that we probably need some state to to track where which which which fruit have we enumerated till right so so now wherever you connect by right issue you the next one so how do we how do we keep the state okay so of course here then there's many method many many ways of doing it and i'm sure the more experienced rupee engineers will have a lot of ways maybe even better than mine but what i'm going to do here is i'm going to use fiber so i talked about fiber in the last last talk so then then that's how i came to this topic of doing enumerator so i'm just going to continue like using fiber and then uh yeah just just just so to link link the tops okay so uh so i'm going to wrap it in a fiber and then i call object dot stand and then the method and then this time round because i want to i want to track keep track of what which fruits i am right so i just wrap this entire method into a fiber and then every time i call every time i continue the fiber you'll just use the next one okay so then i will do fiber dot u and x okay so so i'm calling the object itself and then i'm calling a custom ish and passing me a block means that you will not get block here so you will come down to gear and then and then because it's a block right then every time i run the u you will just give me the the next apple orange apple banana orange so then in order to make the next to work i just need to do fiber dot resume yeah so i so then every time you resume will give you the next one so i believe the next test will pass okay then the next test is passing right so it means that the next calling next going to the uh the fruits works now so so then the last one will be to raise the stop iteration error right now it still doesn't because the test it says that nothing nothing was raised it's just kind of stop law every time you call next probably something happened in this test but we cannot see it just didn't raise the stop iteration so what i'm going to do here is if you cannot resume anymore then we're going to raise a uh stop stop iteration dot new and then let's say what's the message iteration has reached the end okay something like that okay so i think that this one should work yeah okay so now it works so uh yeah so this is just one way of doing it uh initially it was a bit confusing for me to get to this state uh my code was that way longer then i i keep looking at it and then somehow i like reflect down to something this this simple using fiber but um but i'm sure that you it'll be interesting if you can write the test and then see where you can get you how you can do this enumerator thingy see how you can build your own maybe some some better logic and all yeah so that's it for my life so uh so of course then as you can see that it's like a super super simple implementation of an enumerator and then oh i didn't realize oh and then um of course it's lacking way way way way along so this is a challenge i didn't i i don't think that i i should be going to into all this but then given that you have done the each method like the if you remember the enumerable class if you implement the each method then on you can build map select reject many things on top of the each method so i think it'll be an interesting exercise for yourself if you are interested if you are bored doing algorithms then maybe you can do this uh yeah so so just do two things immediate thing that i can think of is of course to implement it map select reject the other one is can you pass in a block to this enumerator and make it still work so so this interesting to me is the next step if you are into this then you can write a test for it and then trying to make it happen while not failing the biggest test yeah so let's say for my sharing for today uh thank you for listening to me talk about enumerators and i hope that you have learned something yep so yeah yeah that's all okay oh yeah if anybody got any questions i'm okay to take uh yeah if anybody have any questions uh i suppose not if you have any you have a question okay so if like if you pass it to us or if you shy to ask it can like reach out to me directly on the ruby sg telegram yeah you can find find me there yeah okay so yeah and we are done with the first talk which is my talk okay and like i said before i start we only have one talk today so the next part is if anybody got any jobs to share or to shout out or you want to hire or anything anybody yeah i i do okay go ahead uh so okay so i'm sam from silicone jungles right so typically we are we are a local deaf house we do have a number of clients one of the clients actually uh uh want us to help them to recruit a new team right so our team is working with them currently their local startup they are actually a building a new social networking product uh it's going to be our real six um postgres mvc stack and all and then you'll be working alongside if in a very experienced team uh practicing agile pet programming tdd the works right the front end is built using react js and react native um some of the features will be uh live chat right and uh ugc user generated content right and uh anonymous features verified profiles kyc among the works uh so yeah it's a it's a very new way of how should i say a new spin on social networking yeah and and it's actually quite interesting yeah so so if you're interested you can visit siliconejungles.io yeah to to to check us out yeah do they apply there or so like do you have a link or yes if you visit the website it's actually a terminal and then if you could figure out your terminal commands it's actually a cv upload function okay thank you anybody else so any jobs or like even if you're looking for jobs i can i guess no okay if it's known and let's continue uh and then right so now it's the the next meet up will be on the 16 of june next month um yeah so i really created the meet up event and the gihak issue to detail the event like content so please check it out um and then also mark your calendar for that for this day and the idea is that it will be like i don't know whether you like that as a person you probably haven't realized it now so let me say is that the it will be meet up will be on the third Tuesday of every month so let's see how far we can bring this uh meet up uh going how how long we can continue because it also depends on the amount of content that we have so definitely if you like the meet up and then you wish that uh this thing to go on for a long while so then please contribute content uh to help us make this entire thing better yeah so uh yeah so again check out check out the meetup.com event and go and RSVP there and then if you have any suggestions come and inside the meet up issue for for the next video okay and then again uh i think that this is very important to talk about it over and over again it's like how to find us the ruby sg community is to first is the gihak we have a ruby sg gihak organisation but yeah you can find our staff and then we actually have a Singapore ruby brigade facebook group if you have not if you still if you don't know um not so active there but i will still post announcements like for example meet up announcements there and then meetup.com definitely i'm sure you all know this that's why you are here uh and then then again our ruby sg telegram group so the main form of communication will be ruby sg telegram group uh i know some of y'all the odys know about the slack group uh i've decided that the slack group is not worth my effort to go and post there because i've seen you open slack and they're also not very active so we're trying out the telegram see whether it's a better form of communication yep and then oh it's dark and then oh there are no more slack and then oh okay sorry i forgot to put an ending slack yeah uh that's all for the content so like i said uh we're gonna watch some video together if you are interested if you are not uh interested then be free to drop off uh it's okay because this is not not i didn't plan i i think i didn't like really like officially announce it i only like talk about it this morning so i was thinking that since we have so so so little content right then if mita is always about uh just talking there a bit soon so so i'm thinking that recently there's a real scone uh real scone on like conferences that they recorded everything online so i was thinking that maybe we can watch something together so i asked in the chat in the chat rubies you chat somebody recommended the variety show i thought it would be uh interesting uh a more lighthearted thing since since we're going to end the meetup at 8 30 so we will just watch this for maybe 15 minutes or 25 minutes or 20 minutes uh and then again i realized that i need to reshare again it's going to be a new share the computer sound let me do it again