class GL::Registry::Enum
Describes an OpenGL enumeration (constant) value.
Attributes
alias_name[R]
@return [String?] an alternative name for the value.
api[R]
@return [Symbol?] an API associated with this enumeration value.
groups[R]
@return [Array<String>] an array of names of the groups this enumeration is defined within.
name[R]
@return [String] the name of the enumeration member.
type[R]
@return [Symbol] a hint for the enumeration value type (i.e. GLenum, GLuint, GLuint64, etc)
value[R]
@return [String] the value of the enumeration, always numerical, typically in hexadecimal format.
Public Class Methods
new(node)
click to toggle source
Creates a new instance of the {Enum} class.
@param node [Ox::Element] The XML element defining the instance.
Calls superclass method
# File lib/opengl/registry/enum.rb, line 38 def initialize(node) super(node) # Required @name = node[Words::NAME] @value = node[Words::VALUE] # Optional @alias_name = node[Words::ALIAS] @api = node[Words::API]&.to_sym @groups = node[Words::GROUP]&.split(',') || [] @type = case node[Words::TYPE] when Words::U_LONG then :GLuint when Words::U_LONG_LONG then :GLuint64 else :GLenum end end
Public Instance Methods
to_i()
click to toggle source
@return [Integer] the enumeration's value, as an integer.
# File lib/opengl/registry/enum.rb, line 59 def to_i @value.start_with?('0x') ? @value.hex : @value.to_i end