Module: Sevgi::Standard::Model::SpecialFontFace

Defined in:
lib/sevgi/standard/model.rb

Instance Method Summary collapse

Instance Method Details

#apply(cdata:, elements:) ⇒ Object

Any number of Descriptive elements and at most one font-face element in any order.



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/sevgi/standard/model.rb', line 68

def apply(cdata:, elements:)
  UnallowedCDataError.(element, cdata) if cdata

  if (font_face_elements = elements.select { |element| element == :"font-face" }).size > 1
    UnmetConditionError.(element, "At most one font-face element allowed")
  end

  unless (unallowed = Element.unpick(elements - font_face_elements, :Descriptive)).empty?
    UnallowedElementsError.(element, unallowed)
  end
end