Skip to content

Commit ce39f78

Browse files
committed
Revert "Add MiniRacer::Platform.set_flags! for the truffleruby backend (rubyjs#326)"
* This reverts commit a268a2c. * Now it's defined in "shared" code like before.
1 parent 211e15f commit ce39f78

File tree

1 file changed

+4
-31
lines changed

1 file changed

+4
-31
lines changed

lib/mini_racer/truffleruby.rb

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -333,37 +333,10 @@ def idle_notification(idle_time)
333333
end
334334

335335
class Platform
336-
class << self
337-
def set_flags!(*args, **kwargs)
338-
flags_to_strings([args, kwargs]).each do |flag|
339-
set_flag_as_str!(flag)
340-
end
341-
end
342-
343-
private
344-
345-
def flags_to_strings(flags)
346-
flags.flatten.map { |flag| flag_to_string(flag) }.flatten
347-
end
348-
349-
# normalize flags to strings, and adds leading dashes if needed
350-
def flag_to_string(flag)
351-
if flag.is_a?(Hash)
352-
flag.map do |key, value|
353-
"#{flag_to_string(key)} #{value}"
354-
end
355-
else
356-
str = flag.to_s
357-
str = "--#{str}" unless str.start_with?('--')
358-
str
359-
end
360-
end
361-
362-
def set_flag_as_str!(flag)
363-
raise TypeError, "wrong type argument #{flag.class} (should be a string)" unless flag.is_a?(String)
364-
raise MiniRacer::PlatformAlreadyInitialized, "The platform is already initialized." if Context.instance_variable_get(:@context_initialized)
365-
Context.instance_variable_set(:@use_strict, true) if "--use_strict" == flag
366-
end
336+
def self.set_flag_as_str!(flag)
337+
raise TypeError, "wrong type argument #{flag.class} (should be a string)" unless flag.is_a?(String)
338+
raise MiniRacer::PlatformAlreadyInitialized, "The platform is already initialized." if Context.instance_variable_get(:@context_initialized)
339+
Context.instance_variable_set(:@use_strict, true) if "--use_strict" == flag
367340
end
368341
end
369342

0 commit comments

Comments
 (0)