<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Schandr9</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Schandr9"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Schandr9"/>
	<updated>2026-06-29T02:28:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67065</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67065"/>
		<updated>2012-10-04T01:26:42Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA wherein we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def method_missing(method_id)&lt;br /&gt;
                        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
                                self.send('euros')&lt;br /&gt;
                        else&lt;br /&gt;
                                super&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                def euros&lt;br /&gt;
                        ..&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
	&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
#http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
#http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
#http://rubymonk.com/&lt;br /&gt;
#http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
#http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67056</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67056"/>
		<updated>2012-10-04T01:24:12Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def method_missing(method_id)&lt;br /&gt;
                        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
                                self.send('euros')&lt;br /&gt;
                        else&lt;br /&gt;
                                super&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                def euros&lt;br /&gt;
                        ..&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
	&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
#http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
#http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
#http://rubymonk.com/&lt;br /&gt;
#http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
#http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67050</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67050"/>
		<updated>2012-10-04T01:23:46Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
&lt;br /&gt;
                def method_missing(method_id)&lt;br /&gt;
                        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
                                self.send('euros')&lt;br /&gt;
                        else&lt;br /&gt;
                                super&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                def euros&lt;br /&gt;
                        ..&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
	&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
#http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
#http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
#http://rubymonk.com/&lt;br /&gt;
#http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
#http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67045</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67045"/>
		<updated>2012-10-04T01:21:17Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def method_missing(method_id)&lt;br /&gt;
                        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
                                self.send('euros')&lt;br /&gt;
                        else&lt;br /&gt;
                                super&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                def euros&lt;br /&gt;
                        ..&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
	&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
#http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
#http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
#http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
#http://rubymonk.com/&lt;br /&gt;
#http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
#http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67040</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67040"/>
		<updated>2012-10-04T01:20:54Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def method_missing(method_id)&lt;br /&gt;
                        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
                                self.send('euros')&lt;br /&gt;
                        else&lt;br /&gt;
                                super&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                def euros&lt;br /&gt;
                        ..&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
	&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	#http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	#http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	#http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	#http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	#http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	#http://rubymonk.com/&lt;br /&gt;
	#http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	#http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67035</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67035"/>
		<updated>2012-10-04T01:19:57Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def method_missing(method_id)&lt;br /&gt;
                        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
                                self.send('euros')&lt;br /&gt;
                        else&lt;br /&gt;
                                super&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                def euros&lt;br /&gt;
                        ..&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
	&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67025</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67025"/>
		<updated>2012-10-04T01:17:29Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
		def method_missing(method_id)&lt;br /&gt;
			if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
				self.send('euros')&lt;br /&gt;
			else&lt;br /&gt;
				super&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		def euros&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67018</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67018"/>
		<updated>2012-10-04T01:15:52Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
	class Numeric&lt;br /&gt;
		def method_missing(method_id)&lt;br /&gt;
			if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
				self.send('euros')&lt;br /&gt;
			else&lt;br /&gt;
				super&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		def euros&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67014</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67014"/>
		<updated>2012-10-04T01:15:07Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown:&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
	class Numeric&lt;br /&gt;
		def method_missing(method_id)&lt;br /&gt;
			if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
				self.send('euros')&lt;br /&gt;
			else&lt;br /&gt;
				super&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		def euros&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67011</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67011"/>
		<updated>2012-10-04T01:14:30Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown:&lt;br /&gt;
Example:&lt;br /&gt;
	class Numeric&lt;br /&gt;
		def method_missing(method_id)&lt;br /&gt;
			if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
				self.send('euros')&lt;br /&gt;
			else&lt;br /&gt;
				super&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		def euros&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67004</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=67004"/>
		<updated>2012-10-04T01:12:44Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown:&lt;br /&gt;
Example:&lt;br /&gt;
	class Numeric&lt;br /&gt;
	        def method_missing(method_id)&lt;br /&gt;
        	        if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
	        	         self.send('euros')&lt;br /&gt;
	                else&lt;br /&gt;
		                 super&lt;br /&gt;
	                end&lt;br /&gt;
                 end&lt;br /&gt;
		def euros&lt;br /&gt;
		        ..&lt;br /&gt;
	        end&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66993</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66993"/>
		<updated>2012-10-04T01:11:08Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class, we can do it as shown:&lt;br /&gt;
Example:	&lt;br /&gt;
class Numeric&lt;br /&gt;
	def method_missing(method_id)&lt;br /&gt;
        	if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
	        	self.send('euros')&lt;br /&gt;
	        else&lt;br /&gt;
		        super&lt;br /&gt;
	        end&lt;br /&gt;
        end&lt;br /&gt;
			&lt;br /&gt;
        def euros&lt;br /&gt;
		..&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66984</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66984"/>
		<updated>2012-10-04T01:09:25Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
Example:	&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66982</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66982"/>
		<updated>2012-10-04T01:08:40Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        class Bank&lt;br /&gt;
             ..&lt;br /&gt;
             account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
             ..&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
	Examples:	&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66980</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66980"/>
		<updated>2012-10-04T01:07:50Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
        class Numeric&lt;br /&gt;
                def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
class Bank&lt;br /&gt;
     ..&lt;br /&gt;
     account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
     ..&lt;br /&gt;
end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
	Examples:	&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66979</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66979"/>
		<updated>2012-10-04T01:07:00Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
class Numeric&lt;br /&gt;
        def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
end&lt;br /&gt;
		&lt;br /&gt;
class Bank&lt;br /&gt;
     ..&lt;br /&gt;
     account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
     ..&lt;br /&gt;
end&lt;br /&gt;
		&lt;br /&gt;
Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
	Examples:	&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66972</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66972"/>
		<updated>2012-10-04T01:04:20Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
Examples:&lt;br /&gt;
class Numeric&lt;br /&gt;
        def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
	Examples:	&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66958</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66958"/>
		<updated>2012-10-04T00:59:54Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
===Open Classes===&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66954</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66954"/>
		<updated>2012-10-04T00:59:01Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming in Ruby==&lt;br /&gt;
----&lt;br /&gt;
===Open Classes===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===Implementing custom methods in Open Classes===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===Method Missing===&lt;br /&gt;
----	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
----&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==References==&lt;br /&gt;
----&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
----&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66945</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66945"/>
		<updated>2012-10-04T00:57:44Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==1. Introduction==&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==2. Metaprogramming in Ruby==&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===2.1 Open Classes===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
===2.2 Implementing custom methods in Open Classes===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
===2.3 Method Missing===&lt;br /&gt;
----	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==3. Summary==&lt;br /&gt;
----&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==4. References==&lt;br /&gt;
----&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==5. Further Reading==&lt;br /&gt;
----&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66942</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66942"/>
		<updated>2012-10-04T00:56:39Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==1. Introduction==&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
==2. Metaprogramming in Ruby==&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
	===2.1 Open Classes===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
	===2.2 Implementing custom methods in Open Classes===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
	===2.3 Method Missing===&lt;br /&gt;
----	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
==3. Summary==&lt;br /&gt;
----&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
==4. References==&lt;br /&gt;
----&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
==5. Further Reading==&lt;br /&gt;
----&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66911</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66911"/>
		<updated>2012-10-04T00:47:07Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{1. Introduction&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
	2.2 Defining custom methods in Open Classes&lt;br /&gt;
	2.3 Method Missing&lt;br /&gt;
3. Summary&lt;br /&gt;
4. References&lt;br /&gt;
5. Further Reading}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Introduction&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
	2.2 Implementing custom methods in Open Classes&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
	2.3 Method Missing &lt;br /&gt;
----	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
3. Summary&lt;br /&gt;
----&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
4. References&lt;br /&gt;
----&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
5. Further Reading&lt;br /&gt;
----&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66902</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66902"/>
		<updated>2012-10-04T00:43:06Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;1. Introduction&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
	2.2 Defining custom methods in Open Classes&lt;br /&gt;
	2.3 Method Missing&lt;br /&gt;
3. Summary&lt;br /&gt;
4. References&lt;br /&gt;
5. Further Reading&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Introduction&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
	2.2 Implementing custom methods in Open Classes&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
	2.3 Method Missing &lt;br /&gt;
----	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
3. Summary&lt;br /&gt;
----&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
4. References&lt;br /&gt;
----&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
5. Further Reading&lt;br /&gt;
----&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66896</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66896"/>
		<updated>2012-10-04T00:41:22Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;1. Introduction&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
	2.2 Defining custom methods in Open Classes&lt;br /&gt;
	2.3 Method Missing&lt;br /&gt;
3. Summary&lt;br /&gt;
4. References&lt;br /&gt;
5. Further Reading&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Introduction&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
	2.2 Implementing custom methods in Open Classes&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
	2.3 Method Missing &lt;br /&gt;
	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
3. Summary&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
4. References&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
5. Further Reading&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66892</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66892"/>
		<updated>2012-10-04T00:40:07Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;1. Introduction&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
	2.2 Defining custom methods in Open Classes&lt;br /&gt;
	2.3 Method Missing&lt;br /&gt;
