News for hackers. Stuff that matters.

saturnflyer

I'm on a project that isn't yet on ruby 3.2 and wanted to use the new Data class. I implemented this to allow me to move to it easily.

It does still have 1 failing test about redefining the initialize method with a block, but it works for all other cases.

The Ruby 3.2 Data class is based on C code from Struct. This is all implemented with Ruby.

Re:Bite-Sized Metrics Email Course on Thursday April 23, 2015 @09:11AM (#9426391)
Interesting. What kind of stuff does this course have?
Re:Ruby DSL Handbook on Friday February 06, 2015 @01:30PM (#9010632)
Yes. Too often this is done even with complex procedures inside methods. A good DSL should be syntactic sugar for making things easy or at least provide some syntactic vinegar for doing non-recommended things (while still allowing them).
Re:Ruby DSL Handbook on Friday February 06, 2015 @01:26PM (#9010605)
Ah. I see. That Ruby doesn't afford this can be somewhat annoying. A counter example is using "alias". It can accept bare words, symbols, or strings. If you really wanted to get around this you could use method_missing on the class but that can open a can of worms.
Re:Ruby DSL Handbook on Friday February 06, 2015 @01:05PM (#9010458)
This surprises me. Can you offer an example of those types of problems in some Ruby code?
Re:Ruby DSL Handbook on Friday February 06, 2015 @01:04PM (#9010448)
Not yet. But you can signup for a 5-email crash course. It's being updated almost every day now as I add more content.
Re:Ruby DSL Handbook on Friday February 06, 2015 @01:04PM (#9010443)
I'm the author. In fact, the first bit of advice I have in the book is: Don't. DSLs often involve metaprogramming, but they don't have to. I'm writing it to record the code practices that I have found useful in getting things right and gather advice and tips from others who have done the same. DSLs are always about communication, so my goal is to create a book that helps developers communicate the purpose of the aspects of their project through code.
Re:How to make your code imply responsibilities on Monday October 21, 2013 @01:32PM (#6586950)
Thanks for some fantastic feedback. I haven't read the worrydream link yet, but will check it out.
Re:How to make your code imply responsibilities on Monday October 21, 2013 @10:02AM (#6585561)
thanks! I'd love to see what you do

Older ยป