Why do you need to write the end delimiter in Ruby? Can it not be interpreted from the indentation, like in Python or CoffeeScript?
class String
COLORS.each do |color,code|
define_method "in_#{color}" do
"<span style=\"color: ##{code}\">#{self}</span>"
end
end
end
Would look much better to me as
class String
COLORS.each do |color,code|
define_method "in_#{color}" do
"<span style=\"color: ##{code}\">#{self}</span>"
If not, will it be possible in the future or are there any workarounds? Is there any language that compiles into Ruby (like CoffeeScript compiles into JS)?
In Ruby spaces are not significant. So, one needs to clearly mark where block of code starts and ends.
If this looks like a syntactic overhead to you, then you should look at Python 🙂 (I don’t like it for exactly this reason: significant spaces)