Class: RubyWasm::FeatureSet

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_wasm/feature_set.rb

Overview

A set of feature flags that can be used to enable or disable experimental features.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(features) ⇒ FeatureSet

Returns a new instance of FeatureSet.



4
5
6
# File 'lib/ruby_wasm/feature_set.rb', line 4

def initialize(features)
  @features = features
end

Class Method Details

.derive_from_envObject

Derives the feature set from the environment variables. A feature is enabled if the corresponding environment variable is set to “1”, otherwise it is disabled.



18
19
20
21
# File 'lib/ruby_wasm/feature_set.rb', line 18

def self.derive_from_env
  values = FEATURES.transform_values { |key| ENV[key] == "1" }
  new(values)
end

Instance Method Details

#support_component_model?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ruby_wasm/feature_set.rb', line 27

def support_component_model?
  @features[:component_model] || @features[:dynamic_linking]
end

#support_dynamic_linking?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ruby_wasm/feature_set.rb', line 23

def support_dynamic_linking?
  @features[:dynamic_linking]
end