module IRuby::Utils
Public Instance Methods
Source
# File lib/iruby/utils.rb, line 18 def clear_output(wait=false) Display.clear_output(wait) end
Clear the output area
Source
# File lib/iruby/utils.rb, line 3 def convert(object, options) Display.convert(object, options) end
Source
# File lib/iruby/utils.rb, line 8 def display(obj, options = {}) Kernel.instance.session.send(:publish, :display_data, data: Display.display(obj, options), metadata: {}) unless obj.nil? # The next `nil` is necessary to prevent unintentional displaying # the result of Session#send nil end
Display
the object
Source
# File lib/iruby/utils.rb, line 39 def html(s) convert(s, mime: 'text/html') end
Treat the given string as HTML
Source
# File lib/iruby/utils.rb, line 44 def javascript(s) convert(s, mime: 'application/javascript') end
Treat the given string as JavaScript code
Source
# File lib/iruby/utils.rb, line 28 def latex(s) convert(s, mime: 'text/latex') end
Treat the given string as LaTeX
text
Also aliased as: tex
Source
# File lib/iruby/utils.rb, line 34 def math(s) convert("$$#{s}$$", mime: 'text/latex') end
Format the given string of TeX equation into LaTeX
text
Source
# File lib/iruby/utils.rb, line 49 def svg(s) convert(s, mime: 'image/svg+xml') end
Treat the given string as SVG text
Source
# File lib/iruby/utils.rb, line 23 def table(s, **options) html(HTML.table(s, **options)) end
Format the given object into HTML
table