Re: Re:

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: Main PLUG discussion list
Subject: Re: Re:
On Sun, 2010-02-21 at 21:50 -0700, Paul Mooring wrote:
> I'd just like to point out that ruby was originally intended to be a
> replacement for perl, primarily focused on being used for sys admin
> type scripting, not a web language. I for one love ruby and do
> essentially no web programming, I just can't live without the binding
> operator ( ~= ) and perl's regular expressions, but love ruby's syntax
> ( and who wouldn't love something like '5.times { puts "Ruby is the
> greatest!" }

----
or code like this (from an irb an interactive ruby session)

>> this_day = Date.today

=> Sun, 21 Feb 2010
>> this_day + 3.months

=> Fri, 21 May 2010
>> (this_day + 3.months).beginning_of_month

=> Sat, 01 May 2010

or extending built-in classes...
 >> class Float
 >>   def to_fl(digits)
 >>     sprintf("%.#{digits}f",self)
 >>   end
 >> end

=> nil
>> test2 = 3.141625

=> 3.141625
>> test2.to_fl(3)

=> "3.142"

or iterating over arrays, etc.

The beauty of ruby is apparent, rails or not. But if you are doing a web
application with rails, you always have the full functionality of ruby.
Whenever something doesn't already exist for rails, you can add ruby
gems and if there isn't a ruby gem, you just write your code.

Then of course, you can simply open an irb and test out a section of
code without having to deal with a web browser, apache etc.

I find myself manipulating data in a db using the irb console rather
than phpmyadmin or mysql shell because it is so much easier to
loop/iterate/replace/save.

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss