⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (504 Bytes)
Feature #1122
ยป try.txt
rogerdpack (Roger Pack)
, 07/14/2012 03:04 PM
Feature #1122 [request for Object#try (guarded method invocation)]
Today:
>> if entry.at('description') && entry.at('description').inner_text
or:
>> if (description = entry.at('description') && description.inner_text
Proposal: Object#&& method:
if entry.at('description').&&.inner_text
or alternate Proposal Object#andand or Object#present? or some other name:
if entry.at('description').present?.inner_text
Pros: easier to read, no variable allocation. Unknown cons.
(1-1/1)
Loading...