<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:series="http://unfoldingneurons.com/" version="2.0">

<channel>
	<title>Man With Code</title>
	
	<link>http://manwithcode.com</link>
	<description>Teaching You, One Tutorial at a Time</description>
	<lastBuildDate>Wed, 11 Aug 2010 02:52:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ManWithCode" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="manwithcode" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Making Games With Ruby – Episode 9 Written</title>
		<link>http://manwithcode.com/411/making-games-with-ruby-episode-9-written/</link>
		<comments>http://manwithcode.com/411/making-games-with-ruby-episode-9-written/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 02:52:10 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=411</guid>
		<description><![CDATA[Episode nine of the Making Games With Ruby series, Game States (Title, About, and Pause), is finally written! This episode has us implementing game states, which lays the foundation for our Pause, Title, and About screens, which we also implement in this episode. You can read it here: http://devel.manwithcode.com/making-games-with-ruby.html#7 This one is probably the longest [...]]]></description>
			<content:encoded><![CDATA[<p>Episode nine of the Making Games With Ruby series, Game States (Title, About, and Pause), is finally written! This episode has us implementing game states, which lays the foundation for our Pause, Title, and About screens, which we also implement in this episode. You can read it here: <a title="Making Games With Ruby Ep. 9 - Game States (Title, About, and Pause)" href="http://devel.manwithcode.com/making-games-with-ruby.html#7">http://devel.manwithcode.com/making-games-with-ruby.html#7</a></p>
<p>This one is probably the longest episode in the entire series (at least so far), which is why it&#8217;s taken me a bit longer to finish. (I&#8217;m still not 100% sure I&#8217;ve caught every mistake, so if you see any code errors or script typos, don&#8217;t hesitate to email me, or leave a comment here).</p>
<p>Enjoy! <img src='http://manwithcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>- Tyler</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/411/making-games-with-ruby-episode-9-written/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Making Games With Ruby – Episode 8 Written</title>
		<link>http://manwithcode.com/407/making-games-with-ruby-episode-8-written/</link>
		<comments>http://manwithcode.com/407/making-games-with-ruby-episode-8-written/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 20:12:31 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=407</guid>
		<description><![CDATA[Episode eight of Making Games With Ruby, Winning and Playing Again, is written! This one&#8217;s a pretty short and easy episode, but it&#8217;s still a good one! You can read it here: http://devel.manwithcode.com/making-games-with-ruby.html#6 Have fun! - Tyler]]></description>
			<content:encoded><![CDATA[<p>Episode eight of Making Games With Ruby, Winning and Playing Again, is written! This one&#8217;s a pretty short and easy episode, but it&#8217;s still a good one! You can read it here: <a title="Making Games With Ruby Ep. 8 - Winning and Playing Again" href="http://devel.manwithcode.com/making-games-with-ruby.html#6">http://devel.manwithcode.com/making-games-with-ruby.html#6</a></p>
<p>Have fun! <img src='http://manwithcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>- Tyler</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/407/making-games-with-ruby-episode-8-written/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Games With Ruby – Episode 7 Written</title>
		<link>http://manwithcode.com/404/making-games-with-ruby-episode-7-written/</link>
		<comments>http://manwithcode.com/404/making-games-with-ruby-episode-7-written/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 02:26:21 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=404</guid>
		<description><![CDATA[Episode seven of Making Games With Ruby, Keeping Score, has been written. You can get to it from this link: http://devel.manwithcode.com/making-games-with-ruby.html#5 This episode has text drawing and players scoring on each other, I hope you like it - Tyler]]></description>
			<content:encoded><![CDATA[<p>Episode seven of Making Games With Ruby, Keeping Score, has been written. You can get to it from this link: <a title="Making Games With Ruby Ep. 7 - Keeping Score" href="http://devel.manwithcode.com/making-games-with-ruby.html#5">http://devel.manwithcode.com/making-games-with-ruby.html#5</a></p>
<p>This episode has text drawing and players scoring on each other, I hope you like it <img src='http://manwithcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>- Tyler</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/404/making-games-with-ruby-episode-7-written/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Games With Ruby – Episode 6 Written</title>
		<link>http://manwithcode.com/401/making-games-with-ruby-episode-6-written/</link>
		<comments>http://manwithcode.com/401/making-games-with-ruby-episode-6-written/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 04:28:16 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=401</guid>
		<description><![CDATA[Episode six of Making Games With Ruby, The Ball, is written, online, and available at this link: http://devel.manwithcode.com/making-games-with-ruby.html#4 This episode has the ball boucing off the sides of the screen and the paddles, so it&#8217;s pretty cool, I hope you like it! - Tyler]]></description>
			<content:encoded><![CDATA[<p>Episode six of Making Games With Ruby, The Ball, is written, online, and available at this link: <a title="Making Games With Ruby Ep. 6 - The Ball" href="http://devel.manwithcode.com/making-games-with-ruby.html#4">http://devel.manwithcode.com/making-games-with-ruby.html#4</a></p>
<p>This episode has the ball boucing off the sides of the screen and the paddles, so it&#8217;s pretty cool, I hope you like it! <img src='http://manwithcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>- Tyler</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/401/making-games-with-ruby-episode-6-written/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Games With Ruby – Episode 5 Written</title>
		<link>http://manwithcode.com/389/making-games-with-ruby-episode-5-written/</link>
		<comments>http://manwithcode.com/389/making-games-with-ruby-episode-5-written/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 03:09:18 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=389</guid>
		<description><![CDATA[Episode five of Making Games With Ruby, Input and Movement, is all written up and available at this link: http://devel.manwithcode.com/making-games-with-ruby.html#3 Enjoy! - Tyler]]></description>
			<content:encoded><![CDATA[<p>Episode five of Making Games With Ruby, Input and Movement, is all written up and available at this link: <a title="Making Games With Ruby Ep. 5 - Input and Movement" href="http://devel.manwithcode.com/making-games-with-ruby.html#3">http://devel.manwithcode.com/making-games-with-ruby.html#3</a></p>
<p>Enjoy!</p>
<p>- Tyler</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/389/making-games-with-ruby-episode-5-written/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>And I’m Back!</title>
		<link>http://manwithcode.com/393/and-im-back/</link>
		<comments>http://manwithcode.com/393/and-im-back/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 01:47:24 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=393</guid>
		<description><![CDATA[So you know that Making Games With Ruby series that I&#8217;ve been neglecting for a while? I&#8217;m working on it again! So here&#8217;s what you need to know: I&#8217;ve decided to write the entire series before I make any more videos You can see a text version of the tutorials here: http://devel.manwithcode.com/making-games-with-ruby.html (so far I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/SgBXWn2AmZQ&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/SgBXWn2AmZQ&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>So you know that Making Games With Ruby series that I&#8217;ve been neglecting for a while? I&#8217;m working on it again!</p>
<p>So here&#8217;s what you need to know:</p>
<ul>
<li>I&#8217;ve decided to write the entire series before I make any more videos</li>
<li>You can see a text version of the tutorials here: <a title="Making Games With Ruby" href="http://devel.manwithcode.com/making-games-with-ruby.html">http://devel.manwithcode.com/making-games-with-ruby.html</a> (so far I&#8217;ve gotten through episode 4)</li>
<li>If you see anything I say that&#8217;s wrong, is confusing, needs more explanation, or if there&#8217;s any code that doesn&#8217;t work, tell me about it and I&#8217;ll fix it as soon as I can</li>
</ul>
<p>Sorry for the wait, and I hope you like the tutorials!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/393/and-im-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade Successful</title>
		<link>http://manwithcode.com/387/upgrade-successful/</link>
		<comments>http://manwithcode.com/387/upgrade-successful/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 00:39:52 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=387</guid>
		<description><![CDATA[Upgrade to WordPress 3 appears to be a success, let me know if you see anything that&#8217;s not working right.]]></description>
			<content:encoded><![CDATA[<p>Upgrade to WordPress 3 appears to be a success, let me know if you see anything that&#8217;s not working right.</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/387/upgrade-successful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading the Site</title>
		<link>http://manwithcode.com/385/upgrading-the-site/</link>
		<comments>http://manwithcode.com/385/upgrading-the-site/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 00:34:26 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=385</guid>
		<description><![CDATA[I&#8217;m upgrading manwithcode.com to WordPress 3, if the site goes down, or malfunctions, give it a few minutes and it should be back to normal.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m upgrading manwithcode.com to WordPress 3, if the site goes down, or malfunctions, give it a few minutes and it should be back to normal.</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/385/upgrading-the-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apology</title>
		<link>http://manwithcode.com/371/apology/</link>
		<comments>http://manwithcode.com/371/apology/#comments</comments>
		<pubDate>Tue, 11 May 2010 03:17:22 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[apology]]></category>
		<category><![CDATA[sorry]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=371</guid>
		<description><![CDATA[Covered In This Episode I&#8217;m sorry Why I&#8217;ve been gone Making Games with Ruby update Thank you donators!]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/xNg9OkphKGY&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/xNg9OkphKGY&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Covered In This Episode</strong></p>
<ul>
<li>I&#8217;m sorry</li>
<li>Why I&#8217;ve been gone</li>
<li>Making Games with Ruby update</li>
<li>Thank you donators!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/371/apology/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sorry…</title>
		<link>http://manwithcode.com/367/sorry/</link>
		<comments>http://manwithcode.com/367/sorry/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 00:38:40 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=367</guid>
		<description><![CDATA[I posted a couple days ago that I thought I could get some new videos out, turns out I won&#8217;t be able to. Sorry if I got anyone&#8217;s hopes up.]]></description>
			<content:encoded><![CDATA[<p>I posted a couple days ago that I thought I could get some new videos out, turns out I won&#8217;t be able to. Sorry if I got anyone&#8217;s hopes up.</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/367/sorry/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Update 3/14/2010</title>
		<link>http://manwithcode.com/365/update-3142010/</link>
		<comments>http://manwithcode.com/365/update-3142010/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 01:19:49 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=365</guid>
		<description><![CDATA[I&#8217;m hoping to get some new episodes out in the Making Games with Ruby series sometime this week, no promises, but I figured I would let everyone know that I haven&#8217;t disappeared!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m hoping to get some new episodes out in the Making Games with Ruby series sometime this week, no promises, but I figured I would let everyone know that I haven&#8217;t disappeared!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/365/update-3142010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Games with Ruby Ep. 3 – Basics</title>
		<link>http://manwithcode.com/322/making-games-with-ruby-ep-3-basics/</link>
		<comments>http://manwithcode.com/322/making-games-with-ruby-ep-3-basics/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 23:58:06 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[basics window games rubygame ruby]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=322</guid>
		<description><![CDATA[Covered In This Episode: Creating a Window Basic Event Handling Transcript: Hello Everybody and welcome to making games with Ruby episode 3, Basics. I&#8217;m Tyler and these videos are brought to you by manwithcode.com. Today we&#8217;re just going to be talking about the very basics of game creation, just getting a window on the screen. [...]]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/rcsNp8deJVs&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/rcsNp8deJVs&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Covered In This Episode:</strong></p>
<ul>
<li>Creating a Window</li>
<li>Basic Event Handling</li>
</ul>
<p><strong>Transcript:</strong></p>
<p>Hello Everybody and welcome to making games with Ruby episode 3, Basics. I&#8217;m Tyler and these videos are brought to you by manwithcode.com.</p>
<p>Today we&#8217;re just going to be talking about the very basics of game creation, just getting a window on the screen. The code for this episode is on manwithcode.com, if you&#8217;re not there already. <a title="Making Games with Ruby Episode 3 - Basics" href="http://manwithcode.com/322/making-games-with-ruby-ep-3-basics">http://manwithcode.com/322/making-games-with-ruby-ep-3-basics</a></p>
<p>Lets get started!</p>
<p>We&#8217;re going to start by requiring in the libraries we need, which for now is only rubygems and rubygame:</p>
<pre class="brush: ruby;">
require 'rubygems'
require 'rubygame'
</pre>
<p>Then we&#8217;re going to create the main Game class, and stub out all the methods in it:</p>
<pre class="brush: ruby;">
class Game
	def initialize
	end

	def run!
	end

	def update
	end

	def draw
	end
end
</pre>
<p>And after that we&#8217;re going to add the code to run the game:</p>
<pre class="brush: ruby;">
g = Game.new
g.run!
</pre>
<p>So far this is just some very basic structure, nothing really happens yet. I&#8217;m going to run the code just to double check we have no syntax errors&#8230;</p>
<p>The first thing we&#8217;re going to do is initialize everything we&#8217;ll need:</p>
<pre class="brush: ruby;">
def initialize
	@screen = Rubygame::Screen.new [640, 480], 0, [Rubygame::HWSURFACE, Rubygame::DOUBLEBUF]
	@screen.title = &quot;Pong&quot;

	@queue = Rubygame::EventQueue.new
	@clock = Rubygame::Clock.new
	@clock.target_framerate = 60
end
</pre>
<p>Some of this is self explaitory, but let&#8217;s break it down. The first line of <code>initialize</code> creates the window for our game, Rubygame calls this a Screen. The first argument <code>[640, 480]</code> is the size of the screen, the second is the screen depth (you don&#8217;t need to worry about this), the last one is a list of flags we pass to rubygame. HWSURFACE means we want it to be accelerated on the graphics card if available, and DOUBLEBUF means we want the screen to be double buffered. Double buffering is a way of drawing to the screen. I won&#8217;t go into too much detail right now to explain double buffering, but I will in a later episode.</p>
<p>The second line has an obvious purpose, it sets the title at the top of the screen to Pong</p>
<p>The fifth line is setup so we can handle events, I&#8217;ll talk more about this later.</p>
<p>The last two lines are the setup so we can limit the framerate to 60 frames per second. The frame rate is how many times the screen is drawn every second (we&#8217;ll be doing our drawing in the <code>Game#draw</code> method). If we let this go unchecked, our game will run as fast as possible which isn&#8217;t desireable since top speed will be different on different computers, and depending on what the game is doing at a particular moment in time. I think 60 is a good number, but we can easily change it later if we want.</p>
<p>Next we&#8217;re going to setup the main game loop:</p>
<pre class="brush: ruby;">
def run!
	loop do
		update
		draw
		@clock.tick
	end
end
</pre>
<p>This loops indefinately until we decide in a different part of the code to end the game. <code>@clock.tick</code> is what allows us to limit our framerate. You can now run the game, it should just be a black screen. You can see the title at the top, like we set in the initialize function.</p>
<p>But if you try to close the window&#8230; Nothing happens!!! To close it try pressing CTRL+C in the command prompt window, or you may have to go to the task manager and kill it from there. To fix this problem, we need to talk about the event queue.</p>
<p>We&#8217;re going to start by defining the <code>update</code> method:</p>
<pre class="brush: ruby;">
def update
	@queue.each do |ev|
		case ev
			when Rubygame::QuitEvent
				Rubygame.quit
				exit
		end
	end
end
</pre>
<p>Whenever the user gives us some input, presses a key, moves the mouse, etc. the Rubygame adds an event for this input onto the queue. We handle these events in our update method.</p>
<p><code>@queue.each</code> loops over each event, and we have a case statement that handles the event depending on the type. For closing the window, the event type is <code>Rubygame::QuitEvent</code>, which is generated whenever the user presses the close window button or ALT+F4.</p>
<p>Now if you run the game, the window should appear and you should be able to close it now! Yay!</p>
<p>This is the final source listing for this episode:</p>
<pre class="brush: ruby;">
require 'rubygems'
require 'rubygame'

class Game
	def initialize
		@screen = Rubygame::Screen.new [640, 480], 0, [Rubygame::HWSURFACE, Rubygame::DOUBLEBUF]
		@screen.title = &amp;quot;Pong&amp;quot;

		@queue = Rubygame::EventQueue.new
		@clock = Rubygame::Clock.new
		@clock.target_framerate = 60
	end

	def run!
		loop do
			update
			draw
			@clock.tick
		end
	end

	def update
		@queue.each do |ev|
			case ev
				when Rubygame::QuitEvent
					Rubygame.quit
					exit
			end
		end
	end

	def draw
	end
end

g = Game.new
g.run!
</pre>
<p>This brings us to the end of the episode.</p>
<p>If you have any questions, comments, or suggestions, leave a comment on this page or email me at tyler@manwithcode.com.</p>
<p>Thank you very much for watching! Goodbye!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/322/making-games-with-ruby-ep-3-basics/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<series:name><![CDATA[Making Games With Ruby]]></series:name>
	</item>
		<item>
		<title>Making Games with Ruby Ep. 2 – Setup</title>
		<link>http://manwithcode.com/310/making-games-with-ruby-ep-2-setup/</link>
		<comments>http://manwithcode.com/310/making-games-with-ruby-ep-2-setup/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 00:06:26 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[setup rubygame windows mac linux]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=310</guid>
		<description><![CDATA[Windows: gem install rubygame Mac: Linux: sudo apt-get install -y libsdl1.2debian libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-gfx1.2-4 libsdl-gfx1.2-dev sudo gem install rubygame Links: Rubygame Installation guides Rubygame windows dependencies Covered in This Episode: How to get set up for this series on Windows, Mac, and Linux]]></description>
			<content:encoded><![CDATA[<p><strong>Windows:</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/zJgyefzctRg&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/zJgyefzctRg&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<pre class="brush: plain;">
gem install rubygame
</pre>
<p><strong>Mac:</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/URGqLBfcI5A&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/URGqLBfcI5A&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Linux:</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/aq0LGlMrQgM&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/aq0LGlMrQgM&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<pre class="brush: plain;">
sudo apt-get install -y libsdl1.2debian libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-gfx1.2-4 libsdl-gfx1.2-dev

sudo gem install rubygame
</pre>
<p><strong>Links:</strong></p>
<ul>
<li><a title="Rubygame installation guides" href="http://rubygame.org/wiki/Installation_Instructions">Rubygame Installation guides</a></li>
<li><a title="Rubygame windows dependancies" href="http://manwithcode.com/wp-content/uploads/2009/11/rubygame-deps.zip">Rubygame windows dependencies</a></li>
</ul>
<p><strong>Covered in This Episode:</strong></p>
<ul>
<li>How to get set up for this series on Windows, Mac, and Linux</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/310/making-games-with-ruby-ep-2-setup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<series:name><![CDATA[Making Games With Ruby]]></series:name>
	</item>
		<item>
		<title>Making Games With Ruby Ep. 1 – Intro</title>
		<link>http://manwithcode.com/299/making-games-with-ruby-ep-1-intro/</link>
		<comments>http://manwithcode.com/299/making-games-with-ruby-ep-1-intro/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 22:02:31 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[intro]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=299</guid>
		<description><![CDATA[Links: Programming with Ruby Video Tutorials Covered In This Episode: What you&#8217;ll learn What we&#8217;re using What I&#8217;m assuming about you Why I&#8217;m teaching this Transcript: Hello Everybody, and Welcome to the first episode of Making Games With Ruby! I&#8217;m Tyler, and this video is brought to you by manwithcode.com In this episode I&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/QnXPUEXKrzg&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/QnXPUEXKrzg&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Links:</strong></p>
<ul>
<li><a title="Programming With Ruby - Man With Code" href="http://manwithcode.com/ruby-programming-tutorials/">Programming with Ruby Video Tutorials</a></li>
</ul>
<p><strong>Covered In This Episode:</strong></p>
<ul>
<li>What you&#8217;ll learn</li>
<li>What we&#8217;re using</li>
<li>What I&#8217;m assuming about you</li>
<li>Why I&#8217;m teaching this</li>
</ul>
<p><strong>Transcript:</strong></p>
<p>Hello Everybody, and Welcome to the first episode of Making Games With Ruby! I&#8217;m Tyler, and this video is brought to you by manwithcode.com</p>
<p>In this episode I&#8217;ll be covering what you will be learning in this series, what we&#8217;re using to develop our games, what I&#8217;m assuming about you, and why I&#8217;m teaching you.</p>
<p><strong>What you&#8217;ll learn</strong></p>
<p>If you couldn&#8217;t tell by the title, you&#8217;re going to learn how to make games using the Ruby programming language. More specifically I&#8217;m going to teach you how to make Pong. Though Pong may sound a little simplistic, and I&#8217;m not claiming it isn&#8217;t, learning how to make Pong will teach you almost everything you&#8217;ll need to know to make any game, with out getting bogged down in game specific details.<strong></strong></p>
<p><strong>What we&#8217;re using</strong></p>
<p>Of course we&#8217;re using the Ruby programming language. To create games, we&#8217;ll have the help of the Rubygame library, which is many things including a wrapper around SDL, and a nice framework for developing games.</p>
<p>In the creation of this series I will be using Ruby 1.8.7-p174, and Rubygame 2.6.2. Theoretically The code in this series should run on Ruby 1.8.whatever and Rubygame 2.whatever, no promises though, since languages and libraries change.</p>
<p>And if you want to know about my environment, I&#8217;ll be running Ubuntu 9.10 as my Operating System, and using Gedit as my text editor. You can write and run the code on any platform you wish, but this is what I prefer.</p>
<p><strong>What I&#8217;m assuming about you</strong></p>
<p>So I don&#8217;t have to explain every line of code to you, I&#8217;m going to be assuming that you already know the Ruby programming language. If you don&#8217;t there are many books available, as well as my own video series Programming With Ruby at http://manwithcode.com/ruby-programming-tutorials/</p>
<p>Just reading one book, or watching my video series probably isn&#8217;t enough. I&#8217;ll be easier if you have used Ruby for a while, and are comfortable with it. This isn&#8217;t<br />
a requirement, but it would help make things easier on yourself.</p>
<p><strong>Why I&#8217;m teaching this</strong></p>
<p>There are many reasons why, but I&#8217;ll talk about the most important few:</p>
<p>1) I love making games.<br />
2) I love teaching.<br />
3) Teaching teaches me something. &#8211; When you actually sit down and think about what you do, things become more concrete, and you know why you do what you do, or even see bad habits that you need to correct<br />
4) I&#8217;m trying to make money &#8211; Yep, I&#8217;m not going to try and hide this. Some of the videos in this series will be put up for sale, you&#8217;ll be able to see them as I put out more videos.</p>
<p>Thank you very much for watching! I&#8217;ll see you in the next video.</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/299/making-games-with-ruby-ep-1-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Making Games With Ruby]]></series:name>
	</item>
		<item>
		<title>Announcing: Making Games with Ruby</title>
		<link>http://manwithcode.com/287/announcing-making-games-with-ruby/</link>
		<comments>http://manwithcode.com/287/announcing-making-games-with-ruby/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 01:20:39 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Making Games With Ruby]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=287</guid>
		<description><![CDATA[Making Games with Ruby is the next video series!]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ENmkaga2CQ8&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/ENmkaga2CQ8&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Making Games with Ruby is the next video series!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/287/announcing-making-games-with-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Update – 9/28/2009</title>
		<link>http://manwithcode.com/279/update-9282009/</link>
		<comments>http://manwithcode.com/279/update-9282009/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 21:09:13 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=279</guid>
		<description><![CDATA[Updates on the status of Man With Code, what&#8217;s been going on, what&#8217;s to come.]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/jmTcQsbr840&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/jmTcQsbr840&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Updates on the status of Man With Code, what&#8217;s been going on, what&#8217;s to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/279/update-9282009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Leave Feedback Here) Programming With Ruby Feedback</title>
		<link>http://manwithcode.com/235/leave-feedback-here-programming-with-ruby-feedback/</link>
		<comments>http://manwithcode.com/235/leave-feedback-here-programming-with-ruby-feedback/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 09:08:03 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Ruby Programming]]></category>
		<category><![CDATA[1000 comments]]></category>
		<category><![CDATA[feedback]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=235</guid>
		<description><![CDATA[Leave your feedback for the 1000 comments on the Programming With Ruby series]]></description>
			<content:encoded><![CDATA[<p>Leave your feedback for the  1000 comments on the Programming With Ruby series</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/235/leave-feedback-here-programming-with-ruby-feedback/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<series:name><![CDATA[Ruby Programming]]></series:name>
	</item>
		<item>
		<title>Programming With Ruby, Feedback</title>
		<link>http://manwithcode.com/233/programming-with-ruby-feedback/</link>
		<comments>http://manwithcode.com/233/programming-with-ruby-feedback/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 09:06:29 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Ruby Programming]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[feedback]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=233</guid>
		<description><![CDATA[Links: Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&#38;hosted_button_id=4222118 Submit This Link: http://manwithcode.com/ruby-programming-tutorials/ Vote: http://manwithcode.com/tutorials-under-consideration/ Leave Feedback Here: http://manwithcode.com/235/leave-feedback-here-programming-with-ruby-feedback/ Covered In This Episode: $1000 or 1000 comments Submit to Social Media Transcript: Hello Everybody and welcome to Programming With Ruby, Feedback. I&#8217;m Tyler, and this video is brought to you by manwithcode.com. In this video I&#8217;m going to be going over [...]]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Dil0aCdk898&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/Dil0aCdk898&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Links:</strong></p>
<ul>
<li>Donate:<a title="Donate to Man With Code" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=4222118"> https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=4222118</a></li>
<li>Submit This Link: <a title="All Programming With Ruby Episodes" href="http://manwithcode.com/ruby-programming-tutorials/">http://manwithcode.com/ruby-programming-tutorials/</a></li>
<li>Vote: <a title="Vote for the next series" href="http://manwithcode.com/tutorials-under-consideration/">http://manwithcode.com/tutorials-under-consideration/</a></li>
<li>Leave Feedback Here: <a title="Feedback for Programming With Ruby series" href="http://manwithcode.com/235/leave-feedback-here-programming-with-ruby-feedback/">http://manwithcode.com/235/leave-feedback-here-programming-with-ruby-feedback/</a></li>
</ul>
<p><strong>Covered In This Episode:</strong></p>
<ul>
<li>$1000 or 1000 comments</li>
<li>Submit to Social Media</li>
</ul>
<p><strong>Transcript:</strong></p>
<p>Hello Everybody and welcome to Programming With Ruby, Feedback. I&#8217;m<br />
Tyler, and this video is brought to you by manwithcode.com.</p>
<p>In this video I&#8217;m going to be going over what needs to happen for me<br />
to produce the next series of video tutorials.</p>
<p>All links I mention will be in the video description</p>
<p>First things first, if you head on over to<br />
<a title="Vote for the next series" href="http://manwithcode.com/tutorials-under-consideration/">http://manwithcode.com/tutorials-under-consideration/</a></p>
<p>You can vote on what the next video series will be.</p>
<p>So if you vote I will know what YOU want, now you need to know what I<br />
want for the next series to happen.</p>
<p>I&#8217;ve had well over 1,000 unique viewers of this video series, so I<br />
need you viewers to donate a total of $1000 before I make the next<br />
series. This may seem like a high amount, but if only 200 people<br />
donate $5, that is a thousand dollars.</p>
<p><a title="Donate to Man With Code" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=4222118"> </a>Donate:<a title="Donate to Man With Code" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=4222118"> https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=4222118</a></p>
<p>Now, what if you don&#8217;t have the money to donate? I will be making a<br />
post on manwithcode.com named Ruby Video Tutorial Feedback, if 1000<br />
people leave feedback (i.e. What they liked, what they didn&#8217;t like).</p>
<p>So whatever comes first, 1000 comments or $1000 will cause me to start<br />
the next video series.</p>
<p>For updates on how close we are to each goal, I will be on twitter at<br />
the account tylerjchurch and with the tag #manwithcode.</p>
<p>Now what if you can&#8217;t donate money, and you can&#8217;t write me feedback?<br />
Then there is something else you can do!<br />
<a title="All Programming With Ruby Episodes" href="http://manwithcode.com/ruby-programming-tutorials/">http://manwithcode.com/ruby-programming-tutorials/</a></p>
<ul>
<li> Tweet on Twitter</li>
<li> Give a thumbs up on StumbleUpon</li>
<li> Submit to Digg</li>
<li> Submit to Reddit</li>
<li> Bookmark on delicious</li>
<li> Blog about</li>
<li> or you can just Tell a friend</li>
</ul>
<p>And hopefully one of those people who come along will donate or leave<br />
feedback.</p>
<p>So don&#8217;t forget to donate, leave feedback, or submit the provided link<br />
to social media!</p>
<p>Thanks for watching, bye!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/233/programming-with-ruby-feedback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Ruby Programming]]></series:name>
	</item>
		<item>
		<title>Programming With Ruby Episode 18, Out Into The World</title>
		<link>http://manwithcode.com/227/programming-with-ruby-episode-18-out-into-the-world/</link>
		<comments>http://manwithcode.com/227/programming-with-ruby-episode-18-out-into-the-world/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 09:00:06 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Ruby Programming]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[moving on]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=227</guid>
		<description><![CDATA[Covered In This Episode: Where to go from here Books Libraries A few other things&#8230; Transcript: Hello Everybody and welcome to Programming With Ruby Episode 18, Out Into The World. I&#8217;m Tyler and this video is brought to you by manwithcode.com. In this episode I will be telling you where to go from here, now [...]]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/8jHsE27voRQ&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/8jHsE27voRQ&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Covered In This Episode:</strong></p>
<ul>
<li>Where to go from here</li>
<li>Books</li>
<li>Libraries</li>
<li>A few other things&#8230;</li>
</ul>
<p><strong>Transcript:</strong></p>
<p>Hello Everybody and welcome to Programming With Ruby Episode 18, Out<br />
Into The World. I&#8217;m Tyler and this video is brought to you by<br />
manwithcode.com.</p>
<p>In this episode I will be telling you where to go from here, now that<br />
you know the basics of Ruby. I&#8217;ll show you some books, some common<br />
libraries. And I&#8217;ll go over a few more things.</p>
<p><strong>Where to go from here </strong></p>
<p>Now that this series is almost done, you may be wondering what you<br />
should do. First, I recommend you start writing your own<br />
programs. Find something you would like to write and just try writing<br />
it.</p>
<p>You may also want to read a few other resources like books and online<br />
tutorials about Ruby for things I didn&#8217;t cover and to reinforce what<br />
you have learned.</p>
<p><strong>For books I would recommend:</strong></p>
<ul>
<li>Beginning Ruby, From Novice to Professional</li>
<li>The Ruby Programming Language</li>
</ul>
<p>If you are trying to make something, but can&#8217;t do it with Ruby alone,<br />
here are some libraries in a few common areas. I won&#8217;t be providing<br />
links, but a quick Google search will find them for you.</p>
<p><strong>Web Development</strong></p>
<ul>
<li>Ruby on Rails</li>
<li>Sinatra</li>
<li>Merb</li>
</ul>
<p><strong>Game Development</strong></p>
<ul>
<li>Rubygame</li>
<li>rubysdl</li>
<li>Gosu</li>
</ul>
<p><strong>Testing</strong></p>
<ul>
<li>rspec</li>
<li>cucumber</li>
</ul>
<p><strong>Images</strong></p>
<ul>
<li>RMagic</li>
</ul>
<p><strong>GUI Toolkits</strong></p>
<ul>
<li>Ruby-WxWidgets</li>
<li>Ruby-GNOME2</li>
<li>Shoes</li>
</ul>
<p>If you need a library for something I didn&#8217;t cover, you can check<br />
Ruby&#8217;s documentation at ruby-doc.org, you can try and find a project<br />
by searching at rubyforge.org and github.com. If all else fails, just<br />
Google it.</p>
<p>This is actually the end of the episode, but though this video is<br />
purported as the end of the series, there is going to be at least one<br />
more video, so stay tuned.</p>
<p>If you&#8217;ve liked this series, please donate!</p>
<p>If you have and questions, comments, or suggestions about this series<br />
or Man With Code, you can leave a comment on this page or email me at<br />
tyler@manwithcode.com</p>
<p>Thanks for watching, goodbye!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/227/programming-with-ruby-episode-18-out-into-the-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Ruby Programming]]></series:name>
	</item>
		<item>
		<title>Programming With Ruby Episode 17, Getting Advanced</title>
		<link>http://manwithcode.com/222/programming-with-ruby-episode-17-getting-advanced/</link>
		<comments>http://manwithcode.com/222/programming-with-ruby-episode-17-getting-advanced/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 08:56:27 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Ruby Programming]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[bindings]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[external]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[symbols]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=222</guid>
		<description><![CDATA[Covered In This Episode: Symbols eval Bindings Running Other Programs Safe Levels Transcript: Hello Everybody and welcome to Programming With Ruby Episode 17, Getting Advanced. I&#8217;m Tyler, and this video is brought to you by manwithcode.com. By now, you know a large amount about Ruby, so in this episode we will be going over some [...]]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/0dnHp7Yhbuo&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/0dnHp7Yhbuo&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Covered In This Episode:</strong></p>
<ul>
<li>Symbols</li>
<li>eval</li>
<li>Bindings</li>
<li>Running Other Programs</li>
<li>Safe Levels</li>
</ul>
<p><strong>Transcript:</strong></p>
<p>Hello Everybody and welcome to Programming With Ruby Episode 17,<br />
Getting Advanced. I&#8217;m Tyler, and this video is brought to you by<br />
manwithcode.com.</p>
<p>By now, you know a large amount about Ruby, so in this episode we will<br />
be going over some advanced features that Ruby has.</p>
<p>More specifically I will be teaching you what Symbols are, and when to<br />
use them. I will be showing you how to use eval, and how to use<br />
bindings with eval. You will learn how to run other programs from<br />
Ruby. Finally I will show you what safe levels are.</p>
<p>Lets get started!</p>
<p><strong>Symbols</strong></p>
<p>Symbols are a type of variable that are very much like strings, but<br />
more lightweight. Symbols look like this:</p>
<pre class="brush: ruby;">
:variable
</pre>
<p>Symbols can&#8217;t be manipulated like strings can, which seems like a huge<br />
drawback, but they do have a couple benefits.</p>
<p>Each time you use a string, to say access a hash. Ruby creates an<br />
instance of that string. Where if you use a symbol, it is only ever<br />
instanced once. Meaning that the use of symbols will take up less<br />
memory than strings will, if you are, say accessing a hash many times.</p>
<p>Symbols are also slightly easier to type since the colon is on the<br />
home row on US keyboards.</p>
<p><strong>eval</strong></p>
<p>eval is a way of running Ruby code that is contained in a string. For<br />
example, lets say you have a string that looks like this:</p>
<pre class="brush: ruby;">
&quot;puts 'Hello World'&quot;
</pre>
<p>It is just a simple string, so it does nothing. But, if you use the<br />
method eval on that string it will execute the code inside. So this<br />
will print Hello World! on to the screen:</p>
<pre class="brush: ruby;">
eval &quot;puts 'Hello World!'&quot;
</pre>
<p>This isn&#8217;t always useful, but you can use it if you want your users to<br />
be able to enter Ruby code into your program.</p>
<p>You can also pass bindings to eval. So if we had this method</p>
<pre class="brush: ruby;">
def my_method my_binding
    eval &quot;puts x&quot;, my_binding
end

x = 5
my_method binding
</pre>
<p>This outputs:</p>
<pre class="brush: plain;">
5
</pre>
<p>Some of you may notice that the variable x isn&#8217;t defined in the method <code>my_method</code>. By using the binding method, we can make variable scopes portable!</p>
<p><strong>Running Other Programs</strong></p>
<p>There comes a time when you will want to be able to run a program from<br />
Ruby, maybe you want to automate something, or simply get the output<br />
from an external program.</p>
<p>There are a few ways of doing this.</p>
<p>The first is with the method exec, which runs an external programs,<br />
and quits the Ruby script at the same time:</p>
<pre class="brush: ruby;">
exec('ls') # dir on windows
# Program never gets here
</pre>
<p>There is also system, which does the same thing, but doesn&#8217;t quit the<br />
Ruby script, and returns true or false if the program was successful:</p>
<pre class="brush: ruby;">
system('ls') # dir on windows
# we do get this far
</pre>
<p>Finally we have the &#8220;back-tick&#8221; `. Which looks like a sideways single<br />
quote. On my keyboard it is above the tab key. You surround your<br />
command in the back-ticks, like you would for a sting. Unlike the other<br />
two methods of running a program, this method also returns the output<br />
of the program you run.</p>
<pre class="brush: ruby;">
variable = `ls`
</pre>
<p><strong>Safe Levels</strong></p>
<p>If you are running a Ruby interpreter online or in another environment<br />
where users can enter in and run Ruby code. They hold the ability to<br />
wreak havoc on your system.</p>
<p>The way to prevent this from happening is by using safe levels. Safe<br />
levels are a way of preventing the user from getting access to the<br />
file system, or changing any variables that the program has.</p>
<p>You set safe levels by setting the $SAFE variable. By default it is<br />
set to zero.</p>
<pre class="brush: ruby;">
$SAFE = 4
</pre>
<p>Ruby &#8220;taints&#8221; objects that could be dangerous.</p>
<p>There are five different safe levels.<br />
0 =&gt; The default, you can do anything<br />
1 =&gt; Can&#8217;t use environment variable, eval, load, require, and more.<br />
2 =&gt; Same as above and also can&#8217;t use files<br />
3 =&gt; All objects created are tainted, can&#8217;t be untainted<br />
4 =&gt; You can do almost nothing&#8230; Can&#8217;t modify the untainted, can&#8217;t<br />
use exit. Basically completely safe and sand-boxed.</p>
<p>That brings us to the end of the episode. If you liked these videos,<br />
please donate. It costs me in both money and time to make them.</p>
<p>If you have any questions, comments, or suggestions please don&#8217;t<br />
hesitate to leave a comment on this page or email me at<br />
tyler@manwithcode.com</p>
<p>Thanks for watching, goodbye!</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/222/programming-with-ruby-episode-17-getting-advanced/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<series:name><![CDATA[Ruby Programming]]></series:name>
	</item>
	</channel>
</rss><!-- Dynamic page generated in 5.185 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-09-06 13:27:37 -->
