dimanche 21 août 2016

When to use require vs ActiveSupport::Concern?

I wrote a sudoku solver program in Ruby that I want to place inside a Rails 4 app. The file structure for the program at the moment is as follows.

- sudoku_solver.rb 
 - board.rb
   - cell.rb
   - column.rb
   - row.rb
   - block.rb

Each hierarchy is linked together with require_relative.

Now in Rails, I've created model/sudoku.rb, which is intended to be sudoku_solver.rb. I've read about mixins, concerns, and I don't know how to choose the correct one to use over simply requiring model/sudoku/board.rb, model/sudoku/cell.rb, etc.

Any guidance would be appreciated. Here's the repo for the Ruby program is one wants to see it.

Aucun commentaire:

Enregistrer un commentaire