ironruby / ironruby

Microsoft's Ruby language compiler that is built on top of the Dynamic Language Runtime.

This URL has Read+Write access

ironruby / Merlin / Main / Languages / Ruby / Samples / Tutorial / sl_tutorial.html
100644 70 lines (57 sloc) 1.903 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <title>IronRuby tutorial</title>
 
  <style type="text/css">
    html, body {
      height: 99%;
      overflow: auto;
    }
    body {
      padding: 0;
      margin: 0;
    }
    #silverlightControlHost {
      height: 100%;
    }
    #errorLocation {
      font-size: small;
      color: Gray;
    }
  </style>
 
  <script type="text/javascript">
    window.DLR = {}
    DLR.settings = {width: "100%", height: "100%", source: 'app.xap', background: 'white', windowless: 'true'}
  </script>
  <script type="text/javascript" src="js/dlr.js"></script>
 
  <!-- Force Python to be registered so it can be used in the tutorial -->
  <script type="text/python"></script>
</head>
 
<body>
 
  <!-- needed for testing -->
  <script type='text/ruby' src='test/silverlight.rb'></script>
  <script type='text/ruby' src='test/test_console.rb'></script>
  <script type='text/ruby' src='console_tutorial.rb'></script>
 
  <script type="text/ruby">
    include Microsoft::Scripting::Silverlight
 
    def load_assembly_from_path(path)
      DynamicApplication.current.runtime.host.platform_adaptation_layer.
      load_assembly_from_path(path)
    end
 
    # From Silverlight 3 SDK
    load_assembly_from_path "System.Windows.Controls.dll"
    require 'System.Windows.Controls'
 
    # From Silverlight 3 Toolkit
    load_assembly_from_path "System.Windows.Controls.Toolkit.dll"
    require 'System.Windows.Controls.Toolkit'
 
    require 'gui_tutorial'
    Application.Current.RootVisual = GuiTutorial::Window.current
 
    if document.query_string.keys.include?('test')
      $repl = Repl.show('ruby')
      $stdout = $repl.output_buffer
      $stderr = $repl.output_buffer
      require "test/silverlight"
    end
  </script>
 
</body>
</html>