0

Ruby sets guidelines for best practice but what happens when two guidelines contradict eachother? Which one do you prefer?

For example..

Option 1 (Not recommended)

if some_condition
  do_something
end

Option 2 (Recommended)

do_something if some_condition

What happens if you use option 2 and the text goes outside the traditional page break. Which rule takes priority according to the community guidelines?

                                                        |
 do_something if some_condition_which_takes_up_a_lot_of_room_is_met                                                       
                                                        |
                                                        |
                                                        |
                                                        |
                                                        |
                                                        |
                                                        |

Thanks

ARL
  • 986
  • 2
  • 12
  • 25
  • 1
    Ruby (or its developer) doesn't set best practices, some Ruby community do. – sawa Jul 10 '17 at 08:37
  • He probably refers this style-guide: https://github.com/bbatsov/ruby-style-guide – AlexN Jul 10 '17 at 11:54
  • Use suffix conditionals only when the line is short. Do this not to keep the line shorter than an arbitrary limit, but because a long line is probably too complex and should be broken up into smaller, easier to understand pieces. – Wayne Conrad Jul 10 '17 at 13:46

0 Answers0