Module: Opal::Config

Defined in:
opal/lib/opal/config.rb

Constant Summary

COMPILER_KEYS =
{
  # Compiler option name:   # Config option name
  method_missing:           :method_missing_enabled,
  arity_check:              :arity_check_enabled,
  freezing:                 :freezing_stubs_enabled,
  tainting:                 :tainting_stubs_enabled,
  const_missing:            :const_missing_enabled,
  dynamic_require_severity: :dynamic_require_severity,
  irb:                      :irb_enabled,
  inline_operators:         :inline_operators_enabled,
}

Class Method Summary collapse

Class Method Details

.compiler_optionsObject



40
41
42
43
44
45
46
47
# File 'opal/lib/opal/config.rb', line 40

def self.compiler_options
  config = self.config
  compiler_options = {}
  COMPILER_KEYS.each do |compiler_option_name, option_name|
    compiler_options[compiler_option_name] = config[option_name]
  end
  compiler_options
end

.configObject



20
21
22
# File 'opal/lib/opal/config.rb', line 20

def self.config
  @config ||= default_config
end

.default_configObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'opal/lib/opal/config.rb', line 5

def self.default_config
  {
    method_missing_enabled:    true,
    arity_check_enabled:       false,
    freezing_stubs_enabled:    true,
    tainting_stubs_enabled:    true,
    const_missing_enabled:     true,
    dynamic_require_severity:  :warning, # :error, :warning or :ignore
    irb_enabled:               false,
    inline_operators_enabled:  true,
    source_map_enabled:        true,
    stubbed_files:             Set.new,
  }
end

.reset!Object



24
25
26
# File 'opal/lib/opal/config.rb', line 24

def self.reset!
  @config = nil
end