Class: SVG::ElementBase
- Inherits:
-
Object
- Object
- SVG::ElementBase
- Defined in:
- lib/ruby-svg/element.rb
Overview
#
ElementBase Class
Direct Known Subclasses
Anchor, Circle, Ellipse, Group, Image, Line, Path, Polygon, Polyline, Rect, Text, Use
Instance Attribute Summary collapse
-
#attr ⇒ Object
Returns the value of attribute attr.
-
#class ⇒ Object
Returns the value of attribute class.
-
#id ⇒ Object
Returns the value of attribute id.
-
#style ⇒ Object
Returns the value of attribute style.
-
#transform ⇒ Object
Returns the value of attribute transform.
Instance Method Summary collapse
-
#initialize(&block) ⇒ ElementBase
constructor
A new instance of ElementBase.
- #to_s ⇒ Object
Constructor Details
#initialize(&block) ⇒ ElementBase
Returns a new instance of ElementBase.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby-svg/element.rb', line 15 def initialize(&block) @id = nil @style = nil @class = nil @transform = nil @attr = nil if block_given? instance_eval(&block) end end |
Instance Attribute Details
#attr ⇒ Object
Returns the value of attribute attr.
27 28 29 |
# File 'lib/ruby-svg/element.rb', line 27 def attr @attr end |
#class ⇒ Object
Returns the value of attribute class.
27 28 29 |
# File 'lib/ruby-svg/element.rb', line 27 def class @class end |
#id ⇒ Object
Returns the value of attribute id.
27 28 29 |
# File 'lib/ruby-svg/element.rb', line 27 def id @id end |
#style ⇒ Object
Returns the value of attribute style.
27 28 29 |
# File 'lib/ruby-svg/element.rb', line 27 def style @style end |
#transform ⇒ Object
Returns the value of attribute transform.
27 28 29 |
# File 'lib/ruby-svg/element.rb', line 27 def transform @transform end |
Instance Method Details
#to_s ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby-svg/element.rb', line 29 def to_s text = '' text << %| id="#{@id}"| if @id text << %| style="#{@style}"| if @style text << %| class="#{@class}"| if @class text << %| transform="#{@transform}"| if @transform text << %| #{@attr}| if @attr return text end |