module Selenium::WebDriver::Atoms

def atom_script(function_name)

def atom_script(function_name)
  format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
         atom: read_atom(function_name))
end

def execute_atom(function_name, *)

def execute_atom(function_name, *)
  execute_script(atom_script(function_name), *)
end

def read_atom(function)

def read_atom(function)
  File.read(File.expand_path("../atoms/#{function}.js", __FILE__))
end