Sha256: e2ed95dcebdac0e8131e29a9a8dd685599aaab6820d5594c47eef1b06b8d95f5
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
module WebConsole class View < Window def do_javascript_function(function, arguments = nil) javascript = self.class.javascript_function(function, arguments) return do_javascript(javascript) end def self.javascript_function(function, arguments = nil) function = function.dup function << '(' if arguments arguments.each { |argument| if argument function << argument.javascript_argument else function << "null" end function << ', ' } function = function[0...-2] end function << ');' return function end private class ::String def javascript_argument return "'#{self.javascript_escape}'" end def javascript_escape self.gsub('\\', "\\\\\\\\").gsub("\n", "\\\\n").gsub("'", "\\\\'") end def javascript_escape! replace(self.javascript_escape) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webconsole-0.1.18 | lib/webconsole/lib/view/javascript.rb |
webconsole-0.1.17 | lib/webconsole/lib/view/javascript.rb |