views:

173

answers:

2

As I understand it, eruby is like erb - it lets you stick ruby code into HTML. If someone is using Rails, more than likely they would use erb or Haml.

But if I'm not using Rails, under what cirumstances would I need eruby if I'm just doing Ruby programming?

I guess I don't understand why someone would need to be outputting HTML if they're just using Ruby for writing scripts.

A: 

You just answered your own question. If your script needs to output HTML, you could use eruby. Other than that, you probably don't need it.

Jekke
+2  A: 

eRuby isn't just for HTML - it allows you to embed ruby into any arbitrary text. I've seen it used in scripts that generate Apache configuration files, for instance - it's generally useful if you have any sort of text-based output that needs some dynamic content, as an eRuby template can often be easier to read than a bunch of string concatenation or interpolation.

Greg Campbell
+1 It's a general templating language. Generating HTML is where it's usually employed, but they're not married or anything.
Chuck