Skip to content

Ruby numeric , string class and javascript numeric , string classes

Shekhar Prasad Rajak edited this page Jun 29, 2017 · 4 revisions

Some research is needed to understand ruby and javascript classes for numeric , string, datatime. Since in google chart tool, we need to pass the type in the column of the table to generate the data table.

Examples :

    data_table = GoogleVisualr::DataTable.new
    data_table.new_column('string'  , 'Name')
    data_table.new_column('number'  , 'Salary')
    data_table.new_column('boolean' , 'Full Time Employee')
    # then rows will be added.

In ruby :

Numeric is a base class for other, more specific, types of number objects.
For example:


puts 100.class         # Fixnum
puts (100.2).class     # Float
puts (100**100).class  # Bignum

Base class for these will be Numeric

irb(main):026:0> (100).is_a? Numeric
=> true
irb(main):027:0> (100.2).is_a? Numeric
=> true
irb(main):028:0> (100*100).is_a? Numeric
=> true
Clone this wiki locally