Module: IRuby::Utils
- Included in:
- IRuby
- Defined in:
- lib/iruby/utils.rb
Instance Method Summary collapse
- 
  
    
      #clear_output(wait = false)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Clear the output area. 
- #convert(object, options) ⇒ Object
- 
  
    
      #display(obj, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Display the object. 
- 
  
    
      #html(s)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Treat the given string as HTML. 
- 
  
    
      #javascript(s)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Treat the given string as JavaScript code. 
- 
  
    
      #latex(s)  ⇒ Object 
    
    
      (also: #tex)
    
  
  
  
  
  
  
  
  
  
    Treat the given string as LaTeX text. 
- 
  
    
      #math(s)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Format the given string of TeX equation into LaTeX text. 
- 
  
    
      #svg(s)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Treat the given string as SVG text. 
- 
  
    
      #table(s, **options)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Format the given object into HTML table. 
Instance Method Details
#clear_output(wait = false) ⇒ Object
Clear the output area
| 18 19 20 | # File 'lib/iruby/utils.rb', line 18 def clear_output(wait=false) Display.clear_output(wait) end | 
#convert(object, options) ⇒ Object
| 3 4 5 | # File 'lib/iruby/utils.rb', line 3 def convert(object, ) Display.convert(object, ) end | 
#display(obj, options = {}) ⇒ Object
Display the object
| 8 9 10 11 12 13 14 15 | # File 'lib/iruby/utils.rb', line 8 def display(obj, = {}) Kernel.instance.session.send(:publish, :display_data, data: Display.display(obj, ), metadata: {}) unless obj.nil? # The next `nil` is necessary to prevent unintentional displaying # the result of Session#send nil end | 
#html(s) ⇒ Object
Treat the given string as HTML
| 39 40 41 | # File 'lib/iruby/utils.rb', line 39 def html(s) convert(s, mime: 'text/html') end | 
#javascript(s) ⇒ Object
Treat the given string as JavaScript code
| 44 45 46 | # File 'lib/iruby/utils.rb', line 44 def javascript(s) convert(s, mime: 'application/javascript') end | 
#latex(s) ⇒ Object Also known as: tex
Treat the given string as LaTeX text
| 28 29 30 | # File 'lib/iruby/utils.rb', line 28 def latex(s) convert(s, mime: 'text/latex') end | 
#math(s) ⇒ Object
Format the given string of TeX equation into LaTeX text
| 34 35 36 | # File 'lib/iruby/utils.rb', line 34 def math(s) convert("$$#{s}$$", mime: 'text/latex') end | 
#svg(s) ⇒ Object
Treat the given string as SVG text
| 49 50 51 | # File 'lib/iruby/utils.rb', line 49 def svg(s) convert(s, mime: 'image/svg+xml') end |