Difference between revisions of "Ruby/C3/Object-Oriented-Concept-in-Ruby/Kannada"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 71: Line 71:
 
|-
 
|-
 
| 01:14
 
| 01:14
|''' class Product'''
+
| 'class Product'
 
|-
 
|-
 
| 01:16
 
| 01:16
|''' ruby code'''  
+
| 'ruby code'  
 
|-
 
|-
 
| 01:17
 
| 01:17
|'''end'''
+
| 'end'  
 
|-
 
|-
 
|  01:20
 
|  01:20
Line 137: Line 137:
 
|-
 
|-
 
|  02:30
 
|  02:30
| ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ: '''puts Order dot instance underscore variables'''
+
| ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ: 'puts Order dot instance underscore variables'
 
|-
 
|-
 
| 02:36
 
| 02:36
Line 152: Line 152:
 
|-
 
|-
 
|  02:56
 
|  02:56
| '''ruby space class underscore definition dot rb'''  
+
| 'ruby space class underscore definition dot rb'  
 
|-
 
|-
 
| 03:02
 
| 03:02
Line 161: Line 161:
 
|-
 
|-
 
| 03:09
 
| 03:09
| ಈಗ, ಹೀಗೆ ಟೈಪ್ ಮಾಡೋಣ: ''' puts Order dot class underscore variables'''  
+
| ಈಗ, ಹೀಗೆ ಟೈಪ್ ಮಾಡೋಣ: 'puts Order dot class underscore variables'  
 
|-
 
|-
 
| 03:15
 
| 03:15
Line 230: Line 230:
 
|-
 
|-
 
| 04:50
 
| 04:50
| ಮತ್ತು ಅದನ್ನು '''object underscore initialize dot rb''' ಎಂದು ಹೆಸರಿಸಿ.
+
| ಮತ್ತು ಅದನ್ನು 'object underscore initialize dot rb' ಎಂದು ಹೆಸರಿಸಿ.
 
|-
 
|-
 
| 04:55
 
| 04:55
Line 248: Line 248:
 
|-
 
|-
 
| 05:20
 
| 05:20
|ನಂತರ, ನಾನು 'Order dot new' ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
+
| ನಂತರ, ನಾನು 'Order dot new' ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
 
|-
 
|-
 
| 05:24
 
| 05:24
|ಇದು, 'initialize' ಮೆಥಡ್ ಅನ್ನು ಇನ್ವೋಕ್ ಮಾಡುತ್ತದೆ.
+
| ಇದು, 'initialize' ಮೆಥಡ್ ಅನ್ನು ಇನ್ವೋಕ್ ಮಾಡುತ್ತದೆ.
 
|-
 
|-
 
| 05:27
 
| 05:27
|ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
+
| ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
 
|-
 
|-
 
| 05:31
 
| 05:31
Line 266: Line 266:
 
|-
 
|-
 
| 05:43
 
| 05:43
| ಈಗ, ನಾವು 'gedit'ಗೆ ಹಿಂದಿರುಗೋಣ. ಮತ್ತು ಮೆಥಡ್ ಗೆ ಒಂದು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು ಸೇರಿಸೋಣ.
+
| ಈಗ, ನಾವು 'gedit'ಗೆ ಹಿಂದಿರುಗೋಣ ಮತ್ತು ಮೆಥಡ್ ಗೆ ಒಂದು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು ಸೇರಿಸೋಣ.
 
|-
 
|-
 
| 05:48
 
| 05:48
Line 281: Line 281:
 
|-
 
|-
 
| 06:04
 
| 06:04
|ಇಲ್ಲಿ, ನಾವು "new" ಎಂಬ ಮೆಥಡ್ ಗೆ ಒಂದು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು ಕೊಟ್ಟಿದ್ದೇವೆ.  
+
| ಇಲ್ಲಿ, ನಾವು "new" ಎಂಬ ಮೆಥಡ್ ಗೆ ಒಂದು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು ಕೊಟ್ಟಿದ್ದೇವೆ.  
 
|-
 
|-
 
|  06:08
 
|  06:08
| This '''argument''' gets passed on to the '''initialize method.'''
+
| 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು 'initialize' ಮೆಥಡ್ ಗೆ ಪಾಸ್ ಮಾಡಲಾಗುತ್ತದೆ.
 
|-
 
|-
 
| 06:13
 
| 06:13
Line 299: Line 299:
 
|-
 
|-
 
| 06:29
 
| 06:29
| Now, you would have understood what ''' object initialization''' means.  
+
| ಈಗ, 'ಆಬ್ಜೆಕ್ಟ್ ಇನಿಶಿಯಲೈಜೇಶನ್' ಎಂದರೆ ಏನು ಎಂಬುದು ನಿಮಗೆ ತಿಳಿದಿರಬೇಕು.  
 
|-
 
|-
 
|  06:33
 
