Class: Mayu::VDOM::DOM::CSSStyleDeclaration

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mayu/vdom/dom.rb

Instance Method Summary collapse

Constructor Details

#initializeCSSStyleDeclaration

Returns a new instance of CSSStyleDeclaration.



17
18
19
# File 'lib/mayu/vdom/dom.rb', line 17

def initialize
  @properties = T.let({}, T::Hash[String, String])
end

Instance Method Details

#get_property_value(name) ⇒ Object



22
23
24
# File 'lib/mayu/vdom/dom.rb', line 22

def get_property_value(name)
  @properties[name].to_s
end

#remove_property(name) ⇒ Object



37
38
39
40
# File 'lib/mayu/vdom/dom.rb', line 37

def remove_property(name)
  @properties.delete(name)
  self
end

#set_property(name, value) ⇒ Object



31
32
33
34
# File 'lib/mayu/vdom/dom.rb', line 31

def set_property(name, value)
  @properties[name] = value.to_s
  self
end

#to_sObject



43
44
45
# File 'lib/mayu/vdom/dom.rb', line 43

def to_s
  @properties.map { "#{_1}: #{_2};" }.join(" ")
end