Class: GL::Registry::Group
Overview
Describes a logical grouping of enumerated values.
Instance Attribute Summary collapse
-
#members ⇒ Array<Enum>
readonly
An array of enum values that are associated with this group.
-
#name ⇒ String?
readonly
The name of this grouping.
-
#namespace ⇒ String
readonly
The namespace this group belongs within.
-
#range ⇒ Range?
readonly
An end-inclusive range of values this group covers.
-
#vendor ⇒ String?
readonly
The name of the vendor that defines this value.
Attributes inherited from Token
Instance Method Summary collapse
-
#bitmask? ⇒ Boolean
true
if group members are flags that can be bitwise OR'ed together, otherwisefalse
. -
#initialize(node) ⇒ Group
constructor
Creates a new instance of the Group class.
Methods inherited from Token
Constructor Details
#initialize(node) ⇒ Group
Creates a new instance of the GL::Registry::Group class.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/opengl/registry/group.rb', line 33 def initialize(node) super(node) @namespace = node[Words::NAMESPACE] @name = node[Words::GROUP] type = node[Words::TYPE] @bitmask = type && type == Words::BITMASK @vendor = node[Words::VENDOR] first = node[Words::RANGE_START] if first last = node[Words::RANGE_END] @range = Range.new(first.hex, last.hex, false) if last end @members = [] node.locate('enum').each do |enum| next unless enum.is_a?(Ox::Element) @members << Enum.new(enum) end end |
Instance Attribute Details
#members ⇒ Array<Enum> (readonly)
Returns an array of enum values that are associated with this group.
14 15 16 |
# File 'lib/opengl/registry/group.rb', line 14 def members @members end |
#name ⇒ String? (readonly)
Not all groups are named, and this value may be nil
.
Returns the name of this grouping.
19 20 21 |
# File 'lib/opengl/registry/group.rb', line 19 def name @name end |
#namespace ⇒ String (readonly)
Returns the namespace this group belongs within.
10 11 12 |
# File 'lib/opengl/registry/group.rb', line 10 def namespace @namespace end |
#range ⇒ Range? (readonly)
Returns an end-inclusive range of values this group covers.
27 28 29 |
# File 'lib/opengl/registry/group.rb', line 27 def range @range end |
#vendor ⇒ String? (readonly)
Returns the name of the vendor that defines this value.
23 24 25 |
# File 'lib/opengl/registry/group.rb', line 23 def vendor @vendor end |
Instance Method Details
#bitmask? ⇒ Boolean
Returns true
if group members are flags that can be bitwise OR'ed together, otherwise false
.
57 58 59 |
# File 'lib/opengl/registry/group.rb', line 57 def bitmask? @bitmask end |