lib/Base/SVGObject.rb
#This is not the way RVG does attribute setting, but it's nicer. Instead
#of using self.attr1 = value 1, self.attr2 = value2, we should be able
#to do self.attributes(:attr1 => value1, :attr2 => value2)
#This method is also chainable and can yield to a block. It's just
#all round neater.
#Note that we CANNOT simply do @attributes.merge!(attrs), we instead call
#each method. The reason for this is that some of the methods have overridden
#non-default implementations, in particular when an attr helper is required
#e.g. clip_path. If we simply do a merge, the IdHelper won't be run 
This is not the way RVG does attribute setting, but it's nicer. Instead
of using self.attr1 = value 1, self.attr2 = value2, we should be able
to do self.attributes(:attr1 => value1, :attr2 => value2)
This method is also chainable and can yield to a block. It's just
all round neater.
Note that we CANNOT simply do @attributes.merge!(attrs), we instead call
each method. The reason for this is that some of the methods have overridden
non-default implementations, in particular when an attr helper is required
e.g.
This is not the way RVG does attribute setting but it ' s nicer . Instead of using self . attr1 = value 1 self . attr2 = value2 we should be able to do self . attributes ( : attr1 = > value1 : attr2 = > value2 ) This method is also chainable and can yield to a block . It ' s just all round neater . Note that we CANNOT simply do @attributes . merge! ( attrs ) we instead call each method . The reason for this is that some of the methods have overridden non - default implementations in particular when an attr helper is required e . g .
def attributes(attrs)
			attrs.each do |k,v|
				setter = "#{k}=".to_sym
				self.send(setter, v)
			end
			yield self if block_given?
			return self
		end
def attributes ( attrs ) attrs . each do | k , v | setter = "#{k}=" . to_sym self . send ( setter , v ) end yield self if block_given? return self end
This is not the way RVG does attribute setting, but it's nicer.
This is not the way RVG does attribute setting but it ' s nicer .
attrs