Files
grecia/app/helpers/user_segments_helper.rb
Javi Martín eafb4018bf Apply Style/CollectionMethods rubocop rule
We were already using `map` and `reduce` almost everywhere.
2019-10-26 13:03:49 +02:00

16 lines
445 B
Ruby

module UserSegmentsHelper
def user_segments_options
UserSegments::SEGMENTS.map do |user_segment_name|
[t("admin.segment_recipient.#{user_segment_name}"), user_segment_name]
end
end
def segment_name(user_segment)
if user_segment && UserSegments.respond_to?(user_segment)
I18n.t("admin.segment_recipient.#{user_segment}")
else
I18n.t("admin.segment_recipient.invalid_recipients_segment")
end
end
end