Difference between revisions of "Ruby/C3/Object-Oriented-Programming-Methods/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| Border = 1 | | '''Time''' | | '''Narration''' |- | | 00:01 | | Welcome to this '''spoken tutorial''' on '''Object Oriented Programming – Methods''' in '''Ruby'''. |-...")
 
 
(12 intermediate revisions by one other user not shown)
Line 6: Line 6:
 
|-
 
|-
 
| | 00:01
 
| | 00:01
| | Welcome to this '''spoken tutorial''' on '''Object Oriented Programming – Methods''' in '''Ruby'''.
+
| | '''Ruby''' માં  '''Object Oriented Programming – Methods''' પરનાં સ્પોકન ટ્યુટોરીયલમાં તમારુ સ્વાગત છે.  
  
 
|-  
 
|-  
 
| |  00:07
 
| |  00:07
| | In this tutorial, we will learn to use:
+
| | આ ટ્યુટોરીયલમાં આપણે  શીખીશું :
  
 
|-
 
|-
 
| | 00:09
 
| | 00:09
| |* '''instance methods'''
+
| | '''instance methods'''
  
 
|-
 
|-
 
| | 00:11
 
| | 00:11
| |* '''class methods'''
+
| | '''class methods'''
  
 
|-
 
|-
 
| | 00:14
 
| | 00:14
| |* '''accessor methods'''.
+
| | '''accessor methods'''.
  
 
|-
 
|-
 
| | 00:15
 
| | 00:15
| | Here, we are using:
+
| | અહી આપણે વાપરી રહ્યા છીએ:
* '''Ubuntu '''version '''12.04'''
+
'''Ubuntu '''version '''12.04'''
  
 
|-
 
|-
 
| | 00:19
 
| | 00:19
| |* '''Ruby 1.9.3'''
+
| | '''Ruby 1.9.3'''
  
 
|-
 
|-
 
| | 00:22
 
| | 00:22
| | To follow this tutorial, you must have a working '''Internet '''connection.
+
| | આ ટ્યુટોરીયલ ના અનુસરણ માટે તમારી પાસે કાર્ય કરતું  '''Internet ''' કનેક્શન હોવું જોઈએ.
  
 
|-
 
|-
 
| | 00:27
 
| | 00:27
| |You must also have knowledge of '''Linux command'''s, '''Terminal '''and '''Text-editor.'''
+
| | તમને  '''Linux commands,''' '''Terminal '''અને  '''Text-editor.''' નું જ્ઞાન હોવું જોઈએ.
  
 
|-
 
|-
 
| | 00:31
 
| | 00:31
| |If not, for relevant tutorials, please visit our website.
+
| | જો નથી, તો સંબંધિત ટ્યુટોરીયલો માટે, અમારી વેબસાઇટની મુલાકાત લો.  
  
 
|-
 
|-
 
| | 00:36
 
| | 00:36
| | Before we begin, recall that we had created “'''ttt'''” directory earlier.
+
| | શરૂઆત કરવા પહેલા, યાદ કરો કે આપણે “ttt” નામની એક ડીરેક્ટરી પહેલા બનાવી હતી.  
  
 
|-
 
|-
 
| | 00:41
 
| | 00:41
| | Let's go to that directory.
+
| |   ચાલો તે ડિરેક્ટરી પર જઈએ.
  
 
|-
 
|-
 
| | 00:44
 
| | 00:44
| | Then to '''ruby-tutorial.'''
+
| | પછી  '''ruby-tutorial.''' પર.
  
 
|-
 
|-
 
| | 00:47
 
| | 00:47
| |Create a directory named '''oop-methods''' and cd into it.
+
| | '''oop-methods''' નામની ડિરેક્ટરી બનાવો અને તેને  cd કરો.
  
 
|-
 
|-
 
| | 00:54
 
| | 00:54
| | What are '''Instance methods'''?
+
| | '''Instance methods''' શું છે ?
  
 
|-
 
|-
 
| | 00:56
 
| | 00:56
| |'''Instance methods '''are those '''methods '''that are available to all '''instances '''of the '''class.'''
+
| | '''Instance methods ''' એ મેથડ છે જે તે  ક્લાસના બધા '''instances ''' ના માટે ઉપલભ્ધ હોય છે.
  
 
|-
 
|-
 
| | 01:03
 
| | 01:03
| |Earlier we had studied how to create '''objects '''or '''instances ''' of a''' class'''.
+
| | આગળ આપણે શીખ્યું હતું કે એક ક્લાસ ના '''objects ''' અથવા  '''instances ''' કેવી રીતે બનાવાય,
  
 
|-
 
|-
 
| | 01:09
 
| | 01:09
| | Create a new file in '''gedit '''as shown in the basic level '''Ruby tutorials'''.
+
| | '''Ruby tutorials''' ના બેસિક લેવલ માં બતાવ્યા પ્રમાણે '''gedit ''' માં એક નવી ફાઈલ બનાવો.
  
 
|-
 
|-
 
| | 01:14
 
| | 01:14
| |Name it '''instance_methods.rb'''.
+
| | '''instance_methods.rb''' નામ આપો.
  
 
|-
 
|-
 
| | 01:19
 
| | 01:19
| | I have a working example of implementing '''instance methods'''.
+
| |  મારી પાસે  '''instance methods''' ને અમલીકરણનું એક કાર્યકારી ઉદાહરણ છે.  
  
 
|-
 
|-
 
| | 01:24
 
| | 01:24
| |You can pause the tutorial and type the code as we go through it.
+
| | આ ટ્યુટોરીયલ ને સમઝતી વખતે વચ્ચે અટકાવીને કોડ ટાઈપ કરી શકો છો.
  
 
|-
 
