Module: Opal::Config

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

Constant Summary

COMPILER_KEYS =
{
  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



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

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



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

def self.config
  @config ||= default_config
end

.default_configObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# 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:  :error, # :error, :warning or :ignore
    irb_enabled:               false,
    inline_operators_enabled:  true,
    source_map_enabled:        true,
  }
end

.reset!Object



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

def self.reset!
  @config = nil
end