Module: Sevgi::Graphics::Attribute::Ident Private

Included in:
Sevgi::Graphics::Attribute
Defined in:
lib/sevgi/graphics/attribute.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.

Attribute identifier helpers.

Instance Method Summary collapse

Instance Method Details

#id(given) ⇒ Symbol

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.

Returns the normalized attribute id.

Parameters:

  • given (String, Symbol)

    attribute name

Returns:

  • (Symbol)


29
30
31
32
# File 'lib/sevgi/graphics/attribute.rb', line 29

def id(given)
  (@id ||= {})[given] ||= (updateable?(given) ? given.to_s.delete_suffix(ATTRIBUTE_UPDATE_SUFFIX) : given)
    .to_sym
end

#internal?(given) ⇒ Boolean

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.

Reports whether an attribute is internal to Sevgi rendering.

Parameters:

  • given (String, Symbol)

    attribute name

Returns:

  • (Boolean)


22
23
24
# File 'lib/sevgi/graphics/attribute.rb', line 22

def internal?(given)
  (@internal ||= {})[given] ||= given.start_with?(ATTRIBUTE_INTERNAL_PREFIX)
end

#updateable?(given) ⇒ Boolean

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.

Reports whether an attribute uses merge/update syntax.

Parameters:

  • given (String, Symbol)

    attribute name

Returns:

  • (Boolean)


37
38
39
# File 'lib/sevgi/graphics/attribute.rb', line 37

def updateable?(given)
  (@updateable ||= {})[given] ||= given.end_with?(ATTRIBUTE_UPDATE_SUFFIX)
end