Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include guard in ruby

Tags:

ruby

What is the idiomatic way to add an include guard in a ruby file analogous to

#ifdef FOO_H
#define FOO_H
...

#endif

in C?

like image 813
David Nehme Avatar asked Dec 03 '22 15:12

David Nehme


1 Answers

If you use require to load your file, it will only be included once (assuming you're not loading the same file by different names/paths), so in general Ruby files do not use include guards.

like image 118
Chris Jester-Young Avatar answered Dec 26 '22 12:12

Chris Jester-Young