|-
 
| | 01:29
 
| | 01:29
| | I have defined a '''class '''named '''Product''' in this example.
+
| |   મેં આ ઉદાહરણ માં '''Product''' નામક એક ક્લાસ વ્યાખ્યાયિત કર્યો છે.
  
 
|-
 
|-
 
| | 01:33
 
| | 01:33
| | I have called an '''initialize''' method to initialize the '''instance variables''', "name" and "price".
+
| | મેં  '''instance variables''', "name" અને  "price" ને ઇનિશિલાઇઝ કરવા માટે  ઇનિશિલાઇઝ મેથડ કોલ કર્યો છે.
  
 
|-
 
|-
 
| | 01:41
 
| | 01:41
| | I have also defined '''instance methods '''named "name" and "price".
+
| | મેં '"name" અને  "price"'  નામક  '''instance methods ''' ને પણ વ્યાખ્યાયિત કર્યો છે.
  
 
|-
 
|-
 
| | 01:47
 
| | 01:47
| |Each of them return '''instance variables''' "name" and "price" respectively.
+
| | તેમાંથી પ્રત્યેક '''instance variables''' ક્રમશ  "name" અને  "price" રીટર્ન કરે છે.
  
 
|-
 
|-
 
| | 01:54
 
| | 01:54
| | '''Instance methods '''are defined just like normal '''methods'''.
+
| | '''Instance methods ''' સામાન્ય મેથડસ ની જેમ જ વ્યાખ્યાયિત થાય છે.
  
 
|-
 
|-
 
| | 01:58
 
| | 01:58
| |Earlier we had studied how to create methods in Ruby.
+
| | પહેલા આપણે શીખ્યું હતું કે '''  Ruby.'''  માં મેથડ કેવી રીતે બનાવે છે.
  
 
|-
 
|-
 
| | 02:02
 
| | 02:02
| |Shortly, we will see how these methods will be available to all '''instances.'''
+
| | ટૂંક સમયમાં, આપણે જોશું કે આ મેથડસ બધા  '''instances.''' ના માટે કેવી રીતે ઉપલબ્ધ છે.
  
 
|-
 
|-
 
| | 02:07
 
| | 02:07
| | Now, let us implement the '''logic''' we have.
+
| | હવે જે લોજીક આપણી પાસે છે તેને ઉપયોગ કરીએ.
  
 
|-
 
|-
 
| | 02:11
 
| | 02:11
| | Here, I have initialized a '''Product''' object and named it as "product_object_1".
+
| | અહી મેં એક  '''Product''' ઓબ્જેક્ટને ઇનિશિલાઇઝ કર્યું છે અને તેને  "product_object_1" નામ આપ્યું છે.  
  
 
|-
 
|-
 
| | 02:18
 
| | 02:18
| |I have initialized it with a '''name''' value and a '''price''' value.
+
| | મેં અને '''name''' value અને  '''price''' ના સાથે ઇનિશિલાઇઝ કર્યું છે.
  
 
|-
 
|-
 
| | 02:24
 
| | 02:24
| | The '''initializer block''' passes the values to the '''instance variables''' "@name" and "@price".
+
| | '''initializer block''' '''instance variables''' "@name" અને  "@price" ને વેલ્યુ પાસ કરે છે.
  
 
|-
 
|-
 
| | 02:31
 
| | 02:31
| | Now, this '''product instance '''or '''object''' can use the instance methods '''name''' and '''price'''.
+
| | હવે આ '''product instance ''' અથવા  '''object''' ઈન્સ્ટનસ મેથડ  '''name''' અને  '''price''' ને ઉપયોગ કરી શકીએ છીએ.
  
 
|-
 
|-
 
| | 02:37
 
| | 02:37
| |On invoking these methods, we get the values stored in the '''instance variables'''.
+
| |   આ મેથડસ ને કોલ કરવા પર આપણે '''instance variables''' માં સંગ્રહિત વેલ્યુ મેળવીશું.
  
 
|-
 
|-
 
| | 02:43
 
| | 02:43
| | Now, let us '''execute''' this code.
+
| | ચાલો હવે કોડ એક્ઝીક્યુટ કરીએ.
 
+
 
|-
 
|-
 
| | 02:46
 
| | 02:46
| |Switch to the '''terminal''' and type: '''ruby instance_methods.rb ''' and press '''Enter '''to see the output.
+
| | ટર્મિનલ પર જાવ અને ટાઈપ કરો  '''ruby instance_methods.rb ''' અને એન્ટર દબાવો.
  
 
|-
 
|-
 
| | 02:56
 
| | 02:56
| | You will see that it will print the values you initialized the '''object''' with.
+
| | તમે જોશો કે તમે જે વેલ્યુ ને ઓબ્જેક્ટ ને ઇનિશિલાઇઝ કર્યું છે તેને પ્રિન્ટ કરો.
  
 
|-
 
|-
 
| | 03:02
 
| | 03:02
| |Namely, "laptop" and "35,000".
+
| | કહેવા માટે "laptop" અને  "35,000"
  
 
|-
 
|-
 
| | 03:07
 
| | 03:07
| | Next, initialize another '''instance''' or '''object'''.
+
| |   આગળ એક અન્ય  '''instance''' અથવા  '''object''' ને ઇનિશિલાઇઝ કરો.
  
 
|-
 
|-
 
| | 03:12
 
| | 03:12
| |Let us name this object '''product_object_2'''.
+
| | હવે આ ઓબ્જેક્ટને  '''product_object_2''' નામ આપીએ છીએ.
  
 
|-
 
|-
 
| | 03:18
 
