As always... xD
I hate to admit, but i need some help...
The question is... for example, to transform a "\\n" into "\n", what do i have to do? I tried:
But with no result after all.
P.S.: I´m doing this for a database/configuration-like system... My system may have lots of flaws and all, and it´s done to be used by other scripters. May i use XML? But for that i need that everyone that uses it has Ruby installed, so i´m clueless on what´s better in terms of reliability AND easiness ^^ And surely, with XML it will become more difficult to make those config files, but they will look more professional, indeed.
Some help plz ^^
I hate to admit, but i need some help...
I´m making a file loader, some kind of configuration file loader. The purpose is to make it the easier possible, and permit some customizations that i have in mind. I´ll be using it for a script i´m making, and soon i´ll release it in .org (and then the need for it to be as easy as possible).
In it i have blocks and properties, and those properties can have one value that can be either a Numeric or String. I want the syntax used to be exact like in real Ruby coding. When opening the txt file with File.open("name.txt", "rb"), it opens everything as a string.
Hell, until that point no problem. I can identify integers, floats and strings very well, and transform/convert them properly (like taking the quotes for a string and transforming "1.0" into 1.0 for example. But characters like \n, \t, \c, \blabla[text] appears as \\n \\t, \\c, \\blabla[text], and in fact i want them to appear as they´re in the txt file. That was expected, and i had a solution for that but... Haven´t worked lol -_-
In it i have blocks and properties, and those properties can have one value that can be either a Numeric or String. I want the syntax used to be exact like in real Ruby coding. When opening the txt file with File.open("name.txt", "rb"), it opens everything as a string.
Hell, until that point no problem. I can identify integers, floats and strings very well, and transform/convert them properly (like taking the quotes for a string and transforming "1.0" into 1.0 for example. But characters like \n, \t, \c, \blabla[text] appears as \\n \\t, \\c, \\blabla[text], and in fact i want them to appear as they´re in the txt file. That was expected, and i had a solution for that but... Haven´t worked lol -_-
The question is... for example, to transform a "\\n" into "\n", what do i have to do? I tried:
Code:
"\\n".sub!(/\\\\/, '\\')
"\\n".sub!(/\\\\/, "\\")
P.S.: I´m doing this for a database/configuration-like system... My system may have lots of flaws and all, and it´s done to be used by other scripters. May i use XML? But for that i need that everyone that uses it has Ruby installed, so i´m clueless on what´s better in terms of reliability AND easiness ^^ And surely, with XML it will become more difficult to make those config files, but they will look more professional, indeed.
Some help plz ^^