1 00:00:00,600 --> 00:00:04,170 Hello and welcome to this lecture him this lecture. 2 00:00:04,320 --> 00:00:10,790 Ah be walking you through how to interact with Ruby using Ruby far. 3 00:00:10,860 --> 00:00:15,190 We are going to be using a text editor for this link. 4 00:00:15,390 --> 00:00:23,370 Text pelletized basically where you write your code just like you would use a Word document Microsoft 5 00:00:23,370 --> 00:00:25,620 Word to write or text. 6 00:00:25,830 --> 00:00:30,870 So I'll be using a text editor called sublime text. 7 00:00:31,350 --> 00:00:37,500 You can use whatever text editor or you've got already on your computer and that should work the same 8 00:00:37,500 --> 00:00:38,280 way. 9 00:00:38,880 --> 00:00:44,610 I've got sublime text had it open so I'm going to enter some commands. 10 00:00:44,820 --> 00:00:46,320 So I'm going to put this 11 00:00:48,690 --> 00:00:52,250 747 into another puts. 12 00:00:52,260 --> 00:00:59,040 This time I'm going to put a text and then say hello. 13 00:01:01,680 --> 00:01:05,160 Next I'm going to enter a print command. 14 00:01:05,390 --> 00:01:09,550 And when I do a print a number 247. 15 00:01:09,670 --> 00:01:15,780 Notice that when you enter commands in a text editor you don't need to put any quotes around the puts. 16 00:01:15,820 --> 00:01:18,150 Hall print also. 17 00:01:18,420 --> 00:01:22,510 Do I given spaces here spaces don't really matter in terms of Ruby Ruby. 18 00:01:22,650 --> 00:01:28,580 Is white space independent so it doesn't really care what spaces you put. 19 00:01:28,650 --> 00:01:29,570 He ignores it. 20 00:01:29,580 --> 00:01:36,090 It's not dependent on the way the code output is not dependent on the white spaces. 21 00:01:36,210 --> 00:01:43,050 So now we've got a few commands here to get Ruby to read this file for us to be able to interact with 22 00:01:43,050 --> 00:01:43,780 Ruby. 23 00:01:43,890 --> 00:01:49,330 True this far we need to save the file with the file extension cord. 24 00:01:49,330 --> 00:01:57,470 Dot R B we indicate Ruby once we saved this file with a dot RB extension discolouration. 25 00:01:57,490 --> 00:02:06,990 Inside this text editor will also change to reflect the commands in here are Ruby commands. 26 00:02:07,710 --> 00:02:14,010 So let's say that a file will have to file See if you can save it any way you want. 27 00:02:14,010 --> 00:02:20,540 When going to save it to my documents you can also call it whatever name you like and when a call this 28 00:02:20,610 --> 00:02:27,450 test then to test don't are be key team is the RB. 29 00:02:27,460 --> 00:02:31,410 Make sure whether by name you give it as a dot. 30 00:02:31,580 --> 00:02:33,060 Ah be extension. 31 00:02:33,090 --> 00:02:37,280 If not a ruby will not be able to read the FAQ. 32 00:02:37,550 --> 00:02:38,760 So click save. 33 00:02:38,760 --> 00:02:43,040 Once you've done that you can see the chlorine has changed to reflect that. 34 00:02:43,040 --> 00:02:46,100 I've got a file called Test don't. 35 00:02:46,170 --> 00:02:46,850 Ah. 36 00:02:47,430 --> 00:02:50,610 So now how do we interact. 37 00:02:50,610 --> 00:02:53,510 How do we get Ruby to read this far. 38 00:02:53,520 --> 00:02:55,260 We need to open up our command prompt. 39 00:02:55,260 --> 00:02:58,920 I am going to be using my kit bass command. 40 00:02:59,370 --> 00:03:05,130 So use whatever command tool you've got and going to minimize that till the first thing you need to 41 00:03:05,130 --> 00:03:10,000 do is change directory to where you have saved the file. 42 00:03:10,230 --> 00:03:17,130 Or you can copy the full directory path if you know that I am going to change derech free to a Web site 43 00:03:17,220 --> 00:03:17,690 fast. 44 00:03:17,700 --> 00:03:19,090 Much easier to do that. 45 00:03:19,130 --> 00:03:23,040 I am going to do C and then the name of the directory. 46 00:03:23,040 --> 00:03:30,770 I know it's in my documents folder so I've changed to a directory called my documents. 47 00:03:30,780 --> 00:03:31,490 All right. 48 00:03:31,650 --> 00:03:32,760 So you can do the same. 49 00:03:32,790 --> 00:03:40,290 If you are on a Mac as well you need you can you see these to change territory so I'm now in the directory 50 00:03:40,320 --> 00:03:50,730 where I see the ruby far so to call that far in order to interact with Ruby I typee ruby space the name 51 00:03:50,730 --> 00:03:53,350 of the FAQ with this test. 52 00:03:53,490 --> 00:03:55,150 Dot can't be. 53 00:03:55,480 --> 00:03:57,420 And that should display the contents. 54 00:03:57,420 --> 00:03:58,340 There you go. 55 00:03:58,620 --> 00:04:00,460 So that's the first put. 56 00:04:00,470 --> 00:04:02,830 7 4 7 not is with input. 57 00:04:02,850 --> 00:04:06,770 It gives you a single chiras line return had space. 58 00:04:06,890 --> 00:04:08,970 This is on the that portela would give. 59 00:04:08,980 --> 00:04:14,890 You can see a little space underneath the hell you want and then you've got the print print doesn't 60 00:04:14,910 --> 00:04:16,410 give you a carriage return. 61 00:04:16,410 --> 00:04:23,040 So if I open up the code you can see the code here and just minimize that. 62 00:04:23,040 --> 00:04:24,960 So that's the code here. 63 00:04:25,320 --> 00:04:28,170 You can see the port is this one here. 64 00:04:28,250 --> 00:04:30,430 Some for 7. 65 00:04:30,570 --> 00:04:31,170 This is the other. 66 00:04:31,170 --> 00:04:31,810 Put her there. 67 00:04:31,860 --> 00:04:33,380 Well that's it. 68 00:04:33,390 --> 00:04:35,840 This is the print asset. 69 00:04:36,060 --> 00:04:41,200 So that's how you interact with Ruby use in a far. 70 00:04:41,370 --> 00:04:47,520 Once you've kaeding your code inside be text say it or you say who were the daut are B file extension 71 00:04:48,060 --> 00:04:53,600 and then you reference that VI command line utilities by calling the file name. 72 00:04:53,880 --> 00:04:59,750 We should have a dot R be file extension so that's it for this lecture. 73 00:05:00,160 --> 00:05:03,730 Interacting with Ruby VI he Ruby. 74 00:05:03,730 --> 00:05:06,070 Far many thanks for watching. 75 00:05:06,070 --> 00:05:06,990 Bye for now.