The sample code above shows the number of techniques that can be used to maximize the use of blocks for transactional control where the takeAndDosomething method is considered a class method and that it can be called independent or without influence of any single File Object. We used it to function in the same manner as the File.open method without consideration of any arguments. We called the File.open method, passed onto it the transaction or condition which was defined in the *args as a parameter. Shortening it all, the “openAndDosomething” transparently passes whatever conditions or parameters it gets towards the File.open method. Once the file ios open and the “openAndDosomething” calls on the yield statement passing the opened file to the block/chunk of code.
By Avatar | September 17, 2009
There are a variety iterators that are useful with Ruby such as we’ve already seen in previous samples of code, such as n.times. Others are n.upto and n.downto for going up or down a series of integers and the step, which is more like the traditional loop statement. Their usage would be somewhat like:
3.times {print”X “}
1.upto(3) {[i] print i, ” ” }
99.downto(96) {[i] print i, ” ” }
50.step(70, 5) {[i] print i, ” ” }
Giving you the following results:
X X X 1 2 3 99 98 97 96 50 55 60 65 70
We have looked into many of the data structures that are supported by ruby along with brief examples of their use and structures. Now we turn to the different data types the language supports which is vital in maximizing the potential of Ruby. Numbers are classified into integers and floating point numbers. The handling capabilities of Ruby when it comes to integers is dependent on the amount of memory you have installed on your computer. They are also classified into two object classes stored in either the Fixnum or Bignum classes. Ruby handles conversion to and from these two types automatically and stores them in binary form in their respective classes. Integers can also be used with optional lead signs that denote octal, hex, or binary.
Integer values can also be translated into their ASCII character set equivalents with the use of a ? before the variable. The term numeric literal that is denoted by an exponent or a decimal point is converted into a Float object in correspondence to the native language’s double data type. To obtain the absolute value of an integer you use the form aNumber.abs and not abs(aNumber) as with C and C++.
For all the good reasons, Ruby on Rails is fast becoming popular with developers and Web applications deployers. Rails is a Web application structure based on a number of advance philosophies like Convention Over configuration and Don’t Repeat Yourself. On the other hand, the JRuby on Rails presents additional benefit by allowing them to influence the immovability and the consistency of the Java platform. In lieu with this, Sang Shin is offering an online course about Ruby and JRuby which will start on July 15, 2008. Those who will attend this course will not do a real-time webcasting but definitely upon completion of the course, they will acquire all the necessary knowledge they could use to be able to write realistically refined Rails application.
Rails is a jam-packed pile skeleton for mounting web applications that are supported by a database. The developing should be in accordance with the Model-View-Control pattern. Rails is capable of providing a pure-Ruby development surrounding that include the domain model covering the database, the response based on the request sent to the controller and the Ajax in the view. To go online, you just have to add a database and a web server. Practically everyone is already on Rails, which include enterprise organizations, non-profits and even those organizations that are just starting are also inclined to using Rails. Since Rails is all about transportation and communication, it is perfectly compatible to any type of web application.
The complexities of Rails compared to other development platforms for your web applications is compared to be the main detractor of the overall status of Rails, unable to progress into a more preferred language. Rails on the code side can be compared to COBOL and C++ that used to be done with millions of lines of code til the advent of GUI-based development that allowed components to be embedded and laid out, the screen or page already laid-out and then is filled an customized by filling in the parameters and othe nuances that would make the application run. Read More »
Older versions of Ruby and Ruby on rails have been wondering what would happen to them as newer and improved versions and flavors of the much loved yet less used open-source platform, and they got an answer form Engine Yard who has announced it will be taking over the responsibilities of maintaining the older release of the said platform. The company would take over bug-handling duties as well as the need for security issues that have to be addressed. they would also be keeping tabs on the speed of the Ruby interpreter and may even improve on it as needed to allow developed products to continue function in today’s PH ruled internet. More preferred by business oriented users and developers due to stronger security and other features, it has been left in the dust by the widely used PHP language. Read More »
Old news as it may be, the already powerful language that is Ruby on Rails is set to get a very much needed boost with their partnership with Merb. Why all the interest in so a discreet language? Well Twitter is one example which is based on RoR and as we can see, has swept the world by storm and has swayed many people to re-consider their old views of Ruby. The new and improved version of the language will provide more power in terms of customization options and add to that the speed which kept Merb on top of Ruby for some years now, it all has the making of a very productive partnership indeed. Read More »

One the most important tips for Ruby and Rails programmers is to always keep abreast of the latest news, updates, patches, fixes and developments in the Ruby and Rails community. This can be done be joining online discussion boards and forums, as well as mailing and RSS lists that show all the latest developments for the language. Whether a newbie or a veteran, you can always learn new things when you join a community, because there are always people better than you. You can ask questions and wait for people to give you their answers and suggestions. Why try looking for a solution yourself when somebody might have already solved it? It’s an efficient and easy way to learn and get new information.
By Bart | January 10, 2009
The many open-sourced programs that have been developed are the view of things to come when the proposed cloud computing platform is implemented. Google, one of the staunchest supporter of open web development and the many other internet leaders have been trying to get cloud computing off the ground for quite some time with some success but many issues still have to be addressed for it to become a viable option for today’s web experience.
Read More »