Closed johndbritton closed 11 years ago
Working on this right now. :smile:
Looking good. BTW, let me know when I need to cut a new gem release to RubyGems. Maybe in the meantime I can figure out how to add you as a collaborator on there so you can push, too. :)
Will do. I still need to flesh out its TOML formatting conversions before it'll be release-ready. On that note, does adding a to_toml
method to Strings, Integers, Floats, Arrays, etc. and then calling that from the generator sound okay? I can throw that together tonight/tomorrow morning.
Hrmm. That sounds fine to me, but can we make them injected only if you require something like 'toml/generator' or something? That'd keep them from polluting the object space more than necessary.
Definitely. Should it auto-inject when you initialize a Generator for the first time? I'd personally rather it Just Work and do a little polluting when I try generating versus having to deal with another error message (even if it is informative and tells me exactly what to do).
Yeah go ahead and fire them off when the file is required I'd say. It'll make things much cleaner.
Okay so faac21020b9207a09ff9fb2f16dad889ec4d350d adds the inject!
class method to add the to_toml
methods to the internal Ruby classes used by the generator. When you initialize a generator it calls this to ensure the to_toml
methods that it needs are there. Do you think this should be split out into a separate file with regular class-and-method definitions or is the current style okay?
for the love of god do not add a to_toml method to anything
Why not? Doing so matches the behaviors of the JSON gem (to_json
), YAML gem (to_yaml
), MessagePack gem (to_msgpack
), etc.
to_json has caused so much pain over the years
@dirk Are you still planning to work on this?
@johndbritton Sure! Just not sure what needs to be done. Any specific features/capabilities you'd like?
I was just looking for a way to go from a hash to toml that I can write out to a file. How ever you all decide to expose that is fine by me.
@johndbritton Check out test/test_generator.rb for usage of the generator. If that doesn't work with the current gem version then @jm can update it.
Just noticed that there are no usage examples for the generator in the README; will fix that.
Just pushed eb78127f7501d0f8e590f05e8571db1e72622d5e so closing this.
awesome, thanks. :beers:
It's great to be able to parse TOML, but I'd also like the ability to write out TOML. Any plans to support this?