aseldawy/rasem — pull request #8 by xytis (2013-09-16 06:52:44+00:00)
Title: Refactored Rasem gem

Hi,

I added some new features to Rasem, namely support of any valid svg tag (according to w3 docs).

Would You like to merge these modifications?

New syntax example:
```ruby
File.open("test.svg", "w") do |f|
Rasem::SVGImage.new({:width => "100%"},f) do
self.height = "100%"
self.class = "MySVG"
group :id=>"G1" do
text 50, 50 do
tspan :fill=>"red" do
raw "Hello"
end
raw "World"
end
end
end
end
```

Notable changes:
* method calls are first checked as valid svg tags. If they are -- they are added to child list.
* some svg tags do have aliases (see `Rasem::SVG_ALIAS`)
* some svg tags do support unnamed arguments (see `Rasem::SVG_EXPANSION`)
* no 'on the spot' writing. Write is done either to internal buffer at the end of block, either to external buffer, either to supplied external buffer via `img.write(buffer)`.
* because of the last point, no need to do `sub!` on buffer when doing attribute change. Now it is as easy as `img.height = 150`. Note: in block scope `self` is required, so that ruby would know where to look for the `name=` method.
* increased generation time, since each method call is checked against documentation hash. Which is quite big. (perhaps an opt out feature should be implemented?)
* style and transform tag support may be buggy, since now they are extracted from parameter hash.
* with_style can raise errors if style is applied to tags that do not support 'style' attribute.