Skip to content

Commit

Permalink
make method more readable
Browse files Browse the repository at this point in the history
by using less different ways of adding elements to the result array
  • Loading branch information
igneus committed Mar 6, 2021
1 parent 00abf09 commit 3b8fa22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/calendarium-romanum/calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,21 @@ def celebrations_for(date)
@temporale.season(date) == Seasons::ORDINARY &&
(st.empty? || st.first.rank == Ranks::MEMORIAL_OPTIONAL) &&
t.rank <= Ranks::MEMORIAL_OPTIONAL
st = st.dup << Temporale::CelebrationFactory.saturday_memorial_bvm
st += [Temporale::CelebrationFactory.saturday_memorial_bvm]
end

unless st.empty?
if st.first.rank > t.rank
if st.first.rank == Ranks::MEMORIAL_OPTIONAL
return st.dup.unshift t
return [t] + st
else
return st
end
elsif t.rank == Ranks::FERIAL_PRIVILEGED && st.first.rank.memorial?
commemorations = st.collect do |c|
c.change(rank: Ranks::COMMEMORATION, colour: t.colour)
end
return commemorations.unshift t
return [t] + commemorations
elsif t.symbol == :immaculate_heart &&
[Ranks::MEMORIAL_GENERAL, Ranks::MEMORIAL_PROPER].include?(st.first.rank)
optional_memorials = ([t] + st).collect do |celebration|
Expand Down

0 comments on commit 3b8fa22

Please sign in to comment.