Feature #11537
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
I sometimes somtimes write following code with rails application:
```ruby ```rb
u = User.find(id)
if u && u.profile && u.profile.thumbnails && u.profiles.thumbnails.large
...
```
or
```ruby ```rb
# Use ActiveSupport
if u.try!(:profile).try!(:thumbnails).try!(:large)
...
```
I hope to write shortly above code. Groovy has above operator named "Safe navigation operator" with "`?.`" "?." syntax.
Ruby can't use "`?.`" "?." operator.
Can we use "`.?`" ".?" syntax. like this:
```ruby ```rb
u = User.find(id)
u.?profile.?thumbnails.?large
```
Matz. How do you think about this?
```ruby ```rb
u = User.find(id)
if u && u.profile && u.profile.thumbnails && u.profiles.thumbnails.large
...
```
or
```ruby ```rb
# Use ActiveSupport
if u.try!(:profile).try!(:thumbnails).try!(:large)
...
```
I hope to write shortly above code. Groovy has above operator named "Safe navigation operator" with "`?.`" "?." syntax.
Ruby can't use "`?.`" "?." operator.
Can we use "`.?`" ".?" syntax. like this:
```ruby ```rb
u = User.find(id)
u.?profile.?thumbnails.?large
```
Matz. How do you think about this?