From d1a89eab15e040372f593565814f01481d98e388 Mon Sep 17 00:00:00 2001 From: Lucas Hiago Date: Fri, 13 Dec 2019 10:23:19 -0300 Subject: [PATCH] Refactor method in articles.rb (#5094) --- app/services/exporter/articles.rb | 34 ++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/app/services/exporter/articles.rb b/app/services/exporter/articles.rb index 282b6e030..e1a7a7f81 100644 --- a/app/services/exporter/articles.rb +++ b/app/services/exporter/articles.rb @@ -18,37 +18,51 @@ module Exporter private def allowed_attributes + time_attributes | url_attributes | general_attributes + end + + def time_attributes + %i[ + created_at + crossposted_at + edited_at + last_comment_at + published_at + ] + end + + def url_attributes + %i[ + canonical_url + feed_source_url + video_closed_caption_track_url + video_source_url + video_thumbnail_url + ] + end + + def general_attributes %i[ body_markdown cached_tag_list cached_user_name cached_user_username - canonical_url comments_count - created_at - crossposted_at description - edited_at - feed_source_url language - last_comment_at main_image main_image_background_hex_color path positive_reactions_count processed_html published - published_at published_from_feed show_comments slug social_image title video - video_closed_caption_track_url video_code - video_source_url - video_thumbnail_url ] end