| | 03:18
| |This time, let us give a different set of values for '''name''' and '''price'''.
+
| | આ વખતે '''name''' અને  '''price''' ને વેલ્યુનો એક અન્ય સેટ આપીએ છીએ.
  
 
|-
 
|-
 
| | 03:23
 
| | 03:23
| | Now, let us call the '''instance methods- "name" and "price" for this '''object.'''
+
| | હવે આ ઓબ્જેક્ટના માટે '''instance methods- "name" અને  "price" કોલ કરીએ.
  
 
|-
 
|-
 
| | 03:35
 
| | 03:35
| | Next, let us switch back to the '''terminal''' and execute the code like before.
+
| | આગળ, ચાલો ટર્મિનલ પર પાછા જાવ અને પહેલાની જેમ જ  કોડ ને એક્ઝીક્યુટ કરો.
  
 
|-
 
|-
 
| | 03:41
 
| | 03:41
| | You will notice that it executes successfully and it prints out the new values.
+
| | તમે ધ્યાન આપશો કે આ સફળતાપૂર્વક એક્ઝીક્યુટ કરે છે અને આ નવી વેલ્યુને પ્રિન્ટ કરે છે.
  
 
|-
 
|-
 
| | 03:48
 
| | 03:48
| |This proves that '''instance methods''' are available to all '''objects''' of the '''class Product'''.
+
| |આ સાબિત કરે છે કે  '''instance methods''' તે '''class Product''' ના બધા ઓબ્જેક્ટસ ના માટે ઉપલબ્ધ છે.
  
 
|-
 
|-
 
| | 03:55
 
| | 03:55
| | You should now be able to write your own '''instance methods.'''
+
| |   હવે તમે પોતાના '''instance methods.''' લખવા માં સક્ષમ હોવા જોઈએ.
  
 
|-
 
|-
 
| | 03:59
 
| | 03:59
| | Next, let us look at what '''class methods '''are.
+
| | આગળ આપણે જોઈ શકીએ છીએ કે ક્લાસ મેથડ  શું હોય છે.
  
 
|-
 
|-
 
| | 04:04
 
| | 04:04
| | '''Class methods''' are '''methods '''available only to the '''class.'''
+
| | ક્લાસ મેથડસ ફક્ત  ક્લાસના લીધે ઉપલબ્ધ મેથડ હોય છે.
  
 
|-
 
|-
 
| | 04:09
 
| | 04:09
| |These '''methods '''are not available to '''instances''' of the '''class.'''
+
| | આ મેથડ ક્લાસના '''instances''' નમાં માટે ઉપલબ્ધ નથી.
  
 
|-
 
|-
 
| | 04:14
 
| | 04:14
| |There are different ways you can define '''class methods'''.
+
| | તમે વિવિધ રીતે  '''class methods''' ને વ્યાખ્યાયિત કરી શકીએ છીએ.
  
 
|-
 
|-
 
| | 04:16
 
| | 04:16
| | Let us look at an example.
+
| | ચાલો ઉદાહરણ ને જોઈએ.
  
 
|-
 
|-
 
| | 04:18
 
| | 04:18
| | Create a new file in '''gedit '''as shown in the basic level '''Ruby tutorials'''.
+
| | બેસિક લેવલ ના '''Ruby tutorials''' માં પ્રદશિત ની જેમ '''gedit ''' માં એક નવી ફાઈલ બનાવો.
  
 
|-
 
|-
 
| | 04:24
 
| | 04:24
| |Name it '''class_methods.rb'''.
+
| | '''class_methods.rb''' નામ આપો.
  
 
|-
 
|-
 
| | 04:28
 
| | 04:28
| | I have a working example of '''class methods'''.
+
| | મારી પાસે '''class methods''' નું એક કાર્યકરી ઉદાહરણ છે.
  
 
|-
 
|-
 
| | 04:32
 
| | 04:32
| |You can pause the tutorial and type the code as we go through it.
+
| | તમે ટ્યુટોરીયલને સમઝતી વખતે વચ્ચે અટકાવીને કોડ ટાઈપ કરી શકો છો.
  
 
|-
 
|-
 
| | 04:36
 
| | 04:36
| | I have defined a '''Product class''' like before.
+
| |   મેં પહેલાની જેમ  '''Product class''' ને વ્યાખ્યાયિત કર્યું છે.
  
 
|-
 
|-
 
| | 04:40
 
| | 04:40
| | I have also called an '''initializer''', like before.
+
| |   મેં પહેલાની જેમ '''initializer''', ને પણ કોલ કર્યું છે.
  
 
|-
 
|-
 
| | 04:44
 
| | 04:44
| |However, this time I have added an extra '''argument''' called '''description'''.
+
| |જયારે કે આ વખતે મેં '''description''' નામક એક વધુ  '''argument''' ઉમેર્યું છે.
  
 
|-
 
|-
 
| | 04:48
 
| | 04:48
| |I am also using '''class variables''' to hold the values, unlike '''instance variables''' earlier.
+
| | મેં પહેલા ની જેમ '''instance variables''' ને વિપરીત વેલ્યુ રાખવા માટે ક્લાસ વેરીએબલસ ઉપયોગ કરી રહી છું.
  
 
|-
 
|-
 
| | 04:55
 
| | 04:55
| | This '''class''' will demonstrate to you the 3 different ways one can define '''class methods.'''
+
| | આ ક્લાસ તમે ત્રણ વિવિધ માર્ગ બતાડશે જેને કોઈ વ્યક્તિ ક્લાસ મેથડસ ને વ્યાખ્યાયિત કરી શકે.
  
 
|-
 
|-
 
| | 05:01
 
| | 05:01
| |Checkout the '''class method '''declaration for '''name'''.
+
| | નેમ ના માટે ડીકલેર  '''class method ''' ને તપાસો.
  
 
|-
 