3. Summary&lt;br /&gt;
4. References&lt;br /&gt;
5. Further Reading&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Introduction&lt;br /&gt;
&lt;br /&gt;
One of the most impressive aspects of Ruby is its metaprogramming capabilities. As a dynamic language, Ruby gives you the freedom to define methods and even classes during runtime. Metaprogramming with Ruby, one can do in a few minutes what other languages may take hours to do. By cleverly planning your code and applying the techniques mentioned here, you’ll be able to write code that is DRYer, lighter, more intuitive and more scalable.&lt;br /&gt;
&lt;br /&gt;
2. Metaprogramming in Ruby&lt;br /&gt;
	2.1 Open Classes&lt;br /&gt;
		In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an existing class, and the new contents you specify will be added to whatever's there.&lt;br /&gt;
		&lt;br /&gt;
		Comparing this to other object oriented languages like JAVA, we cannot modify the existing standard classes and add custom methods. We will have to create a new class of our own which inherits from the standard class and add new functionalities to it. Then, we need to use this user-defined class in place of the standard class.&lt;br /&gt;
		&lt;br /&gt;
	2.2 Implementing custom methods in Open Classes&lt;br /&gt;
		As an example of Open Classes explained above, consider the functionality of converting Euros to Dollars.&lt;br /&gt;
		&lt;br /&gt;
		&amp;lt;Code&amp;gt;&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def euros ; self * 0.019; end		# custom method defined here.&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		class Bank&lt;br /&gt;
			..&lt;br /&gt;
			account.deposit(20.euros)			# call to custom method.&lt;br /&gt;
			..&lt;br /&gt;
		end&lt;br /&gt;
		&amp;lt;/Code&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
		Here, we define our own method 'euros' by extending the Numeric class. Euro-to-Dollar conversion can then be done by invoking the euros method as shown above.&lt;br /&gt;
		&lt;br /&gt;
	2.3 Method Missing &lt;br /&gt;
	&lt;br /&gt;
		When you send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with a method called method_missing. The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
		&lt;br /&gt;
		If we extend the previous example to define method_missing for the Numeric class,//1.euro we can do it as shown:&lt;br /&gt;
		&lt;br /&gt;
		class Numeric&lt;br /&gt;
			def method_missing(method_id)&lt;br /&gt;
				if method_id.to_s == &amp;quot;euro&amp;quot;&lt;br /&gt;
					self.send('euros')&lt;br /&gt;
				else&lt;br /&gt;
					super&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			def euros&lt;br /&gt;
				..&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		The above implementation of Numeric class allows calling euros as well as the euro method(since 1.euro is more appropriate). Here, since euro is not defined, method missing is passed the name of the method that does not exist: &amp;quot;euro&amp;quot; which can then be used to call the 'euros' method through self.send. Furthermore, if this is not defined, then the control is transfered to the parent class. &lt;br /&gt;
&lt;br /&gt;
3. Summary&lt;br /&gt;
	All the classes in Ruby are open which allow you to define custom methods.&lt;br /&gt;
	To make code more readable, it is okay to reopen the standard classes to define custom methods.&lt;br /&gt;
	These features saves a lot of effort in Ruby compared to other Object Oriented languages like JAVA, C++&lt;br /&gt;
		&lt;br /&gt;
4. References&lt;br /&gt;
	http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_open_classes.html&lt;br /&gt;
	http://rubylearning.com/satishtalim/ruby_method_missing.html&lt;br /&gt;
&lt;br /&gt;
5. Further Reading&lt;br /&gt;
	http://ruby-doc.org/docs/ProgrammingRuby/&lt;br /&gt;
	http://en.wikipedia.org/wiki/Ruby_(programming_language)&lt;br /&gt;
	http://rubymonk.com/&lt;br /&gt;
	http://www.ruby-lang.org/en/documentation/quickstart&lt;br /&gt;
	http://www.ruby-doc.org/downloads/&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66621</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w57 mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w57_mp&amp;diff=66621"/>
		<updated>2012-10-03T22:47:36Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: Created page with &amp;quot;'''Saas 3.5 Metaprogramming''' 1. Introduction&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Saas 3.5 Metaprogramming'''&lt;br /&gt;
[[1. Introduction]]&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=66610</id>
		<title>CSC/ECE 517 Fall 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=66610"/>
		<updated>2012-10-03T22:44:16Z</updated>

		<summary type="html">&lt;p&gt;Schandr9: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE 517 Fall 2012/ch1 n xx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w1 rk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w20 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w5 su]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w6 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w4 aj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w7 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w8 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w9 av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w10 pk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w11 ap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w12 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w14 gv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w17 ir]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w18 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w22 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 wi]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w31 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w16 br]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w23 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w24 nr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w15 rt]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w3 pl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w32 cm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w67 ks]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w27 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w29 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w33 op]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w19 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w34 vd]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w35 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w30 rp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w47 sk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w69 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w44 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w45 is]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w53 kc]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w40 ar]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w39 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w54 go]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w56 ms]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w64 nn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w66 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w40 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w42 js]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w46 sm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w71 gs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w63 dv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w55 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w57 mp]]&lt;/div&gt;</summary>
		<author><name>Schandr9</name></author>
	</entry>
</feed>