Im trying to code my own DSL for file manipulation, just for the sake of learning.
My goal is to make it understandable and easy to code.
Here are 3 alternatives for appending a string to a database.yml:
1. append("windows").to("database.yml")
2. append(string: "windows").to(file: "database.yml")
3. append_string("windows").to_file("database.yml")
4. append_string "windows", to_file: "database.yml"
5. append string: "windows", to_file: "database.yml"
Im a little bit lost in all these alternatives.
Could someone with experience in DSL give me some guidance and explain what the pros and cons are with each one?
Everyone are read the same, but I want to know which one follows best practice for DRY and good coding standard.
EDIT: I think it will be good if I could specify some optional parameters eg.
append(string: "windows").to(file: "database.yml", :force => true)
So taken this into account, I guess that I have to use the method calls. Because if I use alternatives 4-5 then when I specify :force => true, I can't know if it's for the string or the file.