|-
 
| | 05:06
 
| | 05:06
| |Here, it is defined using the '''class name "Product"'''.
+
| | અહી આ ક્લાસ નેમ "Product"' ઉપયોગ કરીને વ્યાખ્યાયિત થાય છે.
  
 
|-
 
|-
 
| |05:10
 
| |05:10
| | Then, checkout the second '''class methods''' declaration.
+
| | પછી બીજા  '''class methods''' ડીકલેરેશન ને તપાસો.  
  
 
|-
 
|-
 
| | 05:14
 
| | 05:14
| |Here I have used the '''"self" keyword'''.
+
| | અહી મેં  '''"self" keyword'''. નો ઉપયોગ કર્યો છે.
  
 
|-
 
|-
 
| | 05:18
 
| | 05:18
| | Next, checkout the third way you can define '''class methods'''.
+
| | આગળ ત્રીજો માર્ગ તપાસો જેથી તમે '''class methods''' વ્યાખ્યાયિત કરી શકો છો.
  
 
|-
 
|-
 
| | 05:23
 
| | 05:23
| | Now let us implement these '''class methods'''.
+
| | હવે આ  '''class methods''' નું અમીલીક્ર્ણ કરીએ.
  
 
|-
 
|-
 
| | 05:27
 
| | 05:27
| | Let us first initialize an '''object''' of '''Product,''' like before.
+
| |   હવે પ્રથમ પહેલાની જેમ '''Product,''' નું ઓબ્જેક્ટ ઇનિશિલાઇઝ કરીએ.
  
 
|-
 
|-
 
| | 05:32
 
| | 05:32
| |This time we are also giving a value for the '''description'''.
+
| | આ વખતે આપણે '''description''' ના માટે એક વેલ્યુ આપી રહ્યા છીએ.
  
 
|-
 
|-
 
| | 05:37
 
| | 05:37
| | Now, let us invoke the '''class methods''' as shown here.
+
| | હવે અહી પ્રદશિત ની જેમ ક્લાસ મેથડ ને કોલ કરો.
  
 
|-
 
|-
 
| | 05:42
 
| | 05:42
| | Now, let us execute the code and inspect the output.
+
| | હવે કોડ એક્ઝીક્યુટ કરીએ અને આઉટપુટ નું નિરીક્ષણ કરીએ.
  
 
|-
 
|-
 
| | 05:47
 
| | 05:47
| | Switch to the '''terminal''' and execute the code like before.
+
| | ટર્મિનલ પર જાવ અને પહેલાની જેમ કોડ એક્ઝીક્યુટ કરો.
  
 
|-
 
|-
 
| | 05:54
 
| | 05:54
| | You will notice that it will print the values for '''name, price '''and''' description.'''
+
| |   તમે જોશો કે આ  '''name, price '''અને ''' description.''' ની વેલ્યુ પ્રિન્ટ કરશે.
  
 
|-
 
|-
 
| | 05:59
 
| | 05:59
| | Now, you should be able to write your own '''class methods'''.
+
| |   હવે તમે પોતાના  '''class methods''' લખવા માટે સક્ષમ જોવા જોઈએ.
  
 
|-
 
|-
 
| | 06:03
 
| | 06:03
| | Next we shall see what '''accessor methods''' are.
+
| |   આગળ આપણે જોશું કે '''accessor methods''' શું છે.
  
 
|-
 
|-
 
| | 06:07
 
| | 06:07
| | '''Ruby''' uses '''accessor methods''' to access data, defined within '''classes'''.
+
| |   '''Ruby''' '''classes''' માં વ્યાખ્યાયિત ડેટાને એક્સેસ કરવા માટે '''accessor methods''' ઉપયોગ કરે છે.
  
 
|-
 
|-
 
| | 06:13
 
| | 06:13
| |'''Accessor methods''' comprise of '''setter methods''' and '''getter methods'''.
+
| |'''Accessor methods''' એ  '''setter methods''' અને  '''getter methods''' થી બને છે.
  
 
|-
 
|-
 
| | 06:18
 
| | 06:18
| |'''Setter methods''' set the values.
+
| |'''Setter methods''' વેલ્યુ ને સેટ કરે છે.
  
 
|-
 
|-
 
| | 06:22
 
| | 06:22
| |'''Getter methods''' get those values.
+
| |'''Getter methods''' તે વેલ્યુ ને મેળવે છે.
  
 
|-
 
|-
 
| | 06:24
 
| | 06:24
| |'''Ruby''' uses the word '''attr_accessor''' to declare these '''methods'''.
+
| | '''Ruby''' તે મેથડસ ને ડીકલેર કરવા માટે શબ્દ  '''attr_accessor''' ઉપયોગ કરે છે .
  
 
|-
 
|-
 
| | 06:31
 
| | 06:31
| | Let us look at an example of '''accessor methods'''.
+
| |   હવે '''accessor methods''' નું એક ઉદાહરણ જોઈએ.
  
 
|-
 
|-
 
| | 06:35
 
| | 06:35
| | Create a new file in '''gedit '''as shown in the basic level '''Ruby tutorials'''.
+
| | '''Ruby tutorials''' ના બેસિક લેવલ માં બતાવ્યા પ્રમાણે એક નવી'''gedit ''' ફાઈલ બનાવો.
  
 
|-
 
|-
 
| | 06:39
 
| | 06:39
| |Name it '''accessor_methods.rb'''
+
| | '''accessor_methods.rb''' નામ આપો.
  
 
|-
 
|-
 
| | 06:43
 
| | 06:43
| | I have a working example of implementing '''accessor methods'''.
+
| |  મારી  '''accessor methods''' ને અમલીકરણનું એક કાર્યકારી ઉદાહરણ છે.
  
 
|-
 
|-
 
| | 06:47
 
| | 06:47
| |You can pause the tutorial and type the code as we go through it.
+
| | તમે આ ટ્યુટોરીયલ ને સમઝતી વખતે વચ્ચે અટકાવીને કોડ ટાઈપ કરી શકો છો.
  
 
|-
 
|-
 
| | 06:52
 
| | 06:52
| | I have defined a '''class''' named '''Product,''' in this example.
+
| | આ ઉદાહરણમાં મેં '''Product,''' નામક ક્લાસ વ્યખ્યાયીત કર્યું છે.
  
 
|-
 
|-
 
| | 06:56
 
| | 06:56
| |I have declared '''attr_accessor '''for 'name' and 'price'.
+
| મેં 'name' આને  'price' ના  માટે  '''attr_accessor ''' ને ડીકલેર કર્યું છે.
  
 
|-
 
|-
 
| | 07:01
 
| | 07:01
| |That is all that is required to use these types of '''methods'''.
+
| | આ મેથડસને ઉપયોગ કરવા માટે ફક્ત આટલું કરવા ની જરૂરીયાત છે.
  
 
|-
 
|-
 
| | 07:05
 
| | 07:05
| | Now let us put it to action.  
+
| | હવે આને કર્યાનવિત કરીએ.
  
 
|-
 
|-
 
| | 07:07
 
| | 07:07
| |I have initialized a '''Product object'''.
+
| | મેં '''Product object''' ને ઇનિશિલાઇઝ કર્યું છે.
  
 
|-
 
|-
 
| | 07:10
 
| | 07:10
| | Then, I have set the '''name''' and '''price''' of the '''product''' object.
+
| | પછી મેં '''product''' ઓબ્જેક્ટ ના  '''name''' અને  '''price''' ને સેટ કર્યું છે.
 
+
 
|-
 
|-
 
| | 07:14
 
| | 07:14
| |This is possible because the '''attr_declaration,''' by default, creates '''methods''' for setting values.
+
| | આ એટલા માટે શક્ય છે કેમકે ડીફોલ્ટ રૂપે '''attr_declaration,''' વેલ્યુ સેટ કરવા માટે  '''methods''' બનાવે છે.
  
 
|-
 
|-
 
| | 07:22
 
| | 07:22
| | I have then attempted to print the values using the '''getter methods''' for 'name' and 'price'.
+
| | પછી મેં 'name' અને  'price' ના માટે '''getter methods''' પ્રયોગ કરીને વેલ્યુ પ્રિન્ટ કરવાનો પ્રયત્ન કર્યો છે .
  
 
|-
 
|-
 
| | 07:28
 
