Class: BoringAvatars::Svg::Element

Inherits:
Data
  • Object
show all
Defined in:
lib/boring_avatars/svg/element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, attributes: {}, children: []) ⇒ Element

Returns a new instance of Element.



6
7
8
9
10
11
12
# File 'lib/boring_avatars/svg/element.rb', line 6

def initialize(name:, attributes: {}, children: [])
  super(
    name: name.to_s.freeze,
    attributes: attributes.reject { |_key, value| value.nil? }.freeze,
    children: children.freeze
  )
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



5
6
7
# File 'lib/boring_avatars/svg/element.rb', line 5

def attributes
  @attributes
end

#childrenObject (readonly)

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



5
6
7
# File 'lib/boring_avatars/svg/element.rb', line 5

def children
  @children
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/boring_avatars/svg/element.rb', line 5

def name
  @name
end