@@ -25,8 +25,8 @@ Visit https://rvm.io for more details.
2525``` sh
2626$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2727$ \c url -sSL https://get.rvm.io | bash -s stable
28- $ rvm install 2.3.0
29- $ rvm use 2.3.0
28+ $ rvm install 2.7.2
29+ $ rvm use 2.7.2
3030$ rvm gemset create project_name
3131$ rvm gemset use project_name
3232```
@@ -39,18 +39,18 @@ $ rvm gemset use project_name
3939- ` .versions.conf ` - key=value configuration file
4040- ` .ruby-version ` - single line ruby-version only
4141- ` .ruby-gemset ` - single line ruby-gemset only
42- - ` Gemfile ` - comment: #ruby=2.3.0 and directive: ruby '2.3.0 '
42+ - ` Gemfile ` - comment: #ruby=2.7.2 and directive: ruby '2.7.2 '
4343
4444--
4545
4646.rvmrc <!-- .element: class="filename" -->
4747``` sh
48- rvm use 2.0.0 @project_name --create
48+ rvm use 2.6.6 @project_name --create
4949```
5050
5151.ruby-version <!-- .element: class="filename" -->
5252``` sh
53- 2.0.0-p247
53+ 2.6.6
5454```
5555
5656.ruby-gemset <!-- .element: class="filename" -->
@@ -143,10 +143,7 @@ Object.methods
143143
144144``` ruby
145145100 .class
146- # => Fixnum
147-
148- 10000000000000000000 .class
149- # => Bignum
146+ # => Integer
150147
151148100.0 .class
152149# => Float
@@ -199,19 +196,19 @@ Assume variable `a` holds `10` and variable `b` holds `20` then:
199196
200197| Operator | Description | Example |
201198| ----------| ------------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------|
202- | = | Simple assignment operator, Assigns values from right side operands to left side operand | c = a + b will assigne value of a + b into c |
199+ | = | Simple assignment operator, Assigns values from right side operands to left side operand | c = a + b will assign value of a + b into c |
203200| += | Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand | c += a is equivalent to c = c + a |
204201| -= | Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand | c -= a is equivalent to c = c - a |
205202| \* = | Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand | c \* = a is equivalent to c = c \* a |
206203| /= | Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand | c /= a is equivalent to c = c / a |
207204| %= | Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand | c %= a is equivalent to c = c % a |
208205| \*\* = | Exponent AND assignment operator, Performs exponential (power) calculation on operators and assign value to the left operand | c \*\* = a is equivalent to c = c \*\* a |
209206
210- ### Safe navigation Operator (only 2.3.0)
207+ ### Safe navigation Operator
211208
212209| Operator | Description | Example |
213210| ----------| ------------------------------------------------------------------------------------------------------------| ---------|
214- | &. | Makes it safer to chain multiple methods together. Execution stopes if method doesn’t exist or returns nil | a&.b&.c |
211+ | &. | Makes it safer to chain multiple methods together. Execution stops if method doesn’t exist or returns nil | a&.b&.c |
215212
216213---
217214
@@ -293,7 +290,7 @@ str.slice(13)
293290str[13 , 10 ]
294291# => "I love it!"
295292
296- str.slice(13 , 12 )
293+ str.slice(13 , 10 )
297294# => "I love it!"
298295
299296str[13 ..- 17 ]
@@ -310,7 +307,7 @@ str[/[abc](.)\1/]
310307
311308## Useful methods
312309
313- Follow by http ://ruby-doc.org/core-2.3.0 /String.html for more information
310+ Follow by https ://ruby-doc.org/core-2.7.2 /String.html for more information
314311
315312``` ruby
316313' pROgraMMing' .capitalize
@@ -320,7 +317,7 @@ Follow by http://ruby-doc.org/core-2.3.0/String.html for more information
320317# => "programming"
321318
322319' Programming' .chars
323- # => #<Enumerator: "Programming":chars>
320+ # => ["P", "r", "o", "g", "r", "a", "m", "m", "i", "n", "g"]
324321
325322' Programming' .index(' gra' )
326323# => 3
@@ -333,7 +330,7 @@ Follow by http://ruby-doc.org/core-2.3.0/String.html for more information
333330
334331## Useful methods
335332
336- Follow by http ://ruby-doc.org/core-2.3.0 /String.html for more information
333+ Follow by https ://ruby-doc.org/core-2.7.2 /String.html for more information
337334
338335``` ruby
339336' Programming' .match(/(.) \1 / )
@@ -365,7 +362,7 @@ Follow by http://ruby-doc.org/core-2.3.0/String.html for more information
365362> Array indexing starts at 0, as in C or Java.
366363> A negative index is assumed to be relative to the end of the array — that is, an index of -1 indicates the last element of the array
367364
368- Follow by http ://ruby-doc.org/core-2.3.0 /Array.html for more information
365+ Follow by https ://ruby-doc.org/core-2.7.2 /Array.html for more information
369366
370367--
371368
@@ -429,7 +426,7 @@ languages
429426
430427--
431428
432- ## Extracts the nested value (only from 2.3.0)
429+ ## Extracts the nested value
433430
434431``` ruby
435432a = [[1 , [2 , 3 ]]]
@@ -441,7 +438,7 @@ a.dig(1, 2, 3)
441438# => nil
442439
443440a.dig(0 , 0 , 0 )
444- # => NoMethodError, undefined method 'dig' for 1:Fixnum
441+ # => TypeError: Integer does not have #dig method
445442
446443[42 , {foo: :bar }].dig(1 , :foo )
447444# => :bar
@@ -595,8 +592,14 @@ Difference
595592os - linux_os
596593# => ["MacOS", "Windows"]
597594
595+ os.difference(linux_os)
596+ # => ["MacOS", "Windows"]
597+
598598linux_os - os
599599# => ["Ubuntu"]
600+
601+ linux_os.difference(os)
602+ # => ["Ubuntu"]
600603```
601604
602605--
@@ -664,7 +667,7 @@ methods, names of classes. A Symbol object is created by prefixing an operator,
664667class, module name with a colon. Symbols are immutable. The symbol object will be unique for each different name but
665668does not refer to a particular instance of the name, for the duration of a program's execution.
666669
667- Follow by http ://www. ruby-doc.org/core-2.3.0 /Symbol.html for more information.
670+ Follow by https ://ruby-doc.org/core-2.7.2 /Symbol.html for more information.
668671
669672--
670673
@@ -701,7 +704,7 @@ language = 'Ruby'
701704> A Hash is a collection of key-value pairs. It is similar to an Array (sometimes it is called an associative array),
702705 except that indexing is done via arbitrary keys of any object type, not an integer index.
703706
704- Follow by http ://www. ruby-doc.org/core-2.3.0 /Hash.html for more information.
707+ Follow by https ://ruby-doc.org/core-2.7.2 /Hash.html for more information.
705708
706709--
707710
@@ -899,7 +902,7 @@ h = { d: 100, a: 200, v: 300, e: 400 }
899902h.length
900903# => 4
901904
902- h.delete(' a ' )
905+ h.delete(:a )
903906# => 200
904907
905908h.length
@@ -929,7 +932,7 @@ h.select { |key, value| value > 100}
929932# => {"b"=>200, "c" =>300}
930933```
931934
932- dig (2.3.0 only)
935+ dig
933936
934937``` ruby
935938h = { a: { b: { c: 1 } } }
@@ -955,7 +958,7 @@ h.dig(:a, 1)
955958
956959> A Range represents an interval — a set of values with a beginning and an end.
957960
958- Follow by http ://www. ruby-doc.org/core-2.3.0 /Range.html for more information.
961+ Follow by https ://ruby-doc.org/core-2.7.2 /Range.html for more information.
959962
960963--
961964
@@ -988,21 +991,21 @@ Creates a range from `a` to `e`
988991
989992> Time is an abstraction of dates and times.
990993
991- Follow by http ://www. ruby-doc.org/core-2.3.0 /Time.html for more information.
994+ Follow by https ://ruby-doc.org/core-2.7.2 /Time.html for more information.
992995
993996--
994997
995998## Time
996999
9971000``` ruby
998- Time .new (2016 )
999- # => 2016 -01-01 00:00:00 +0200
1001+ Time .new (2020 )
1002+ # => 2020 -01-01 00:00:00 +0200
10001003
1001- Time .new (2016 , 10 )
1002- # => 2016 -10-01 00:00:00 +0300
1004+ Time .new (2020 , 10 )
1005+ # => 2020 -10-01 00:00:00 +0300
10031006
1004- Time .new (2016 , 10 , 30 , 2 , 2 , 2 , ' +03:00' )
1005- # => 2016 -10-30 02:02:02 +0300
1007+ Time .new (2020 , 10 , 30 , 2 , 2 , 2 , ' +03:00' )
1008+ # => 2020 -10-30 02:02:02 +0300
10061009
10071010Time .at(628232400 )
10081011# => 1989-11-28 08:00:00 +0300
@@ -1014,22 +1017,22 @@ Time.at(628232400)
10141017
10151018``` ruby
10161019t = Time .new
1017- # => 2013-05-09 18:50:25 +0300
1020+ # => 2020-11-11 21:51:24.741163566 +0200
10181021
10191022t.year
1020- # => 2013
1023+ # => 2020
10211024
10221025t.month
1023- # => 5
1026+ # => 11
10241027
10251028t.day
1026- # => 9
1029+ # => 11
10271030
10281031t.wday
1029- # => 4
1032+ # => 3
10301033
10311034t.yday
1032- # => 129
1035+ # => 316
10331036```
10341037
10351038--
@@ -1038,22 +1041,22 @@ t.yday
10381041
10391042``` ruby
10401043t = Time .new
1041- # => 2013-05-09 18:50:25 +0300
1044+ # => 2020-11-11 21:51:24.741163566 +0200
10421045
10431046t.hour
1044- # => 18
1047+ # => 21
10451048
10461049t.min
1047- # => 50
1050+ # => 52
10481051
10491052t.sec
1050- # => 25
1053+ # => 42
10511054
10521055t.zone
1053- # => "EEST "
1056+ # => "EET "
10541057
10551058t.strftime(' %Y-%m-%d %H:%M:%S' )
1056- # => "2013-05-09 18:50:25 "
1059+ # => "2020-11-11 21:52:42 "
10571060```
10581061
10591062---
@@ -1062,7 +1065,7 @@ t.strftime('%Y-%m-%d %H:%M:%S')
10621065
10631066> A ` File ` is an abstraction of any file object accessible by the program and is closely associated with class ` IO ` .
10641067
1065- Follow by http ://www. ruby-doc.org/core-2.3.0 /File.html for more information.
1068+ Follow by https ://ruby-doc.org/core-2.7.2 /File.html for more information.
10661069
10671070--
10681071
@@ -1201,7 +1204,7 @@ File.expand_path(__FILE__)
12011204> Objects of class Dir are directory streams representing directories in the underlying file system.
12021205 They provide a variety of ways to list directories and their contents.
12031206
1204- Follow by http ://ruby-doc.org/core-2.3.0 /Dir.html for more information.
1207+ Follow by https ://ruby-doc.org/core-2.7.2 /Dir.html for more information.
12051208
12061209--
12071210
@@ -1443,6 +1446,9 @@ false && 99
14431446
14441447' cat' && 99
14451448# => 99
1449+
1450+ 99 && ' cat'
1451+ # => "cat"
14461452```
14471453
14481454--
@@ -1458,6 +1464,9 @@ false || 99
14581464
14591465' cat' || 99
14601466# => "cat"
1467+
1468+ 99 || ' cat'
1469+ # => 99
14611470```
14621471
14631472--
0 commit comments