Desk2Mob

Desk2Mob

Desk2Mob

Recently I noticed, there is no Fixnum and Bignum class in Ruby 2.4.0.

$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
$ irb
>> puts 4.class
Fixnum
>> puts 4.class.superclass
Integer
>> puts 4.class.superclass.superclass
Numeric
>> puts 4.class.superclass.superclass.superclass
Object
>> puts 4.class.sup... 
Posted on January 04, 2017 by Amit Pandya in Ruby

I tried in Ubuntu 14.04.2 LTS and working fine

Step 1: (the purpose of the first line in designating which interpreter to use for the rest of the file)

#!/usr/bin/env ruby
puts "Hello World!"

Step 2: (make the file executable with below command)

chmod u+x hello-world.rb

Step 3:

./hello-world.rb

Please not that If your platform doesn't support the #!/usr/...

Posted on October 26, 2015 by Amit Pandya in Ruby, Ubuntu

  • capitalize method

    • capitalize method converted first character of string to uppercase and remaining to lowercase. Here are some examples
       "ruby".capitalize
          => "Ruby"
       "RUBY".capitalize
         => "Ruby"
       "a1b1c1".capitalize
          => "A1b1c1" 
       "123ABC".capitalize
           => "123abc" 
    
Posted on February 21, 2014 by Amit Pandya in Ruby, Ruby - String Class