Ruby:
- Figured out ruby multi-file structure - For this example I'll use 2 files, a run.rb and a my_module.rb in the same directory. my_module.rb has a module called MyModule defined within it.
- A separate file can have its own modules, and to get access those modules, one must add a require statement to run.rb:
- require './my_module'
- Without the ./, ruby cannot find the file because it doesn't look in the run directory of run.rb
- To get at MyModule, one must then add an include statement to run.rb:
- include MyModule
- Note that there are not quotes around MyModule.
- With this done, run.rb should be able to access the classes within my_module.rb. See the code box for a real example.
- In the code, you can see that the ArgumentsHandler class is referenced with a ::. I'm not exactly sure what this means, but it is the way that you reference classes within modules in ruby.
- I started trying to split up processFile, but I ran into some design questions. For example, I have a set of methods that lend themselves well to an enclosed class, but since the class is only used in the arguments parser (its own module), I'm not sure if the whole program or just the arguments parsing module should know about the third module. I should probably just introduce classes on a need to know basis to avoid extra dependencies, and only have the arguments parser know about the filenames lister module
Ruby Code:
#require statements
#...
require './nsf_user_input' include NSFUserInput
#code
#...
args_handler = NSFUserInput::ArgumentsHandler.new
Javascript:
- Got working a div that you can drag around with the mouse as a very primitive window. I don't have a whole lot of time to work on it because I am mainly focusing on ruby, but I think this kind of thing is pretty cool
- Learned about jQuery UI, a library to do stuff exactly like what I was doing
Project Proposal:
- I'm going to present my ruby thing
No comments:
Post a Comment