Module: Sevgi::Standard::Model::SomeElements 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 elements that allow selected child elements but no character data.

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:



60
61
62
63
64
65
# File 'lib/sevgi/standard/model.rb', line 60

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

  unallowed = elements - spec[:elements]
  UnallowedElementsError.(element, unallowed) unless unallowed.empty?
end