Including Files in Ruby Questions

  • I am very new to Ruby, so could you please suggest the best practice for splitting files and including them.
  • What is the preferred design structure for the file layout. When do you decide to split the algorithm into a new file?
  • When do you use load to include other files, and when do you use require ?
  • And is there any performance when you include files?

Thanks.

+3
source share
1 answer
  • I make one file for each class, except for classes, which are small helper classes not required by other files. I also share different modules in subdirectories.

  • load require require , , load , , . require, , , irb, .

  • . load require , . Ruby . , require , , .

+6

Source: https://habr.com/ru/post/1707385/


All Articles