File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 32
32
reset_lesson_position = lambda { |lessons | lessons . each . with_index ( 1 ) { |lesson , index | lesson . merge! ( position : index ) } }
33
33
34
34
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 )
37
37
end
38
38
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 ) }
40
40
sections . map { |section | modify_section . call ( section , indexed_sections . shift ( section [ :lessons ] . count ) ) }
41
41
42
- puts JSON . pretty_generate ( sections )
42
+ puts JSON . pretty_generate ( sections )
You can’t perform that action at this time.
0 commit comments