What are the best practices? Ryan Angilly. You don't need to create an Initializer. The Initializer. Dmitry Amelchenko. So would it be a good place to put config. Why not just leave it where it is? This way, we have a single place to start the application every time. Let's step through this file briefly. It is known as a shebang and is used to indicate what interpreter should be used to read the code in this file.
On Unix systems, with the proper configuration, this file can run without having to write ruby before it in the command line. Don't worry if this does not work for you, though. The shebang is just an optional line that makes this file more functional. Notice that the file doesn't have the. This file is designed to be an executable and the lack of file extension indicates this. Some runner files will still have the. Run files act in some way to start an application. Before that, though, they typically need to load up any necessary files.
In the first lines of recognizable Ruby code, we require both our local files located in lib :. With Garden and Plant loaded, we can proceed to run our very simple application — relating a few Plant instances to a Garden instance. In this particular example, the run file does a few different things to show how the setup works. Code Revisions 1. Embed What would you like to do? Embed Embed this gist in your website. Share Copy sharable link for this gist.
Learn more about clone URLs. Download ZIP. Ask Question. Asked 8 years, 9 months ago. Active 8 years, 9 months ago. Viewed 7k times. Robin 7, 5 5 gold badges 50 50 silver badges 80 80 bronze badges. Add a comment. Active Oldest Votes. Robin Robin 7, 5 5 gold badges 50 50 silver badges 80 80 bronze badges. Then the fun begins! Sign up or log in Sign up using Google.
0コメント