Module: IRuby::Utils
- Included in:
- IRuby
- Defined in:
- lib/iruby/utils.rb
Instance Method Summary collapse
- #convert(object, options) ⇒ Object
- #display(obj, options = {}) ⇒ Object
- #html(s) ⇒ Object
- #javascript(s) ⇒ Object
- #latex(s) ⇒ Object (also: #tex)
- #math(s) ⇒ Object
- #svg(s) ⇒ Object
- #table(s, **options) ⇒ Object
Instance Method Details
#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
7 8 9 10 11 12 |
# File 'lib/iruby/utils.rb', line 7 def display(obj, = {}) Kernel.instance.session.send(:publish, :display_data, data: Display.display(obj, ), metadata: {}, source: 'ruby') unless obj.nil? end |
#html(s) ⇒ Object
27 28 29 |
# File 'lib/iruby/utils.rb', line 27 def html(s) convert(s, mime: 'text/html') end |
#javascript(s) ⇒ Object
31 32 33 |
# File 'lib/iruby/utils.rb', line 31 def javascript(s) convert(s, mime: 'application/javascript') end |
#latex(s) ⇒ Object Also known as: tex
18 19 20 |
# File 'lib/iruby/utils.rb', line 18 def latex(s) convert(s, mime: 'text/latex') end |
#math(s) ⇒ Object
23 24 25 |
# File 'lib/iruby/utils.rb', line 23 def math(s) convert("$$#{s}$$", mime: 'text/latex') end |
#svg(s) ⇒ Object
35 36 37 |
# File 'lib/iruby/utils.rb', line 35 def svg(s) convert(s, mime: 'image/svg+xml') end |