Class: JS::RequireRemote::Evaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/js/require_remote/evaluator.rb

Overview

Execute the body of the response and record the URL.

Instance Method Summary collapse

Instance Method Details

#evaluate(code, filename, final_url) ⇒ Object



5
6
7
8
# File 'lib/js/require_remote/evaluator.rb', line 5

def evaluate(code, filename, final_url)
  Kernel.eval(code, ::Object::TOPLEVEL_BINDING, filename)
  $LOADED_FEATURES << final_url
end

#evaluated?(url) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/js/require_remote/evaluator.rb', line 10

def evaluated?(url)
  $LOADED_FEATURES.include?(url)
end