Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby DSL experiences?

Tags:

ruby

dsl

dsel

I don't know anything in Ruby, but i'm pretty interested in DSLs. And DSL seems to be a buzz word for you community.

Do you actually implement DSLs in Ruby for your own purposes ? If so, how complex and how dedicated are they ?

i've seen this question here, but i'm more interested in your everyday experience.

thanks.

like image 492
LB40 Avatar asked Sep 16 '26 13:09

LB40


1 Answers

My own experience writing DSLs in Ruby is quite limited but i've done the following:

(1) An L-System DSL:

Dragon = TexPlay::LSystem.new {
    rule "F" => "F"
    rule "X" => "X+YF+"
    rule "Y" => "-FX-Y"
    angle 90

    atom "FX"
}

(2) An image manipulation tool:

image.paint {
    circle 20, 20, 15, :color => :red
    rect 10, 20, 100, 100, :color => :green
    pixel 40, 40, :color => :white
}
like image 105
horseyguy Avatar answered Sep 18 '26 05:09

horseyguy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!