| | 07:28
| |These '''getter methods''' were also generated by the declaration of '''attr_accessor'''.
+
| | આ  '''getter methods''' પણ ''attr_accessor''' ના ડીકલેરેશન થી નિર્માણ કર્યું હતું.  
 
+
 
|-
 
|-
 
| | 07:35
 
| | 07:35
| | Now let us '''execute''' the code like before.
+
| | ચાલો કોડ ફાઈલને એક્ઝીક્યુટ કરીએ.
  
 
|-
 
|-
 
| | 07:40
 
| | 07:40
| | You will notice that it prints the values that were set.
+
| | તમે જોશો કે વેલ્યુ સેટ કરેલ હતી આ તેને પ્રિન્ટ કરે છે.
  
 
|-
 
|-
 
| | 07:44
 
| | 07:44
| | By now, you should be able to write your own '''accessor methods'''.
+
| | હવે તમે પોતાના  '''accessor methods''' ને લખવા માં સક્ષમ હોવા જોઈએ.
  
 
|-
 
|-
 
| | 07:50
 
| | 07:50
| | One thing to note is that '''accessor methods''' are, by default,''' instance methods.'''
+
| |   એક વસ્તુ જે ધ્યાન માં રાખવાની છે કે ડીફોલ્ટ રૂપે  '''accessor methods''' ,''' instance methods.''' હોય છે.
  
 
|-
 
|-
 
| | 07:55
 
| | 07:55
| |Thus they can be accessed by different '''instances''' of the '''class Product'''.
+
| |આ માટે '''class Product''' ના વિવિધ '''instances''' ને એક્સેસ કરી શકાય છે.
  
 
|-
 
|-
 
| | 08:00
 
| | 08:00
| | In this tutorial, we have learnt about:  '''instance methods''',  '''class methods '''and  '''accessor methods'''.
+
| |આ ટ્યુટોરીયલ માં, આપણે શીખ્યા :  '''instance methods''',  '''class methods '''અને  '''accessor methods'''.
  
 
|-
 
|-
 
| | 08:06
 
| | 08:06
| | As an assignment: define a '''class''' named '''Temperature'''.
+
| | એસાઈનમેંટ તરીકે:   '''Temperature''' નામક એક ક્લાસ વ્યાખ્યાયીત કરો .
  
 
|-
 
|-
 
| | 08:10
 
| | 08:10
| | Write an '''instance method '''using Ruby's '''accessor method''' syntax.
+
| |   ''' Ruby''' નું  એક્સેસ મેથડ સિન્ટેક્સનો ઉપયોગ કરીને એક  '''instance method ''' લખો.
  
 
|-
 
|-
 
| | 08:15
 
| | 08:15
| | This '''method''' should calculate the '''Celsius '''for the given '''Fahrenheit.'''
+
| | આ મેથડ આપેલ  '''Fahrenheit.''' ન માટે  '''Celsius ''' ની ગણતરી કરે છે.
  
 
|-
 
|-
 
| | 08:20
 
| | 08:20
| | Watch the video available at the following link.
+
| | સ્ક્રીન પર દર્શાવેલ લીંક પર ઉપલબ્ધ વિડીયો નિહાળો.
  
 
|-
 
|-
 
| | 08:23
 
| | 08:23
| |It summarizes the Spoken Tutorial project.
+
| |તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટનો સારાંશ આપે છે.  
  
 
|-
 
|-
 
| | 08:26
 
| | 08:26
| |If you do not have good bandwidth, you can download and watch it.
+
| |જો તમારી પાસે સારી બેન્ડવિડ્થ ન હોય તો, તમે વિડીયો ડાઉનલોડ કરીને જોઈ શકો છો.  
  
 
|-
 
|-
 
| |08:30
 
| |08:30
| | The Spoken Tutorial project team:
+
| | સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ :  
  
 
|-
 
|-
 
| | 08:31
 
| | 08:31
| |* Conducts workshops using spoken tutorials.
+
| | Cસ્પોકન ટ્યુટોરીયલોનાં ઉપયોગથી વર્કશોપોનું આયોજન કરે છે.
  
 
|-
 
|-
 
| | 08:34
 
| | 08:34
| |* Gives certificates to those who pass an online test.
+
| | જેઓ ઓનલાઈન પરીક્ષા પાસ કરે છે તેઓને પ્રમાણપત્રો આપે છે.  
  
 
|-
 
|-
 
| | 08:38
 
| | 08:38
| |For more details, please write to:
+
| |વધુ વિગતો માટે contact@spoken-tutorial.org પર લખો.
contact at spoken hyphen tutorial dot org.
+
  
 
|-
 
|-
 
| | 08:44
 
| | 08:44
| | '''Spoken Tutorial''' project is a part of the '''Talk to a Teacher''' project.
+
| | સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટોક ટુ અ ટીચર પ્રોજેક્ટનો એક ભાગ છે.  
  
 
|-
 
|-
 
| | 08:48
 
| | 08:48
| |It is supported by the National Mission on Education through ICT, MHRD, Government of India.
+
| |જેને આઈસીટી, એમએચઆરડી, ભારત સરકાર મારફતે શિક્ષણ પર નેશનલ મિશન દ્વારા આધાર અપાયેલ છે.  
 
+
 
|-
 
|-
 
| | 08:55
 
| | 08:55
| |More information on this mission is available at:
+
| |આ મિશન પરની વધુ માહિતી spoken-tutorial.org/NMEICT-Intro પર ઉપલબ્ધ છે.  
spoken hyphen tutorial dot org slash NMEICT hyphen Intro.
+
 
+
 
|-
 
|-
 
| | 09:03
 
| | 09:03
| | This is Anjana Nair, signing off. Thank you.
+
| | આઈઆઈટી બોમ્બે તરફથી હું, જ્યોતી સોલંકી વિદાય લઉં છું.જોડાવા બદલ અભાર.  
  
 
|}
 
|}

Latest revision as of 16:56, 31 March 2017

Time Narration
00:01 Ruby માં Object Oriented Programming – Methods પરનાં સ્પોકન ટ્યુટોરીયલમાં તમારુ સ્વાગત છે.
00:07 આ ટ્યુટોરીયલમાં આપણે શીખીશું :
00:09 instance methods
00:11 class methods
00:14 accessor methods.
00:15 અહી આપણે વાપરી રહ્યા છીએ:

Ubuntu version 12.04

00:19 Ruby 1.9.3
00:22 આ ટ્યુટોરીયલ ના અનુસરણ માટે તમારી પાસે કાર્ય કરતું Internet કનેક્શન હોવું જોઈએ.
00:27 તમને Linux commands, Terminal અને Text-editor. નું જ્ઞાન હોવું જોઈએ.
00:31 જો નથી, તો સંબંધિત ટ્યુટોરીયલો માટે, અમારી વેબસાઇટની મુલાકાત લો.
00:36 શરૂઆત કરવા પહેલા, યાદ કરો કે આપણે “ttt” નામની એક ડીરેક્ટરી પહેલા બનાવી હતી.
00:41 ચાલો તે ડિરેક્ટરી પર જઈએ.
00:44 પછી ruby-tutorial. પર.
00:47 oop-methods નામની ડિરેક્ટરી બનાવો અને તેને cd કરો.
00:54 Instance methods શું છે ?
00:56 Instance methods એ મેથડ છે જે તે ક્લાસના બધા instances ના માટે ઉપલભ્ધ હોય છે.
01:03 આગળ આપણે શીખ્યું હતું કે એક ક્લાસ ના objects અથવા instances કેવી રીતે બનાવાય,
01:09 Ruby tutorials ના બેસિક લેવલ માં બતાવ્યા પ્રમાણે gedit માં એક નવી ફાઈલ બનાવો.
01:14 instance_methods.rb નામ આપો.
01:19 મારી પાસે instance methods ને અમલીકરણનું એક કાર્યકારી ઉદાહરણ છે.
01:24 આ ટ્યુટોરીયલ ને સમઝતી વખતે વચ્ચે અટકાવીને કોડ ટાઈપ કરી શકો છો.
01:29 મેં આ ઉદાહરણ માં Product નામક એક ક્લાસ વ્યાખ્યાયિત કર્યો છે.
01:33 મેં instance variables, "name" અને "price" ને ઇનિશિલાઇઝ કરવા માટે ઇનિશિલાઇઝ મેથડ કોલ કર્યો છે.
01:41 મેં '"name" અને "price"' નામક instance methods ને પણ વ્યાખ્યાયિત કર્યો છે.
01:47 તેમાંથી પ્રત્યેક instance variables ક્રમશ "name" અને "price" રીટર્ન કરે છે.
01:54 Instance methods સામાન્ય મેથડસ ની જેમ જ વ્યાખ્યાયિત થાય છે.
01:58 પહેલા આપણે શીખ્યું હતું કે Ruby. માં મેથડ કેવી રીતે બનાવે છે.
02:02 ટૂંક સમયમાં, આપણે જોશું કે આ મેથડસ બધા instances. ના માટે કેવી રીતે ઉપલબ્ધ છે.
02:07 હવે જે લોજીક આપણી પાસે છે તેને ઉપયોગ કરીએ.
02:11 અહી મેં એક Product ઓબ્જેક્ટને ઇનિશિલાઇઝ કર્યું છે અને તેને "product_object_1" નામ આપ્યું છે.
02:18 મેં અને name value અને price ના સાથે ઇનિશિલાઇઝ કર્યું છે.
02:24 initializer blockinstance variables "@name" અને "@price" ને વેલ્યુ પાસ કરે છે.
02:31 હવે આ product instance અથવા object ઈન્સ્ટનસ મેથડ name અને price ને ઉપયોગ કરી શકીએ છીએ.
02:37 આ મેથડસ ને કોલ કરવા પર આપણે instance variables માં સંગ્રહિત વેલ્યુ મેળવીશું.
02:43 ચાલો હવે કોડ એક્ઝીક્યુટ કરીએ.
02:46 ટર્મિનલ પર જાવ અને ટાઈપ કરો ruby instance_methods.rb અને એન્ટર દબાવો.
02:56 તમે જોશો કે તમે જે વેલ્યુ ને ઓબ્જેક્ટ ને ઇનિશિલાઇઝ કર્યું છે તેને પ્રિન્ટ કરો.
03:02 કહેવા માટે "laptop" અને "35,000"
03:07 આગળ એક અન્ય instance અથવા object ને ઇનિશિલાઇઝ કરો.
03:12 હવે આ ઓબ્જેક્ટને product_object_2 નામ આપીએ છીએ.
03:18 આ વખતે name અને price ને વેલ્યુનો એક અન્ય સેટ આપીએ છીએ.
03:23 હવે આ ઓબ્જેક્ટના માટે instance methods- "name" અને "price" કોલ કરીએ.
03:35 આગળ, ચાલો ટર્મિનલ પર પાછા જાવ અને પહેલાની જેમ જ કોડ ને એક્ઝીક્યુટ કરો.
03:41 તમે ધ્યાન આપશો કે આ સફળતાપૂર્વક એક્ઝીક્યુટ કરે છે અને આ નવી વેલ્યુને પ્રિન્ટ કરે છે.
03:48 આ સાબિત કરે છે કે instance methods તે class Product ના બધા ઓબ્જેક્ટસ ના માટે ઉપલબ્ધ છે.
03:55 હવે તમે પોતાના instance methods. લખવા માં સક્ષમ હોવા જોઈએ.
03:59 આગળ આપણે જોઈ શકીએ છીએ કે ક્લાસ મેથડ શું હોય છે.
04:04 ક્લાસ મેથડસ ફક્ત ક્લાસના લીધે ઉપલબ્ધ મેથડ હોય છે.
04:09 આ મેથડ ક્લાસના instances નમાં માટે ઉપલબ્ધ નથી.
04:14 તમે વિવિધ રીતે class methods ને વ્યાખ્યાયિત કરી શકીએ છીએ.
04:16 ચાલો ઉદાહરણ ને જોઈએ.
04:18 બેસિક લેવલ ના Ruby tutorials માં પ્રદશિત ની જેમ gedit માં એક નવી ફાઈલ બનાવો.
04:24 class_methods.rb નામ આપો.
04:28 મારી પાસે class methods નું એક કાર્યકરી ઉદાહરણ છે.
04:32 તમે ટ્યુટોરીયલને સમઝતી વખતે વચ્ચે અટકાવીને કોડ ટાઈપ કરી શકો છો.
04:36 મેં પહેલાની જેમ Product class ને વ્યાખ્યાયિત કર્યું છે.
04:40 મેં પહેલાની જેમ initializer, ને પણ કોલ કર્યું છે.
04:44 જયારે કે આ વખતે મેં description નામક એક વધુ argument ઉમેર્યું છે.
04:48 મેં પહેલા ની જેમ instance variables ને વિપરીત વેલ્યુ રાખવા માટે ક્લાસ વેરીએબલસ ઉપયોગ કરી રહી છું.
04:55 આ ક્લાસ તમે ત્રણ વિવિધ માર્ગ બતાડશે જેને કોઈ વ્યક્તિ ક્લાસ મેથડસ ને વ્યાખ્યાયિત કરી શકે.
05:01 નેમ ના માટે ડીકલેર class method ને તપાસો.
05:06 અહી આ ક્લાસ નેમ "Product"' ઉપયોગ કરીને વ્યાખ્યાયિત થાય છે.
05:10 પછી બીજા class methods ડીકલેરેશન ને તપાસો.
05:14 અહી મેં "self" keyword. નો ઉપયોગ કર્યો છે.
05:18 આગળ ત્રીજો માર્ગ તપાસો જેથી તમે class methods વ્યાખ્યાયિત કરી શકો છો.
05:23 હવે આ class methods નું અમીલીક્ર્ણ કરીએ.
05:27 હવે પ્રથમ પહેલાની જેમ Product, નું ઓબ્જેક્ટ ઇનિશિલાઇઝ કરીએ.
05:32 આ વખતે આપણે description ના માટે એક વેલ્યુ આપી રહ્યા છીએ.
05:37 હવે અહી પ્રદશિત ની જેમ ક્લાસ મેથડ ને કોલ કરો.
05:42 હવે કોડ એક્ઝીક્યુટ કરીએ અને આઉટપુટ નું નિરીક્ષણ કરીએ.
05:47 ટર્મિનલ પર જાવ અને પહેલાની જેમ કોડ એક્ઝીક્યુટ કરો.
05:54 તમે જોશો કે આ name, price અને description. ની વેલ્યુ પ્રિન્ટ કરશે.
05:59 હવે તમે પોતાના class methods લખવા માટે સક્ષમ જોવા જોઈએ.
06:03 આગળ આપણે જોશું કે accessor methods શું છે.
06:07 Rubyclasses માં વ્યાખ્યાયિત ડેટાને એક્સેસ કરવા માટે accessor methods ઉપયોગ કરે છે.
06:13 Accessor methodssetter methods અને getter methods થી બને છે.
06:18 Setter methods વેલ્યુ ને સેટ કરે છે.
06:22 Getter methods તે વેલ્યુ ને મેળવે છે.
06:24 Ruby તે મેથડસ ને ડીકલેર કરવા માટે શબ્દ attr_accessor ઉપયોગ કરે છે .
06:31 હવે accessor methods નું એક ઉદાહરણ જોઈએ.
06:35 Ruby tutorials ના બેસિક લેવલ માં બતાવ્યા પ્રમાણે એક નવીgedit ફાઈલ બનાવો.
06:39 accessor_methods.rb નામ આપો.
06:43 મારી accessor methods ને અમલીકરણનું એક કાર્યકારી ઉદાહરણ છે.
06:47 તમે આ ટ્યુટોરીયલ ને સમઝતી વખતે વચ્ચે અટકાવીને કોડ ટાઈપ કરી શકો છો.
06:52 આ ઉદાહરણમાં મેં Product, નામક ક્લાસ વ્યખ્યાયીત કર્યું છે.
06:56 મેં 'name' આને 'price' ના માટે attr_accessor ને ડીકલેર કર્યું છે.
07:01 આ મેથડસને ઉપયોગ કરવા માટે ફક્ત આટલું કરવા ની જરૂરીયાત છે.
07:05 હવે આને કર્યાનવિત કરીએ.
07:07 મેં Product object ને ઇનિશિલાઇઝ કર્યું છે.
07:10 પછી મેં product ઓબ્જેક્ટ ના name અને price ને સેટ કર્યું છે.
07:14 આ એટલા માટે શક્ય છે કેમકે ડીફોલ્ટ રૂપે attr_declaration, વેલ્યુ સેટ કરવા માટે methods બનાવે છે.
07:22 પછી મેં 'name' અને 'price' ના માટે getter methods પ્રયોગ કરીને વેલ્યુ પ્રિન્ટ કરવાનો પ્રયત્ન કર્યો છે .
07:28 getter methods' પણ attr_accessor ના ડીકલેરેશન થી નિર્માણ કર્યું હતું.
07:35 ચાલો કોડ ફાઈલને એક્ઝીક્યુટ કરીએ.
07:40 તમે જોશો કે વેલ્યુ સેટ કરેલ હતી આ તેને પ્રિન્ટ કરે છે.
07:44 હવે તમે પોતાના accessor methods ને લખવા માં સક્ષમ હોવા જોઈએ.
07:50 એક વસ્તુ જે ધ્યાન માં રાખવાની છે કે ડીફોલ્ટ રૂપે accessor methods એ , instance methods. હોય છે.
07:55 આ માટે class Product ના વિવિધ instances ને એક્સેસ કરી શકાય છે.
08:00 આ ટ્યુટોરીયલ માં, આપણે શીખ્યા : instance methods, class methods અને accessor methods.
08:06 એસાઈનમેંટ તરીકે: Temperature નામક એક ક્લાસ વ્યાખ્યાયીત કરો .
08:10 Ruby નું એક્સેસ મેથડ સિન્ટેક્સનો ઉપયોગ કરીને એક instance method લખો.
08:15 આ મેથડ આપેલ Fahrenheit. ન માટે Celsius ની ગણતરી કરે છે.
08:20 સ્ક્રીન પર દર્શાવેલ લીંક પર ઉપલબ્ધ વિડીયો નિહાળો.
08:23 તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટનો સારાંશ આપે છે.
08:26 જો તમારી પાસે સારી બેન્ડવિડ્થ ન હોય તો, તમે વિડીયો ડાઉનલોડ કરીને જોઈ શકો છો.
08:30 સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ :
08:31 Cસ્પોકન ટ્યુટોરીયલોનાં ઉપયોગથી વર્કશોપોનું આયોજન કરે છે.
08:34 જેઓ ઓનલાઈન પરીક્ષા પાસ કરે છે તેઓને પ્રમાણપત્રો આપે છે.
08:38 વધુ વિગતો માટે contact@spoken-tutorial.org પર લખો.
08:44 સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટોક ટુ અ ટીચર પ્રોજેક્ટનો એક ભાગ છે.
08:48 જેને આઈસીટી, એમએચઆરડી, ભારત સરકાર મારફતે શિક્ષણ પર નેશનલ મિશન દ્વારા આધાર અપાયેલ છે.
08:55 આ મિશન પરની વધુ માહિતી spoken-tutorial.org/NMEICT-Intro પર ઉપલબ્ધ છે.
09:03 આઈઆઈટી બોમ્બે તરફથી હું, જ્યોતી સોલંકી વિદાય લઉં છું.જોડાવા બદલ અભાર.

Contributors and Content Editors

Jyotisolanki, Pratik kamble