Skip to content

Commit abc4109

Browse files
committed
fix &. description
1 parent 09a7a95 commit abc4109

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

refactorings/conditionals_when_object_is_nil.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ event.end_date.nil? ? '' : event.end_date.to_s(:long)
1111
```ruby
1212
event.end_date.try(:to_s, :long)
1313
```
14-
**Or:**
14+
15+
**Or (2.3+):**
1516

1617
```ruby
1718
event.end_date&.to_s&.long
1819
```
20+
[About &. operator](http://mitrev.net/ruby/2015/11/13/the-operator-in-ruby/)
1921

2022
**Remembering:** [try](http://apidock.com/rails/Object/try) is a Rails method and it's not in Ruby Core.
2123

tricks/source_code/splat_operator.rb

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
arguments = [1, 2, 3, 4]
66
my_method(*arguments) # any number of arguments
77

8+
9+
810
# or:
911

1012
arguments = [2, 3, 4]
@@ -15,6 +17,7 @@
1517
arguments = [1, 2]
1618
my_method(*arguments, 3, 4) # any number of preceding arguments
1719

20+
1821
# or:
1922

2023
arguments = [2, 3]

0 commit comments

Comments
 (0)