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

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

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Validates the special font-face content model.

Instance Method Summary collapse

Instance Method Details

#apply(cdata:, elements:) ⇒ nil

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Applies this content model.

Parameters:

  • cdata (String, nil)

    character data content

  • elements (Array<Symbol>)

    child element names

Returns:

  • (nil)

Raises:



121
122
123
124
125
126
127
128
129
130
131
# File 'lib/sevgi/standard/model.rb', line 121

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