Skip to content

Commit 61d544e

Browse files
authored
Apply suggestions from code review
1 parent de27b0b commit 61d544e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ruby/with_lambdas.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
reset_lesson_position = lambda {|lessons| lessons.each.with_index(1) { |lesson, index| lesson.merge!(position: index) } }
3333

3434
modify_section = lambda do |section, indexed_lessons|
35-
lessons = section[:reset_lesson_position] ? reset_lesson_position.call(section[:lessons]) : indexed_lessons
36-
section.merge!(lessons: lessons)
35+
lessons = section[:reset_lesson_position] ? reset_lesson_position.call(section[:lessons]) : indexed_lessons
36+
section.merge!(lessons: lessons)
3737
end
3838

39-
indexed_sections = sections.flat_map{ _1[:lessons] }.each.with_index(1) { |a, index| a.merge!(position: index)}
39+
indexed_sections = sections.flat_map{ _1[:lessons] }.each.with_index(1) { |a, index| a.merge!(position: index) }
4040
sections.map { |section| modify_section.call(section, indexed_sections.shift(section[:lessons].count)) }
4141

42-
puts JSON.pretty_generate(sections)
42+
puts JSON.pretty_generate(sections)

0 commit comments

Comments
 (0)