Class: GL::Registry::FeatureProvider Abstract
- 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
Instance Attribute Summary collapse
-
#additions ⇒ Array<Feature>
readonly
An array of features that this instance provides.
-
#api ⇒ Symbol
readonly
The name of the API this feature is defined within.
-
#name ⇒ String
readonly
The name of the feature set.
Attributes inherited from Token
Instance Method Summary collapse
-
#initialize(node) ⇒ FeatureProvider
constructor
Creates a new instance of the FeatureProvider class.
Methods inherited from Token
Constructor Details
#initialize(node) ⇒ FeatureProvider
Creates a new instance of the GL::Registry::FeatureProvider class.
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
#additions ⇒ Array<Feature> (readonly)
Returns an array of features that this instance provides.
18 19 20 |
# File 'lib/opengl/registry/feature_provider.rb', line 18 def additions @additions end |
#api ⇒ Symbol (readonly)
Returns 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 |
#name ⇒ String (readonly)
Returns the name of the feature set.
14 15 16 |
# File 'lib/opengl/registry/feature_provider.rb', line 14 def name @name end |