View Source SmeeView.Aspects.Keywords (SmeeView v0.2.0)

Represents and processes <mdui:Keywords> elements in entity metadata as Aspect structs.

The functions in this module are intended to be applied to individual Aspect structs - for extracting and processing collections of these records please use the matching View module.

Summary

Functions

Is this aspect relevant to the IdP role?

Returns the language of this aspect (as a two letter ISO 639-1 code)

Is the aspect using this language? (two letter ISO 639-1 code)

Returns the associated role for this aspect: :sp, :idp or :all

Is this aspect relevant to the SP role?

Lists all keywords in this set as a single binary string

Returns the keywords in one keyword set as a list of strings

Types

@type t() :: %SmeeView.Aspects.Keywords{lang: binary(), words: list()}

Functions

@spec idp?(aspect :: t()) :: boolean()

Is this aspect relevant to the IdP role?

Will return true if the aspect has been derived from an IdP role, or is applicable to all roles.

Keywords.idp?(aspect)
# => true
@spec lang(aspect :: t()) :: binary()

Returns the language of this aspect (as a two letter ISO 639-1 code)

If no language code has been set for this aspect then the default language code will be returned.

Keywords.lang(aspect)
# => "fr"
Link to this function

lang?(aspect, lang \\ SmeeView.Utils.default_lang())

View Source

Is the aspect using this language? (two letter ISO 639-1 code)

Returns true if the provided code matches that of the aspect.

If no language code has been set for this aspect then the aspect will be assumed to have the default language code.

Keywords.lang?(aspect, "en")
# => false
@spec role(aspect :: t()) :: atom()

Returns the associated role for this aspect: :sp, :idp or :all

The role type is useful when handling a mixed list of aspects that may be specific to certain roles of an entity.

Keywords.role(aspect)
# => :idp
@spec sp?(aspect :: t()) :: boolean()

Is this aspect relevant to the SP role?

Will return true if the aspect has been derived from an SP role, or is applicable to all roles.

Keywords.sp?(aspect)
# => false
@spec text(aspect :: t()) :: binary()

Lists all keywords in this set as a single binary string

Keywords.text(aspect)
# => "GÉANT geant Terena Dante"
@spec words(aspect :: t()) :: list()

Returns the keywords in one keyword set as a list of strings

Keywords.words(aspect)
# => ["GÉANT", "geant", "Terena" "Dante"]