Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 42 lines (32 sloc) 0.988 kB
a10421a @Watson1978 moved the files from MacRuby's repository
Watson1978 authored
1 //
2 // MyController.m
3 // EmbeddedMacRuby
4 //
5 // Created by Laurent Sansonetti on 10/7/08.
6 // Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "MyController.h"
10 #import <MacRuby/MacRuby.h>
11
12 @implementation MyController
13
14 - (void)awakeFromNib
15 {
16 NSFont *niceFont;
17
18 niceFont = [NSFont fontWithName:@"Monaco" size:14.0];
19 [expressionTextView setFont:niceFont];
20 [resultTextView setFont:niceFont];
21
22 [expressionTextView setString:@"(0..42).to_a"];
23 }
24
25 - (IBAction)evaluate:(id)sender
26 {
27 @try {
28 id object;
29
30 object = [[MacRuby sharedRuntime] evaluateString:[expressionTextView string]];
31 [resultTextView setString:[object description]];
32 }
33 @catch (NSException *exception) {
34 NSString *string = [NSString stringWithFormat:@"%@: %@\n%@", [exception name], [exception reason],
35 [[[exception userInfo] objectForKey:@"backtrace"] description]];
36 [resultTextView setString:string];
37 }
38 }
39
40
41 @end
Something went wrong with that request. Please try again.