Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/linmeric/CnGal_new_classes.rb

Overview

Overload of Fixnum class

Author

Massimiliano Dal Mas ([email protected])

License

Distributed under MIT license

Instance Method Summary collapse

Instance Method Details

#can_divide?(obj) ⇒ Boolean

Checks if the fixnum value can be divided by a given object

  • argument: object for the checking

  • returns: true if the object is Numeric or Matrix; false else.

Returns:

  • (Boolean)


67
68
69
# File 'lib/linmeric/CnGal_new_classes.rb', line 67

def can_divide?(obj)
  (obj.is_a? Numeric) ? (return true) : ((obj.is_a? Matrix) ? (return true) : (return false))
end

#can_multiply?(obj) ⇒ Boolean

Checks if the fixnum value can be multiplied by a given object

  • argument: object for the checking

  • returns: true if the object is Numeric or Matrix; false else.

Returns:

  • (Boolean)


59
60
61
# File 'lib/linmeric/CnGal_new_classes.rb', line 59

def can_multiply?(obj)
  (obj.is_a? Numeric) ? (return true) : ((obj.is_a? Matrix) ? (return true) : (return false))
end

#similar_to?(obj) ⇒ Boolean

Compares the value with another object

  • argument: object for the comparison

  • returns: true if the object is a Numeric; false else.

Returns:

  • (Boolean)


51
52
53
# File 'lib/linmeric/CnGal_new_classes.rb', line 51

def similar_to?(obj)
  (obj.is_a? Numeric) ? (return true) : (return false)
end