Class: MiniRacer::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_racer.rb,
lib/mini_racer/truffleruby.rb

Class Method Summary collapse

Class Method Details

.set_flag_as_str!(flag) ⇒ Object

Raises:

  • (TypeError)


335
336
337
338
339
# File 'lib/mini_racer/truffleruby.rb', line 335

def self.set_flag_as_str!(flag)
  raise TypeError, "wrong type argument #{flag.class} (should be a string)" unless flag.is_a?(String)
  raise MiniRacer::PlatformAlreadyInitialized, "The platform is already initialized." if Context.instance_variable_get(:@context_initialized)
  Context.instance_variable_set(:@use_strict, true) if "--use_strict" == flag
end

.set_flags!(*args, **kwargs) ⇒ Object



87
88
89
90
91
92
# File 'lib/mini_racer.rb', line 87

def set_flags!(*args, **kwargs)
  flags_to_strings([args, kwargs]).each do |flag|
    # defined in the C class
    set_flag_as_str!(flag)
  end
end