class Opal::Rewriters::OpalEngineCheck

Constants

RUBY_ENGINE_CHECK
RUBY_ENGINE_CHECK_NOT
RUBY_PLATFORM_CHECK
RUBY_PLATFORM_CHECK_NOT

Public Instance Methods

on_if(node) click to toggle source
Calls superclass method
# File lib/opal/rewriters/opal_engine_check.rb, line 8
def on_if(node)
  test, true_body, false_body = *node.children

  if skip_check_present?(test)
    process(true_body || s(:nil))
  elsif skip_check_present_not?(test)
    process(false_body || s(:nil))
  else
    super
  end
end
skip_check_present?(test) click to toggle source
# File lib/opal/rewriters/opal_engine_check.rb, line 20
def skip_check_present?(test)
  test == RUBY_ENGINE_CHECK || test == RUBY_PLATFORM_CHECK
end
skip_check_present_not?(test) click to toggle source
# File lib/opal/rewriters/opal_engine_check.rb, line 24
def skip_check_present_not?(test)
  test == RUBY_ENGINE_CHECK_NOT || test == RUBY_PLATFORM_CHECK_NOT
end