-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
144 lines (135 loc) · 6.07 KB
/
index.html
File metadata and controls
144 lines (135 loc) · 6.07 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>CPS323: Ruby Case Study</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
function toggleIt(element) {
var content = document.getElementById('content').childNodes;
for (var i = 0; i < content.length; i++) {
if (content[i].style) {
content[i].style.display = "none";
}
}
document.getElementById(element).style.display = "";
}
</script>
</head>
<body>
<div id="container">
<div id="logo">
<img src="logo.gif" alt="logo"/>
</div>
<div id="quote">
“Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write” (http://www.ruby-lang.org/, 2009).
</div>
<div id="nav">
<h2>About Ruby</h2>
<ul>
<li><a href="" onclick="toggleIt('reservedwords'); return false;">Purpose / Language Domain</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">History</a></li>
<li><a href="" onclick="toggleIt('onlinereferences'); return false;">Online References</a></li>
</ul>
<h2>Language Features</h2>
<ul>
<li><a href="" onclick="toggleIt('identifiers'); return false;">Identifiers</a></li>
<li><a href="" onclick="toggleIt('reservedwords'); return false;">Reserved Words</a></li>
<li><a href="" onclick="toggleIt('datatypes'); return false;">Data Types</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Data Structures</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Expressions</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Control Structures</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Input/Output Facilities</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Threading</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Networking</a></li>
<li><a href="" onclick="toggleIt('history'); return false;">Metaprogramming</a></li>
</ul>
<h2>Development</h2>
<ul>
<li><a href="" onclick="toggleIt('writingscripts'); return false;">Writing Scripts</a></li>
<li><a href="" onclick="toggleIt('interactiveruby'); return false;">Interactive Ruby (IRB)</a></li>
</ul>
</div>
<div id="content">
<div id="reservedwords" style="display: none;">
<h2>Reserved Words</h2>
<pre>
alias and BEGIN begin break case class def defined
do else elsif END end ensure false for if
in module next nil not or redo rescue retry
return self super then true undef unless until when
while yield
</pre>
</div>
<div id="history" style="display: none;">
<h2>History</h2>
<p>Ruby is a language of careful balance. Its creator, Yukihiro "matz" Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.</p>
<p>He has often said that he is "trying to make Ruby natural, not simple," in a way that mirrors life.</p>
<p>Building on this, he adds:</p>
<blockquote><p>"Ruby is simple in appearance, but is very complex inside, just like our human body."</p></blockquote>
<p>Ruby was conceived on February 24, 1993. Matsumoto wished to create a new language that balanced functional programming with imperative programming. According to Matsumoto he "wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language".</p>
</div>
<div id="onlinereferences" style="display: none;">
<h2>Online References</h2>
<ul>
<li><a href="http://www.ruby-lang.org/">Official Ruby Web Site</a></li>
<li><a href="http://www.ruby-lang.org/en/documentation/quickstart/">Official Ruby Quick Start Guide</a></li>
<li><a href="http://tryruby.hobix.com/">Interactive Ruby Tutorial</a></li>
<li><a href="http://poignantguide.net/ruby/">Why’s Poignant Guide to Ruby</a></li>
<li><a href="http://www.pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming">Screencasts teaching Metaprogramming with Ruby</a></li>
</ul>
</div>
<div id="identifiers" style="display: none;">
<h2>Identifiers</h2>
<p>Identifiers in Ruby consist of letters, digits, and the underscore character. Identifiers may start with either letters or an underscore. There is no restriction on length.</p>
<p>Examples:</p>
<pre>
foobar
ruby_is_simple
</pre>
</div>
<div id="datatypes" style="display: none;">
<h2>Data Types</h2>
<p>Simple and straight forward. Everything and their mom is an object. Everything has a class.</p>
<p>So all that stuff you learned with other languages? Yeah, forget that. Primitives? No more.</p>
<pre>
h = {"hash?" => "yep, it's a hash!", "the answer to everything" => 42}
puts "Stringy string McString!".class
puts 1.class
puts nil.class
puts h.class
puts :symbol.class
</pre>
</div>
<div id="datastructures" style="display: none;">
</div>
<div id="writingscripts" style="display: none;">
<h2>Writing Scripts</h2>
<p>
Use gedit on the linux workstations, because its light and has ruby syntax highlighting.
</p>
<p>
you can run stuff like this:
</p>
<p><code>
ruby script.rb
</code></p>
or declare the interpreter type within the script:
<p><code>
#! /usr/bin/ruby<br/>
puts "Hello World!"<br/>
</code></p>
and then (making the file executable) run it like an executable:
<p><code>
./script.rb
</code></p>
</div>
<div id="interactiveruby" style="display: none;">
<h2>Interactive Ruby (IRB)</h2>
<p>Interactive ruby is a useful tool for familiarizing yourself with ruby. All you need to do it type "<code>irb</code>" into the terminal and you're interactin' with ruby. BAM!</p>
</div>
</div>
</div>
</body>
</html>