Remove "try", because it is a rails feature

Also "&." is only available on ruby >= 2.3 (can be used later)
This commit is contained in:
Benjamin Neff 2017-01-26 02:21:51 +01:00
parent 4ff91a56cc
commit 1f3293a403
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
3 changed files with 5 additions and 2 deletions

View file

@ -190,6 +190,8 @@ Style/NumericPredicate:
# only with ruby >= 2.3
Style/FrozenStringLiteralComment:
Enabled: false
Style/SafeNavigation:
Enabled: false
# only with ruby >= 2.4
Performance/RegexpMatch:

View file

@ -269,7 +269,8 @@ module DiasporaFederation
end
private_class_method def self.content_from_doc(doc, content_selector)
element_from_doc(doc, content_selector).try(:content)
element = element_from_doc(doc, content_selector)
element.content if element
end
private_class_method def self.photo_from_doc(doc, photo_selector)

View file

@ -72,7 +72,7 @@ module DiasporaFederation
# @param [Hash] additional_xml_elements additional xml elements
# @see DiasporaFederation::Entity#initialize
def initialize(data, xml_order=nil, additional_xml_elements={})
@xml_order = xml_order.try(:reject) {|name| name =~ /signature/ }
@xml_order = xml_order.reject {|name| name =~ /signature/ } if xml_order
@additional_xml_elements = additional_xml_elements
super(data)