Module: Opal::Config
Instance Attribute Summary collapse
-
#arity_check_enabled ⇒ true, false
Enable arity check on the arguments passed to methods, procs and lambdas.
-
#const_missing_enabled ⇒ true, false
Enable const_missing support.
-
#dynamic_require_severity ⇒ :error, ...
Set the error severity for when a require can't be parsed at compile time.
-
#freezing_stubs_enabled ⇒ true, false
Add stubs for methods related to freezing objects (for compatibility).
-
#inline_operators_enabled ⇒ true, false
Enable for inline operators optimizations.
-
#irb_enabled ⇒ true, false
Enable IRB support for making local variables across multiple compilations.
-
#method_missing_enabled ⇒ true, false
Enable method_missing support.
-
#missing_require_severity ⇒ :error, ...
Set the error severity for when a required file can't be found at build time.
-
#source_map_enabled ⇒ true, false
Enable source maps support.
-
#stubbed_files ⇒ Set
A set of stubbed files that will be marked as loaded and skipped during compilation.
-
#tainting_stubs_enabled ⇒ true, false
Add stubs for methods related to tainting objects (for compatibility).
Instance Method Summary collapse
-
#compiler_options ⇒ Hash
The configuration for Opal::Compiler.
-
#config ⇒ Hash
The current configuration, defaults to #default_config.
-
#default_config ⇒ Hash
The default configuration.
-
#reset! ⇒ void
Resets the config to its default value.
Instance Attribute Details
#arity_check_enabled ⇒ true, false
Enable arity check on the arguments passed to methods, procs and lambdas.
89 |
# File 'opal/lib/opal/config.rb', line 89 config_option :arity_check_enabled, false, compiler_option: :arity_check |
#const_missing_enabled ⇒ true, false
Enable const_missing support.
84 |
# File 'opal/lib/opal/config.rb', line 84 config_option :const_missing_enabled, true, compiler_option: :const_missing |
#dynamic_require_severity ⇒ :error, ...
Set the error severity for when a require can't be parsed at compile time.
:error
will raise an error at compile time:warning
will print a warning on stderr at compile time:ignore
will skip the require silently at compile time
112 |
# File 'opal/lib/opal/config.rb', line 112 config_option :dynamic_require_severity, :warning, compiler_option: :dynamic_require_severity, valid_values: %i[error warning ignore] |
#freezing_stubs_enabled ⇒ true, false
Add stubs for methods related to freezing objects (for compatibility).
94 |
# File 'opal/lib/opal/config.rb', line 94 config_option :freezing_stubs_enabled, true, compiler_option: :freezing |
#inline_operators_enabled ⇒ true, false
Enable for inline operators optimizations.
135 |
# File 'opal/lib/opal/config.rb', line 135 config_option :inline_operators_enabled, true, compiler_option: :inline_operators |
#irb_enabled ⇒ true, false
Enable IRB support for making local variables across multiple compilations.
130 |
# File 'opal/lib/opal/config.rb', line 130 config_option :irb_enabled, false, compiler_option: :irb |
#method_missing_enabled ⇒ true, false
Enable method_missing support.
79 |
# File 'opal/lib/opal/config.rb', line 79 config_option :method_missing_enabled, true, compiler_option: :method_missing |
#missing_require_severity ⇒ :error, ...
Set the error severity for when a required file can't be found at build time.
:error
will raise an error at compile time:warning
will print a warning on stderr at compile time:ignore
will skip the require silently at compile time
125 |
# File 'opal/lib/opal/config.rb', line 125 config_option :missing_require_severity, :error, valid_values: %i[error warning ignore] |
#source_map_enabled ⇒ true, false
Enable source maps support.
140 |
# File 'opal/lib/opal/config.rb', line 140 config_option :source_map_enabled, true |
#stubbed_files ⇒ Set
A set of stubbed files that will be marked as loaded and skipped during compilation. The value is expected to be mutated but it's ok to replace it.
147 |
# File 'opal/lib/opal/config.rb', line 147 config_option :stubbed_files, -> { Set.new }, valid_values: [Set] |
#tainting_stubs_enabled ⇒ true, false
Add stubs for methods related to tainting objects (for compatibility).
99 |
# File 'opal/lib/opal/config.rb', line 99 config_option :tainting_stubs_enabled, true, compiler_option: :tainting |
Instance Method Details
#compiler_options ⇒ Hash
Returns the configuration for Opal::Compiler
54 55 56 57 58 59 60 61 |
# File 'opal/lib/opal/config.rb', line 54 def = {} .each do |name, | compiler_option_name = .fetch(:compiler) [compiler_option_name] = config.fetch(name) end end |
#config ⇒ Hash
Returns the current configuration, defaults to #default_config
64 65 66 |
# File 'opal/lib/opal/config.rb', line 64 def config @config ||= default_config end |
#default_config ⇒ Hash
Returns the default configuration
43 44 45 46 47 48 49 50 51 |
# File 'opal/lib/opal/config.rb', line 43 def default_config default_config = {} .each do |name, | default_value = .fetch(:default) default_value = Proc === default_value ? default_value.call : default_value default_config[name] = default_value end default_config end |
#reset! ⇒ void
This method returns an undefined value.
Resets the config to its default value
71 72 73 |
# File 'opal/lib/opal/config.rb', line 71 def reset! @config = nil end |