class Dieses::Geometry::Element
Constants
- BoundingBox
Attributes
attributes[R]
hash[R]
Public Class Methods
new()
click to toggle source
# File lib/dieses/geometry/element.rb, line 10 def initialize @attributes = {} @hash = self.class.hash ^ to_h.hash freeze end
Public Instance Methods
attr(**kwargs)
click to toggle source
# File lib/dieses/geometry/element.rb, line 16 def attr(**kwargs) tap do kwargs.each { |key, value| attributes[key.to_sym] = value } end end
classify(*tags, **kwargs)
click to toggle source
# File lib/dieses/geometry/element.rb, line 22 def classify(*tags, **kwargs) existing_class = attributes[:class] || Set.new attr(**kwargs, class: existing_class.add(tags)) end
eql?(other)
click to toggle source
# File lib/dieses/geometry/element.rb, line 31 def eql?(other) return false unless other.is_a? self.class to_h == other.to_h end
Also aliased as: ==
to_svg()
click to toggle source
# File lib/dieses/geometry/element.rb, line 27 def to_svg format to_svgf, attributes: Support.kwargs_to_s(**attributes) end