|  06:33
|Recall that in Ruby, '''methods''' are the '''functions''' that a '''class''' performs.  
+
| Ruby ಯಲ್ಲಿ ಮೆಥಡ್ ಗಳು, 'ಕ್ಲಾಸ್' ನಿರ್ವಹಿಸುವ 'ಫಂಕ್ಷನ್' ಗಳಾಗಿವೆ ಎಂಬುದನ್ನು ನೆನಪಿಸಿಕೊಳ್ಳಿ.  
 
|-
 
|-
 
| 06:39
 
| 06:39
|Each '''method''' in a class is defined within the '''“def”'''  and '''“end”''' block.  
+
| ಕ್ಲಾಸ್ ನಲ್ಲಿಯ ಪ್ರತಿಯೊಂದು ಮೆಥಡ್, “def” ಮತ್ತು “end” ಬ್ಲಾಕ್ ಗಳ ಒಳಗೆ ಡಿಫೈನ್ ಮಾಡಲ್ಪಡುತ್ತದೆ.  
 
|-
 
|-
 
| 06:45
 
| 06:45
|A multiword  method-name is separated with an '''underscore.'''
+
| ಅನೇಕ ಶಬ್ದಗಳಿರುವ ಮೆಥಡ್ ನ ಹೆಸರು 'ಅಂಡರ್ಸ್ಕೋರ್'ನಿಂದ ಬೇರ್ಪಡಿಸಲ್ಪಟ್ಟಿರುತ್ತದೆ.
 
|-
 
|-
 
| 06:48
 
| 06:48
|Some of the characters that can be appended to a '''method''' name are:  
+
| ಮೆಥಡ್ ನ ಹೆಸರಿನ ಮುಂದೆ ಸೇರಿಸಲಾಗುವ ಕೆಲವು ಅಕ್ಷರಗಳು ಹೀಗಿವೆ.  
 
|-
 
|-
 
| 06:54
 
| 06:54
Line 320: Line 320:
 
|-
 
|-
 
| 06:58
 
| 06:58
|Each of the characters add some meaning to the '''method.'''
+
| ಇವುಗಳಲ್ಲಿ, ಪ್ರತಿಯೊಂದು ಅಕ್ಷರವು ಮೆಥಡ್ ಗೆ ವಿಶೇಷ ಅರ್ಥವನ್ನು ಸೇರಿಸುತ್ತದೆ.
 
|-
 
|-
 
| 07:02
 
| 07:02
Line 338: Line 338:
 
|-
 
|-
 
| 07:21
 
| 07:21
|Here, I have defined a class named ''' “Animal”.'''
+
|ಇಲ್ಲಿ, ನಾನು “Animal” ಎಂಬ ಹೆಸರಿನ ಒಂದು class (ಕ್ಲಾಸ್) ಅನ್ನು ನಾನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.  
 
|-
 
|-
 
| 07:23
 
| 07:23
|Then I have two  methods- “breathe” and  “walk”.
+
| ನಂತರ, ಇಲ್ಲಿ ಎರಡು ಮೆಥಡ್ ಗಳಿವೆ- “breathe” ಮತ್ತು “walk”.
 
|-
 
|-
 
| 07:28
 
| 07:28
|They are both defined with the “def” and  “end” keywords.  
+
| ಇವೆರಡೂ “def” ಮತ್ತು “end” ಕೀವರ್ಡ್ ಗಳೊಂದಿಗೆ ಡಿಫೈನ್ ಮಾಡಲ್ಪಟ್ಟಿವೆ.  
 
|-
 
|-
 
| 07:32
 
| 07:32
|I have then initialized the ''' object Animal.'''
+
| ನಂತರ ನಾನು “Animal” ಎಂಬ ಆಬ್ಜೆಕ್ಟ್ ಅನ್ನು ಇನಿಶಿಯಲೈಸ್ ಮಾಡಿದ್ದೇನೆ.
 
|-
 
|-
 
| 07:36
 
| 07:36

Revision as of 15:52, 21 January 2016

