Created
June 19, 2009 11:06
-
-
Save jschementi/132558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'Microsoft.Scripting, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | |
rescue | |
require 'Microsoft.Scripting, Version=2.0.5.0, Culture=neutral, PublicKeyToken=null' | |
end | |
include Microsoft::Scripting | |
include Microsoft::Scripting::Hosting | |
def python(str, type = :file) | |
@python_engine ||= DynamicApplication.Current.Runtime. | |
GetEngine("IronPython") | |
@python_scope ||= @python_engine.CreateScope() | |
@python_engine. | |
CreateScriptSourceFromString(str.strip, SourceCodeKind.send(type)). | |
Execute(@python_scope) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment