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.
 
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.
:errorwill raise an error at compile time:warningwill print a warning on stderr at compile time:ignorewill skip the require silently at compile time
      107  | 
    
      # File 'opal/lib/opal/config.rb', line 107 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.
      130  | 
    
      # File 'opal/lib/opal/config.rb', line 130 config_option :inline_operators_enabled, true, compiler_option: :inline_operators  | 
  
#irb_enabled ⇒ true, false
Enable IRB support for making local variables across multiple compilations.
      125  | 
    
      # File 'opal/lib/opal/config.rb', line 125 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.
:errorwill raise an error at compile time:warningwill print a warning on stderr at compile time:ignorewill skip the require silently at compile time
      120  | 
    
      # File 'opal/lib/opal/config.rb', line 120 config_option :missing_require_severity, :error, valid_values: %i[error warning ignore]  | 
  
#source_map_enabled ⇒ true, false
Enable source maps support.
      135  | 
    
      # File 'opal/lib/opal/config.rb', line 135 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.
      142  | 
    
      # File 'opal/lib/opal/config.rb', line 142 config_option :stubbed_files, -> { Set.new }, valid_values: [Set]  | 
  
Instance Method Details
#compiler_options ⇒ Hash
Returns the configuration for Opal::Compiler.
      55 56 57 58 59 60 61 62  | 
    
      # File 'opal/lib/opal/config.rb', line 55 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.
      65 66 67  | 
    
      # File 'opal/lib/opal/config.rb', line 65 def config @config ||= default_config end  | 
  
#default_config ⇒ Hash
Returns the default configuration.
      44 45 46 47 48 49 50 51 52  | 
    
      # File 'opal/lib/opal/config.rb', line 44 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
      72 73 74  | 
    
      # File 'opal/lib/opal/config.rb', line 72 def reset! @config = nil end  |