I am assigning some values to an newly created (Icalendar-) Object:
def map_to_cal_event
e = Icalendar::Event.new
e.dtstart = to_icaldate start.to_datetime
e.dtend = to_icaldate self.end.to_datetime if self.end.present?
e.summary = title
e.description = description
e.url = timetable_url
e.categories = categories
e.location = location
e
end
Using Rubocop it is complaining about
Metrics/AbcSize: Assignment Branch Condition size for map_to_cal_event is too high. [<8, 21, 1> 22.49/17]
It seems a very common assigment to me.
So, How to refactor this method to satisfy rubocop? Or should i put it in the ignore-list?
This should satisfy Rubocop, define a new event in a separate method using the
tapmethod with a block then pass another block to it with all the assignments.