Time Narration
00:01 Ruby ಯಲ್ಲಿ Object Oriented Concept (ಆಬ್ಜೆಕ್ಟ್ ಓರಿಯಂಟೆಡ್ ಕಾನ್ಸೆಪ್ಟ್) ಎಂಬ 'ಸ್ಪೋಕನ್ ಟ್ಯುಟೋರಿಯಲ್' ಗೆ ನಿಮಗೆ ಸ್ವಾಗತ.
00:06 ಈ ಟ್ಯುಟೋರಿಯಲ್ ನಲ್ಲಿ ನಾವು:
00:08 * 'ಕ್ಲಾಸ್'ಗಳನ್ನು ಬಳಸುವುದು
00:09 * 'ಆಬ್ಜೆಕ್ಟ್' ಗಳನ್ನು ಕ್ರಿಯೇಟ್ ಮಾಡುವುದು
00:10 * 'Ruby'ಯಲ್ಲಿ 'ಮೆಥಡ್'ಗಳನ್ನು ಡಿಫೈನ್ ಮಾಡುವ ವಿಭಿನ್ನ ರೀತಿಗಳು ಇವುಗಳನ್ನು ಕಲಿಯುವೆವು.
00:13 ಇಲ್ಲಿ ನಾವು:
00:14 * Ubuntu ಆವೃತ್ತಿ 12.04
00:16 * Ruby 1.9.3 ಇವುಗಳನ್ನು ಬಳಸುತ್ತಿದ್ದೇವೆ.
00:19 ಈ ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ಅನುಸರಿಸಲು, 'Linux' ಕಮಾಂಡ್ ಗಳು, ‘ಟರ್ಮಿನಲ್’ ಮತ್ತು 'ಟೆಕ್ಸ್ಟ್-ಎಡಿಟರ್' ಗಳನ್ನು ನೀವು ತಿಳಿದಿರಬೇಕು.
00:24 ಇಲ್ಲದಿದ್ದರೆ, ಸಂಬಂಧಿತ ಟ್ಯುಟೋರಿಯಲ್ ಗಳಿಗಾಗಿ ದಯವಿಟ್ಟು ನಮ್ಮ ವೆಬ್ಸೈಟ್ ಗೆ ಭೆಟ್ಟಿಕೊಡಿ.
00:28 ಪ್ರಾರಂಭಿಸುವ ಮುನ್ನ, “ttt” ಎಂಬ ಡಿರೆಕ್ಟರೀಯನ್ನು ಈಮೊದಲು ನಾವು ಕ್ರಿಯೇಟ್ ಮಾಡಿದ್ದೆವು ಎಂಬುದನ್ನು ನೆನಪಿಸಿಕೊಳ್ಳಿ.
00:33 ನಾವು ಆ ಡಿರೆಕ್ಟರೀಗೆ,
00:35 'ruby hyphen tutorial' ಮತ್ತು 'classes' ಡಿರೆಕ್ಟರೀಗಳಿಗೆ ಹೋಗೋಣ.
00:41 'Ruby' (ರೂಬಿ), ಒಂದು ಆಬ್ಜೆಕ್ಟ್ ಓರಿಯಂಟೆಡ್ ಭಾಷೆಯಾಗಿದೆ.
00:44 'Ruby'ಯಲ್ಲಿ ವ್ಯಾಲ್ಯೂ, ಸ್ಟ್ರಿಂಗ್ ಅಥವಾ ಸಂಖ್ಯೆ ಎಲ್ಲವೂ ಆಬ್ಜೆಕ್ಟ್ ಗಳಾಗಿವೆ.
00:49 'ಕ್ಲಾಸ್' (class), ಸಂಬಂಧಿತ ಡೇಟಾ ಮತ್ತು ಫಂಕ್ಷನ್ ಗಳ ಒಂದು ಸಂಗ್ರಹವಾಗಿದೆ.
00:53 ಇದು ಮಾಹಿತಿಯನ್ನು ವ್ಯವಸ್ಠಿತವಾಗಿ ಇಡಲು ಸಹಾಯಮಾಡುತ್ತದೆ.
00:56 ಆಬ್ಜೆಕ್ಟ್, 'ಕ್ಲಾಸ್'ನ ಒಂದು ನಿದರ್ಶನವಾಗಿದೆ.
01:00 'ಕ್ಲಾಸ್'ನ ವ್ಯಾಖ್ಯಾನವು (definition), 'class' ಎಂಬ ಕೀವರ್ಡ್ ನಿಂದ ಆರಂಭವಾಗುತ್ತದೆ.
01:05 ಇದರ ನಂತರ 'ಕ್ಲಾಸ್'ನ ಹೆಸರು (class name) ಇರುತ್ತದೆ.
01:08 ಇದು “end” ನಿಂದ ಕೊನೆಗೊಳ್ಳುತ್ತದೆ.
01:11 ನಾವು class ನ ಒಂದು ಉದಾಹರಣೆಯನ್ನು ನೋಡೋಣ.
01:14 'class Product'
01:16 'ruby code'
01:17 'end'
01:20 'ಕ್ಲಾಸ್'ನ ಹೆಸರು ದೊಡ್ಡಕ್ಷರದಿಂದಲೇ ಆರಂಭವಾಗಬೇಕು.
01:24 ಒಂದಕ್ಕಿಂತ ಹೆಚ್ಚು ಶಬ್ದಗಳನ್ನು ಹೊಂದಿರುವ ಹೆಸರುಗಳು ’ಕ್ಯಾಮಲ್ ಕೇಸ್’ (camelcase) ನಲ್ಲಿ ಇರಬೇಕು.
01:28 ಉದಾಹರಣೆಗೆ,
01:30 'UserInformation'
01:32 'ProductInformation'
01:34 ಅನಂತರದ ಫೈಲ್ ನ ಹೆಸರುಗಳು, ಶಬ್ದಗಳನ್ನು ಬೇರ್ಪಡಿಸಲು 'ಅಂಡರ್ಸ್ಕೋರ್'ಅನ್ನು ಹೊಂದಿರುವುವು:
01:37 'user underscore information' (ಯೂಸರ್ ಅಂಡರ್ಸ್ಕೋರ್ ಇನ್ಫರ್ಮೇಶನ್)
01:40 'product underscore information' (ಪ್ರೊಡಕ್ಟ್ ಅಂಡರ್ಸ್ಕೋರ್ ಇನ್ಫರ್ಮೇಶನ್)
01:45 ಪ್ರಾಥಮಿಕ ಹಂತದ 'Ruby tutorials'ನಲ್ಲಿ ತೋರಿಸಿದಂತೆ 'gedit'ನಲ್ಲಿ ಒಂದು ಹೊಸ ಫೈಲನ್ನು ಕ್ರಿಯೇಟ್ ಮಾಡಿ.
01:48 ಅದನ್ನು "class_definition.rb" ಎಂದು ಹೆಸರಿಸಿ.
01:52 ನನ್ನ ಹತ್ತಿರ 'classes' (ಕ್ಲಾಸಸ್)ಅನ್ನು ಜಾರಿಗೊಳಿಸುವ ಒಂದು ಉದಾಹರಣೆಯಿದೆ.
01:57 ನಾವು ಇದರಲ್ಲಿ ಮುಂದುವರಿಯುತ್ತಿದ್ದಂತೆ, ನೀವು ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ನಿಲ್ಲಿಸಿ ಕೋಡ್ ಅನ್ನು ಟೈಪ್ ಮಾಡಬಹುದು.
02:02 ಈ ಉದಾಹರಣೆಯಲ್ಲಿ, ನಾನು 'Order' ಎಂಬ ಹೆಸರಿನ ಒಂದು 'class' (ಕ್ಲಾಸ್)ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
02:05 ಈಗ, ನಾವು ಕೆಲವು ವೇರಿಯೇಬಲ್ ಗಳನ್ನು ಸೇರಿಸಿ ಕ್ಲಾಸ್ ಅನ್ನು ಉಪಯುಕ್ತಗೊಳಿಸೋಣ.
02:11 ಆಮೇಲೆ ನಾನು “myinstance” ಎಂಬ ಒಂದು ಇನ್ಸ್ಟನ್ಸ್ ವೇರಿಯೇಬಲ್ ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ
02:15 ಹಾಗೂ ಅದಕ್ಕೆ ಒಂದು ವ್ಯಾಲ್ಯೂಅನ್ನು ಅಸೈನ್ ಮಾಡಿದ್ದೇನೆ.
02:18 ನಾನು “myclassvar” ಎಂಬ ಒಂದು ಕ್ಲಾಸ್-ವೇರಿಯೇಬಲ್ ಅನ್ನು ಸಹ ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ
02:21 ಹಾಗೂ ಅದಕ್ಕೆ ಒಂದು ವ್ಯಾಲ್ಯೂಅನ್ನು ಅಸೈನ್ ಮಾಡಿದ್ದೇನೆ.
02:24 ಈಗ, ಈ 'class'ಅನ್ನು ಉಪಯೋಗಿಸುವ ಸ್ವಲ್ಪ ಕೋಡ್ ಅನ್ನು ನಾವು ಸೇರಿಸೋಣ.
02:30 ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ: 'puts Order dot instance underscore variables'
02:36 ಈ ಸಾಲಿನ ಮೊದಲು, 'puts' ಕೆಲವು ಅಕ್ಷರಗಳು ಹೊಸ ಪಂಕ್ತಿಗಾಗಿ ಸ್ಲ್ಯಾಶ್ 'n' ಅನ್ನು ಸೇರಿಸಿ.
02:43 ಇದನ್ನು ಕಾಪಿ ಮತ್ತು ಪೇಸ್ಟ್ ಮಾಡೋಣ ಮತ್ತು ನಾವು ಸೇರಿಸಿದ ಪಂಕ್ತಿಯ ಕೆಳಗೆ ಇದನ್ನು ಸೇರಿಸೋಣ ಹಾಗೂ ಸೇವ್ ಮಾಡೋಣ.
02:51 ಈಗ, ಈ ಕೋಡ್ ಅನ್ನು ನಾವು ಎಕ್ಸೀಕ್ಯೂಟ್ ಮಾಡೋಣ.
02:53 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
02:56 'ruby space class underscore definition dot rb'
03:02 ಹಾಗೂ ಔಟ್ಪುಟ್ ಅನ್ನು ನೋಡಿ.
03:05 ನೀವು ಡಿಫೈನ್ ಮಾಡಿದ 'ಇನ್ಸ್ಟನ್ಸ್ ವೇರಿಯೇಬಲ್'ಅನ್ನು ನೀವು ನೋಡುವಿರಿ.
03:09 ಈಗ, ಹೀಗೆ ಟೈಪ್ ಮಾಡೋಣ: 'puts Order dot class underscore variables'
03:15 ಪಂಕ್ತಿಯ ಕೆಳಗೆ ಎಲ್ಲೆ ಗುರುತನ್ನು ಕಾಪಿ ಮತ್ತು ಪೇಸ್ಟ್ ಮಾಡಿ ಅದನ್ನು ಸೇವ್ ಮಾಡೋಣ.
03:21 ಈಗ, ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಫೈಲನ್ನು ಈ ಮೊದಲು ಮಾಡಿದಂತೆ ಎಕ್ಸೀಕ್ಯೂಟ್ ಮಾಡೋಣ.
03:26 ನೀವು ಡಿಫೈನ್ ಮಾಡಿದ 'ಕ್ಲಾಸ್ ವೇರಿಯೇಬಲ್' ಸಹ ಕಾಣಿಸಿಕೊಳ್ಳುವುದನ್ನು ನೀವು ನೋಡುವಿರಿ.
03:32 ಈಗ ನಿಮಗೆ ನಿಮ್ಮ ಸ್ವಂತದ 'ಕ್ಲಾಸ್'ಅನ್ನು ಬರೆಯಲು ಸಾಧ್ಯವಾಗಬೇಕು.
03:35 ಇನ್ನುಮುಂದೆ, 'ಆಬ್ಜೆಕ್ಟ್' ಎಂದರೇನು ಎಂಬುದನ್ನು ನಾವು ನೋಡೋಣ.
03:40 'ಆಬ್ಜೆಕ್ಟ್', 'ಕ್ಲಾಸ್'ನ ಒಂದು ಇನ್ಸ್ಟನ್ಸ್ ಆಗಿದೆ.
03:43 ಎಂದರೆ, 'ಆಬ್ಜೆಕ್ಟ್'ಅನ್ನು ಕ್ಲಾಸ್ ನಿಂದ ಕ್ರಿಯೇಟ್ ಮಾಡಲಾಗುತ್ತದೆ.
03:46 'ಆಬ್ಜೆಕ್ಟ್', ಕ್ಲಾಸ್ ನಲ್ಲಿ ಡಿಫೈನ್ ಮಾಡಿದ ಗುಣಲಕ್ಷಣಗಳನ್ನು ಮತ್ತು ಮೆಥಡ್ ಗಳನ್ನು ಹೊಂದಿರುವುದು.
03:52 ನೀವು 'ಆಬ್ಜೆಕ್ಟ್'ಅನ್ನು ಹೇಗೆ ಡಿಕ್ಲೇರ್ ಮಾಡುತ್ತೀರಿ?
03:54 "new" ಎಂಬ ಕೀವರ್ಡ್ ಅನ್ನು ಬಳಸಿ, ಒಂದು 'ಕ್ಲಾಸ್'ನ 'ಆಬ್ಜೆಕ್ಟ್'ಅನ್ನು ನಾವು ಡಿಕ್ಲೇರ್ ಮಾಡುತ್ತೇವೆ.
03:58 ಇಲ್ಲಿ, ನಾವು "Product" ಎಂಬ ಕ್ಲಾಸ್ ನ ಒಂದು 'ಆಬ್ಜೆಕ್ಟ್'ಅನ್ನು ಡಿಕ್ಲೇರ್ ಮಾಡುತ್ತಿದ್ದೇವೆ.
04:02 ಇಲ್ಲಿ, ಒಂದು 'ಆಬ್ಜೆಕ್ಟ್'ಅನ್ನು ಕ್ರಿಯೇಟ್ ಮಾಡಲಾಗುತ್ತದೆ.
04:05 'product = Product.new'
04:09 ಈ ಪ್ರಕ್ರಿಯೆಯನ್ನು 'ಆಬ್ಜೆಕ್ಟ್ ಇನಿಶಿಯಲೈಜೇಶನ್' (initialization) ಎಂದು ಕರೆಯಲಾಗುತ್ತದೆ.
04:12 ಈ 'ಆಬ್ಜೆಕ್ಟ್', 'Product' ಎಂಬ ಟೈಪ್ ನದ್ದು ಆಗಿದೆ.
04:16 ಈಗ, “initialize” ಮೆಥಡ್ ಎಂದರೆ ಏನು ಎಂಬುದನ್ನು ನಾವು ನೋಡೋಣ.
04:20 'ಆಬ್ಜೆಕ್ಟ್'ಅನ್ನು ಕ್ರಿಯೇಟ್ ಮಾಡುವ ಸಮಯದಲ್ಲಿ, 'ಇನಿಶಿಯಲೈಸ್' ಎಂಬ 'ಮೆಥಡ್'ಅನ್ನು ಕಾಲ್ ಮಾಡಲಾಗುವುದು.
04:26 ಒಂದು 'ಆಬ್ಜೆಕ್ಟ್'ನ ಮೇಲೆ "new" ಅನ್ನು ಕಾಲ್ ಮಾಡಿದ ಮೇಲೆ, ನಾವು 'ಇನಿಶಿಯಲೈಸ್ ಮೆಥಡ್'ಅನ್ನು ಇನ್ವೋಕ್ ಮಾಡುತ್ತೇವೆ.
04:31 'initialize (ಇನಿಶಿಯಲೈಸ್) ಮೆಥಡ್', ಪ್ಯಾರಾಮೀಟರ್ ಗಳ ಲಿಸ್ಟ್ ಅನ್ನು ತೆಗೆದುಕೊಳ್ಳಬಹುದು.
04:37 ಇನ್ನಿತರ 'ರೂಬಿ' ಮೆಥಡ್ ಗಳಂತೆ, ಇದು “def” ಕೀವರ್ಡ್ ನಿಂದ ಆರಂಭವಾಗುತ್ತದೆ.
04:43 ನಾವು ಒಂದು ಉದಾಹರಣೆಯನ್ನು ನೋಡೋಣ.
04:46 ಪ್ರಾಥಮಿಕ ಹಂತದ 'Ruby Tutorials'ನಲ್ಲಿ ತೋರಿಸಿದಂತೆ 'gedit'ನಲ್ಲಿ ಒಂದು ಹೊಸ ಫೈಲನ್ನು ಕ್ರಿಯೇಟ್ ಮಾಡಿ.
04:50 ಮತ್ತು ಅದನ್ನು 'object underscore initialize dot rb' ಎಂದು ಹೆಸರಿಸಿ.
04:55 ನನ್ನ ಹತ್ತಿರ 'ಆಬ್ಜೆಕ್ಟ್ ಇನಿಶಿಯಲೈಜೇಶನ್' ಕೋಡ್ ನ ಒಂದು ಉದಾಹರಣೆಯಿದೆ.
05:00 ನಾವು ಇದರಲ್ಲಿ ಮುಂದುವರಿಯುತ್ತಿದ್ದಂತೆ, ನೀವು ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ನಿಲ್ಲಿಸಿ ಕೋಡ್ ಅನ್ನು ಟೈಪ್ ಮಾಡಬಹುದು.
05:04 ಇಲ್ಲಿ, ನಾನು “Order” ಎಂಬ ಒಂದು ಕ್ಲಾಸ್ ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
05:08 ನಂತರ, ನಾನು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಗಳನ್ನು ಹೊಂದಿರದ 'initialize' ಮೆಥಡ್ ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
05:13 “I have created an object” ಎಂಬ ಮೆಸೇಜನ್ನು ತೋರಿಸಲು, ನಾನು ಒಂದು 'puts' ಮೆಥಡ್ ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
05:20 ನಂತರ, ನಾನು 'Order dot new' ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
05:24 ಇದು, 'initialize' ಮೆಥಡ್ ಅನ್ನು ಇನ್ವೋಕ್ ಮಾಡುತ್ತದೆ.
05:27 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
05:31 'ruby space object underscore initialize dot rb'
05:36 ಹಾಗೂ ಔಟ್ಪುಟ್ ಅನ್ನು ನೋಡಿ.
05:39 ನೀವು “I have created an object” ಎಂಬ ಮೆಸೇಜನ್ನು ನೋಡುವಿರಿ.
05:43 ಈಗ, ನಾವು 'gedit'ಗೆ ಹಿಂದಿರುಗೋಣ ಮತ್ತು ಮೆಥಡ್ ಗೆ ಒಂದು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು ಸೇರಿಸೋಣ.
05:48 ನಾವು 'puts'ಅನ್ನು ಬದಲಾಯಿಸೋಣ.
05:51 ಅದು, ಪಾಸ್ ಮಾಡಿದ 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ನ ವ್ಯಾಲ್ಯೂಅನ್ನು ತೋರಿಸಬೇಕು.
05:55 ನಂತರ, ಹೀಗೆ ಟೈಪ್ ಮಾಡೋಣ:
05:56 'Order dot new(“I have created an object”)'
06:04 ಇಲ್ಲಿ, ನಾವು "new" ಎಂಬ ಮೆಥಡ್ ಗೆ ಒಂದು 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು ಕೊಟ್ಟಿದ್ದೇವೆ.
06:08 ಈ 'ಆರ್ಗ್ಯೂಮೆಂಟ್'ಅನ್ನು 'initialize' ಮೆಥಡ್ ಗೆ ಪಾಸ್ ಮಾಡಲಾಗುತ್ತದೆ.
06:13 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
06:16 'ruby space object underscore initialize dot rb'
06:20 ಹಾಗೂ ಔಟ್ಪುಟ್ ಅನ್ನು ನೋಡಿ.
06:22 “I have created an object” ಎಂಬ ಮೆಸೇಜ್ ಪ್ರಿಂಟ್ ಆಗಿರುವುದನ್ನು ನೀವು ನೋಡುವಿರಿ.
06:29 ಈಗ, 'ಆಬ್ಜೆಕ್ಟ್ ಇನಿಶಿಯಲೈಜೇಶನ್' ಎಂದರೆ ಏನು ಎಂಬುದು ನಿಮಗೆ ತಿಳಿದಿರಬೇಕು.
06:33 Ruby ಯಲ್ಲಿ ಮೆಥಡ್ ಗಳು, 'ಕ್ಲಾಸ್' ನಿರ್ವಹಿಸುವ 'ಫಂಕ್ಷನ್' ಗಳಾಗಿವೆ ಎಂಬುದನ್ನು ನೆನಪಿಸಿಕೊಳ್ಳಿ.
06:39 ಕ್ಲಾಸ್ ನಲ್ಲಿಯ ಪ್ರತಿಯೊಂದು ಮೆಥಡ್, “def” ಮತ್ತು “end” ಬ್ಲಾಕ್ ಗಳ ಒಳಗೆ ಡಿಫೈನ್ ಮಾಡಲ್ಪಡುತ್ತದೆ.
06:45 ಅನೇಕ ಶಬ್ದಗಳಿರುವ ಮೆಥಡ್ ನ ಹೆಸರು 'ಅಂಡರ್ಸ್ಕೋರ್'ನಿಂದ ಬೇರ್ಪಡಿಸಲ್ಪಟ್ಟಿರುತ್ತದೆ.
06:48 ಮೆಥಡ್ ನ ಹೆಸರಿನ ಮುಂದೆ ಸೇರಿಸಲಾಗುವ ಕೆಲವು ಅಕ್ಷರಗಳು ಹೀಗಿವೆ.
06:54 '?' (ಪ್ರಶ್ನಾರ್ಥಕ ಚಿಹ್ನೆ)
06:56 '=' (ಸಮ ಚಿಹ್ನೆ).
06:58 ಇವುಗಳಲ್ಲಿ, ಪ್ರತಿಯೊಂದು ಅಕ್ಷರವು ಮೆಥಡ್ ಗೆ ವಿಶೇಷ ಅರ್ಥವನ್ನು ಸೇರಿಸುತ್ತದೆ.
07:02 ನಾವು ಕೆಲವು ಉದಾಹರಣೆಗಳನ್ನು ನೋಡೋಣ.
07:05 ಪ್ರಾಥಮಿಕ ಹಂತದ 'Ruby Tutorials'ನಲ್ಲಿ ತೋರಿಸಿದಂತೆ 'gedit'ನಲ್ಲಿ ಒಂದು ಹೊಸ ಫೈಲನ್ನು ಕ್ರಿಯೇಟ್ ಮಾಡಿ.
07:09 ಮತ್ತು ಅದನ್ನು 'class underscore methods dot rb' ಎಂದು ಹೆಸರಿಸಿ.
07:14 ನನ್ನ ಹತ್ತಿರ 'ಕ್ಲಾಸ್ ಮೆಥಡ್ಸ್' ಕೋಡ್ ನ ಒಂದು ಉದಾಹರಣೆಯಿದೆ.
07:17 ನಾವು ಇದರಲ್ಲಿ ಮುಂದುವರಿಯುತ್ತಿದ್ದಂತೆ, ನೀವು ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ನಿಲ್ಲಿಸಿ ಕೋಡ್ ಅನ್ನು ಟೈಪ್ ಮಾಡಬಹುದು.
07:21 ಇಲ್ಲಿ, ನಾನು “Animal” ಎಂಬ ಹೆಸರಿನ ಒಂದು class (ಕ್ಲಾಸ್) ಅನ್ನು ನಾನು ಡಿಫೈನ್ ಮಾಡಿದ್ದೇನೆ.
07:23 ನಂತರ, ಇಲ್ಲಿ ಎರಡು ಮೆಥಡ್ ಗಳಿವೆ- “breathe” ಮತ್ತು “walk”.
07:28 ಇವೆರಡೂ “def” ಮತ್ತು “end” ಕೀವರ್ಡ್ ಗಳೊಂದಿಗೆ ಡಿಫೈನ್ ಮಾಡಲ್ಪಟ್ಟಿವೆ.
07:32 ನಂತರ ನಾನು “Animal” ಎಂಬ ಆಬ್ಜೆಕ್ಟ್ ಅನ್ನು ಇನಿಶಿಯಲೈಸ್ ಮಾಡಿದ್ದೇನೆ.
07:36 I have assigned it to a variable called “animal” with lowercase “a”.
07:40 Then I have invoked the methods “breathe” and “walk” consecutively.
07:48 ಈಗ, ನಾವು ಪ್ರೊಗ್ರಾಂಅನ್ನು ಎಕ್ಸೀಕ್ಯೂಟ್ ಮಾಡೋಣ.
07:51 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
07:53 'ruby space class underscore methods dot rb'
07:58 ಹಾಗೂ ಔಟ್ಪುಟ್ ಅನ್ನು ನೋಡಿ.
08:00 ನೀವು ಈ ಕೆಳಗಿನ ಸಾಲುಗಳು-
08:02 “I breathe”
08:03 “I walk”
08:04 ಪ್ರಿಂಟ್ ಆಗುವುದನ್ನು ನೋಡುವಿರಿ:
08:05 This is because you have invoked the two methods “breathe” and “walk”.
08:10 A “puts” statement defined within these methods gives the results you see.
08:16 Next, let us look at how to create methods with a trailing question mark.
08:21 Create a new file in gedit as shown in the basic level Ruby tutorials.
08:25 And name it class underscore methods underscore with underscore trailing underscore characters dot rb.
08:35 I have a working example of class methods with question mark code.
08:40 You can pause the tutorial and type the code as we go through it.
08:45 Here, I have taken the same class as before, as an example.
08:48 Here, the "breathe" method has a trailing question mark (?).
08:52 Such methods are generally used to return boolean values.
08:55 This is based on the method naming convention of Ruby.
09:00 The method gets invoked by declaring animal dot breathe question-mark.
09:06 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
09:09 ruby space class underscore methods underscore with underscore trailing underscore characters dot rb and see the output.
09:22 You will notice the output as : “true”
09:26 Next, let us define another method called “walk”.
09:30 Let us place an equal-to sign “=(value)” beside it.
09:36 Let us invoke this method by calling animal dot walk.
09:41 Then let us execute this method.
09:44 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ:
09:45 ruby class underscore methods underscore with underscore trailing underscore characters dot rb
09:52 and see the output.
09:56 It will give an “undefined method” error.
09:59 This is because the equal to sign has another meaning.
10:03 It is used to assign a value to a method.
10:08 So, let us invoke the method a little differently this time.
10:13 ಹೀಗೆ ಟೈಪ್ ಮಾಡಿ: 'puts animal dot walk equal to “ hops” '.
10:17 ಈಗ, ಇದನ್ನು ಇನ್ನೊಮ್ಮೆ ಪ್ರಯತ್ನಿಸೋಣ.
10:20 ಟರ್ಮಿನಲ್ ಗೆ ಬದಲಾಯಿಸಿ ಮತ್ತು ಮೊದಲಿನಂತೆ ಕಮಾಂಡ್ ಅನ್ನು ರನ್ ಮಾಡಿ ಹಾಗೂ ಔಟ್ಪುಟ್ ಅನ್ನು ನೋಡಿ.
10:27 “hops” ಎಂಬ ಶಬ್ದವು ಪ್ರಿಂಟ್ ಆಗುವುದನ್ನು ನೀವು ನೋಡುವಿರಿ.
10:30 ಒಂದು ಮೆಥಡ್ ನ ಪಕ್ಕದಲ್ಲಿ 'ಇಕ್ವಲ್ ಟು' ಚಿಹ್ನೆ ಇದ್ದರೆ, ಅದು ಅಸೈನ್ ಮಾಡಿರುವುದನ್ನು ನಿರೂಪಿಸುತ್ತದೆ.
10:36 ಈಗ ನಿಮಗೆ ನಿಮ್ಮ ಸ್ವಂತದ 'ಮೆಥಡ್'ಗಳನ್ನು ಬರೆಯಲು ಸಾಧ್ಯವಾಗಬೇಕು.
10:42 In this tutorial, we have learnt-
10:44 * How to declare classes
10:46 * How to create objects of a class
10:48 * Different ways of defining methods in Ruby.
10:52 ಒಂದು ಅಸೈನ್ಮೆಂಟ್:
10:54 'Product' ಎಂಬ ಒಂದು ಕ್ಲಾಸ್ ಅನ್ನು
10:56 “myvar” ನ ವ್ಯಾಲ್ಯೂಗಳನ್ನು ಪಡೆಯಲು ನೀವು ಬಳಸಬಹುದಾದ 'ಮೆಥಡ್'ಗಳನ್ನು ಡಿಫೈನ್ ಮಾಡಿ ಮತ್ತು “myvar” ಗಾಗಿ ವ್ಯಾಲ್ಯೂಗಳನ್ನು ಸೆಟ್ ಮಾಡಿ.
11:01 ವ್ಯಾಲ್ಯೂಗಳನ್ನು ಸೆಟ್ ಮಾಡಲು, “=” ಚಿಹ್ನೆಯನ್ನು ಬಳಸಿ ಮೆಥಡ್ ಅನ್ನು ಡಿಫೈನ್ ಮಾಡಿ.
11:05 ಕ್ಲಾಸ್ ನ ಆಬ್ಜೆಕ್ಟ್ ಅನ್ನು ಇನ್ಸ್ಟಾನ್ಶಿಯೇಟ್ ಮಾಡಿ Instantiate the object of the class and set and get values using the above 2 methods.
11:12 Watch the video available at the following link.
11:14 It summarizes the Spoken Tutorial project.
11:18 If you do not have good bandwidth, you can download and watch it.
11:22 The Spoken Tutorial project team:
11:24 * Conducts workshops using spoken tutorials.
11:27 * Gives certificates to those who pass an online test.
11:30 For more details, please write to:

contact@spoken-tutorial.org

11:36 Spoken Tutorial project is a part of the Talk to a Teacher project.
11:39 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
11:46 More information on this mission is available at spoken hyphen tutorial dot org slash NMEICT hyphen Intro.
11:56 This is Anjana Nair, signing off. Thank you.

Contributors and Content Editors

NaveenBhat, Sandhya.np14