module IntNum

Definition of some method for Int numbers. This is included in Integer class (ruby_version >= 2.2) or Fixnum class (ruby_version <= 2.2)

Author

Massimiliano Dal Mas (max.codeware@gmail.com)

License

Distributed under MIT license

Public Instance Methods

can_divide?(obj) click to toggle source

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.

# File lib/linmeric/CnGal_new_classes.rb, line 69
def can_divide?(obj)
  (obj.is_a? Numeric) ? (return true) : ((obj.is_a? Matrix) ? (return true) : (return false))
end
can_multiply?(obj) click to toggle source

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.

# File lib/linmeric/CnGal_new_classes.rb, line 61
def can_multiply?(obj)
  (obj.is_a? Numeric) ? (return true) : ((obj.is_a? Matrix) ? (return true) : (return false))
end
similar_to?(obj) click to toggle source

Compares the value with another object

  • *argument*: object for the comparison

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

# File lib/linmeric/CnGal_new_classes.rb, line 53
def similar_to?(obj)
  (obj.is_a? Numeric) ? (return true) : (return false)
end