- IronRuby の 活 用 -
祝 1.0 を 2010 年 4 月 にリリース
<head> <title>hello Active Script Ruby</title> <script language= "RubyScript" > @doc = @window.document おもしろい def click(btn) @doc.all(btn).value = btn + " is here" end </head> <body onload="@windows.alert 'Body is loaded!'" language= "RubyScript" > <input type= "button" id= "btn1" onclick= "click('btn1')" language= "RubyScript" > <input type= "button" id= "btn2" onclick= "@doc.all('btn2').value='btn2 is here'" language= "RubyScript" > </body> </html>
IronRuby on.net 2.0 IronRuby on.net 4 = > IronRuby on Silverlight
<head> <title>ハローワールド by Gestalt</title> <script type="text/javascript" src="http://gestalt.ironpython.net/dlr-latest.js"> </head> <body> <h1> 初 めてのゲシュタルト</h1> <script type="text/ruby"> window.alert "ルビーで 表 示 します" <script type="text/python"> window.alert("pythonで 表 示 します") </body> </html>
<script type="text/javascript" src="http://gestalt.ironpython.net/dlr-latest.js"> dlr.js
<script type="text/ruby"> window.alert "ルビーで 表 示 します" <script type="text/python"> window.alert("pythonで 表 示 します")
<script language= "RubyScript" > @doc = @window.document def click(btn) @doc.all(btn).value = btn + " is here" end <script type= "text/ruby" > window.alert "ルビーで 表 示 します" 似 てるよねー = おもしろくない?
<p>メッセージ:<input type="text" id="txtmessage" /></p> <input type="button" id="btnrun" value=" 実 行 します"/> <p> 結 果 :</p><div id="outarea1"></div><div id="outarea2"></div> <script type="text/ruby"> # イベントハンドラの 関 数 定 義 document.btnrun.onclick do s, e document.outarea1.html = document.txtmessage.value + "byruby" end # rubyでは innerhtml も html の 指 定 も 可 能 <script type="text/python"> def click(s, e): # イベントハンドラの 関 数 定 義 msg = document.txtmessage.value + " by Python" window.alert(msg) document.outarea2.innerhtml = document.txtmessage.value + " by Python" # イベントハンドラを 関 連 付 ける document.btnrun.events.onclick += click
<h1>ハローワールド 改 2</h1> <p>メッセージ:<input type="text" id="txtmessage" /></p> <input type="button" id="btnrun" value=" 実 行 します" /> <p> 結 果 :</p> <div id="outarea1" ></div><div id="outarea2" ></div> <script type="text/ruby" src="dlr/helloworld.rb"> <script type="text/python" src="dlr/helloworld.py"> # イベントハンドラの 関 数 定 義 (DLR/helloworld.rb) document.btnrun.onclick do s, e document.outarea1.html = document.txtmessage.value + " by ルビー" end
<script type="application/x-zip-compressed" src="ライブラリのzipファイル 名 "> <script type="text/ruby"> require アーカイブ/ライブラリ 名 " # Pythonであれば import アーカイブ.ライブラリ 名
<head> <title>ruby コンソール デバッグ 用 </title> <script type="text/javascript"> window.dlr = {settings: {console: true, debug: true}} <script type="text/javascript" src="http://gestalt.ironpython.net/dlr-latest.js" > </head> <body> <h1>デバッグ シナリオ</h1> <div id="message">loading...</div> <script type="text/ruby"> document.message.html = "こんにちは Rubyです!" </body>
<script type="application/xml+xaml" id="inlinexaml" width="400" height="400"> <Canvas xmlns="http://.../winfx/2006/xaml/presentation" xmlns:x="http://.../winfx/2006/xaml"> <TextBlock HorizontalAlignment="Center" Height="23" Width="Auto" FontSize="18" Text="ハローワールド XAML 版 "/> <TextBlock HorizontalAlignment="Right" Width="78" Height="23" Margin="10" Text="メッセージ:"/> <TextBox x:name="txtmessage" Width="248" Height="25" HorizontalAlignment="Center" /> <Button x:name="btnrun" HorizontalAlignment="Left" Width="93" Height="29" Content=" 実 行 します"/> <! 省 略 しています --> </Canvas>
<script type="application/xml+xaml" id="inlinexaml" width="400" height="400"> XAMLコンテンツを 記 述
<body> <h1>ハローワールド XAML 版 改 (Ruby)</h1> <script type="application/xml+xaml" id="externalxaml" src="dlr/helloworld.xaml" width="400" height="300"> <!-- ポイントは xamlタグのidをclassに 設 定 すること --> <script type="text/ruby" class="externalxaml"> root = xaml.hellocanvas root.txtmessage.text = "てすと" # イベントハンドラを 設 定 します root.btnrun.click { s,e root.outarea.text = root.txtmessage.text + " by ルビー" } </body>
html head body object silverlightdlrobject1 object silverlightdlrobject_domonly
<body> <h1>ハローワールド XAML 版 改 (Ruby)</h1> <script type="application/xml+xaml" id= "internalxaml" defer= true width= "400" height= "300" > XAMLを 記 述 <!-- ポイントは xamlタグのidをclassに 設 定 すること --> <script type="text/ruby" class= " internalxaml"> include Microsoft::Scripting::Silverlight app = DynamicApplication.Current root = app.loadrootvisualfromstring( document.externalxaml.innerhtml) root.txtmessage.text = "てすと" # イベントハンドラを 設 定 します root.btnrun.click { s,e root.outarea.text = root.txtmessage.text + " by ルビー" } </body>
defer= true
html dlr.js dlr.xap text/ ruby
type id src class defer width height application/xm l-xaml 必 須 オプション 不 要 オプション 必 須 text/python オプション XAML を 使 text/ruby 用 する 場 合 は 必 須 application/xzipcompressed 必 須 ( 拡 張 子 は zip) 不 要 不 要 ( 内 部 で は 1に 固 定 )
dlr.xap Appmanifest.xaml languages.config Microsoft.Scripting.slvx DynamicApplication ホスト 関 係 のアセンブリ IronPython.slvx 言 語 アセンブリ IronRuby.slvx 言 語 アセンブリ
Ruby などで Silverlight アプリを 開 発 でき る 環 境 を 実 現 したもの 組 合 わせは 自 由 です サーバー RoR クライアント RIA とか アイディア 次 第 で RIA ができます
じゃ なくて
http://gestalt.ironpython.net/dlrlatest.js http://visitmix.com/labs/gestalt/downloads /xaml.playground.html http://visitmix.com/labs/gestalt/ http://www.ironpython.net/browser/
http://ironpython.net/browser/docs.html http://www.silverlight.net/learn/dynamiclanguages/ http://ironpython.codeplex.com/ http://ironruby.codeplex.com/ http://gestalt.codeplex.com/
2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.