Class: GL::Registry::FeatureProvider Abstract

Inherits:
Token
  • Object
show all
Defined in:
lib/opengl/registry/feature_provider.rb

Overview

This class is abstract.

Base class for objects that add definitions to the API.

Direct Known Subclasses

Extension, FeatureGroup

Instance Attribute Summary collapse

Attributes inherited from Token

#comment

Instance Method Summary collapse

Methods inherited from Token

#to_s

Constructor Details

#initialize(node) ⇒ FeatureProvider

Creates a new instance of the GL::Registry::FeatureProvider class.

Parameters:

  • node (Ox::Element)

    The XML element defining the instance.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/opengl/registry/feature_provider.rb', line 24

def initialize(node)
  super(node)

  @api = node[Words::API]&.to_sym || :none
  @name = node[Words::NAME]

  @additions = []
  node.locate('require').each do |child|

    api = child[Words::API]&.to_sym || @api
    profile = child[Words::PROFILE]&.to_sym

    child.nodes.each do |item|
      next unless item.is_a?(Ox::Element)
      @additions << Feature.new(item, api, profile)
    end
  end
end

Instance Attribute Details

#additionsArray<Feature> (readonly)

Returns an array of features that this instance provides.

Returns:

  • (Array<Feature>)

    an array of features that this instance provides.



18
19
20
# File 'lib/opengl/registry/feature_provider.rb', line 18

def additions
  @additions
end

#apiSymbol (readonly)

Returns the name of the API this feature is defined within.

Returns:

  • (Symbol)

    the name of the API this feature is defined within.



10
11
12
# File 'lib/opengl/registry/feature_provider.rb', line 10

def api
  @api
end

#nameString (readonly)

Returns the name of the feature set.

Returns:

  • (String)

    the name of the feature set.



14
15
16
# File 'lib/opengl/registry/feature_provider.rb', line 14

def name
  @name
end