When use Ruby interpreter (CUI), where does saved .yml go?

I use Windows 7 and Ruby 2.2.3p173

I wrote this program:
The program is dictionary. So it could save and find the definition of a
word. The program save/dump a hash (word-definition) into

When I ran it through command line, it created dic_database.yml in the
same directory. Everything worked.
Then I deleted the .yml and tried to open the program with Ruby
interpreter. But the program didn’t create any .yml in the same dir.
When I quit the interpeter then try again to find a word, I can find it.
So the object isn’t temporarily saved.

But, then, where does saved .yml/hash object go (what dir)?

Your code is not very idiomatic ruby.

Things such as:


How did you come up with this?


Would suffice. Or alias e puts, then just use e.

Anyway - if you really wrote that program yourself, which
I am not totally convinced, then you obviously know where
to save your data structures.

Simply use a separate method that will do so, and store
into a specific file. You are in full control of your own
code! I don’t understand how you can not understand what
your own code does.

Thank you for your time, Robert.

I wrote puts("") because I wanted to give line break, or probably I
should use “\n” in the end of each sentence.
Yes, I believe my code isn’t common for Rubyist because I don’t prefer
to omit parentheses for method invocation, for example, and I’m totally
newbie as Ruby programmer or as programmer in common. I believe I could
not go as expected Rubyist.

Let’s back to the problem.
I believe I don’t understand precisely the w+'s behavior. Therefore my
code doesn’t go as I expected.

And I think I’m not clear: it is working as expected if I run it through
cmd, but isn’t through Ruby interpreter, I mean, when I right click the
file and Open with Ruby interpreter (CUI) through Windows Explorer.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs