Module: Opal::Config

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

Constant Summary

COMPILER_KEYS =
{
  method_missing:           :method_missing_enabled,
  arity_check:              :arity_check_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



34
35
36
37
38
39
40
41
# File 'opal/lib/opal/config.rb', line 34

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



17
18
19
# File 'opal/lib/opal/config.rb', line 17

def self.config
  @config ||= default_config
end

.default_configObject



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

def self.default_config
  {
    method_missing_enabled:    true,
    arity_check_enabled:       false,
    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



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

def self.reset!
  @config = nil
end