Class: Numeric

Inherits:
Object show all
Defined in:
lib/multiarray.rb

Instance Method Summary collapse

Instance Method Details

#bNumeric

Get blue component

Returns:



451
452
453
# File 'lib/multiarray.rb', line 451

def b
  self
end

#conjNumeric

Compute complex conjugate

Returns:



430
431
432
# File 'lib/multiarray.rb', line 430

def conj
  self
end

#gNumeric

Get green component

Returns:



444
445
446
# File 'lib/multiarray.rb', line 444

def g
  self
end

#major(other) ⇒ Numeric

Get larger number of two numbers

Parameters:

  • other (Numeric)

    The other number.

Returns:

  • (Numeric)

    The larger number of the two.



460
461
462
463
464
465
466
467
# File 'lib/multiarray.rb', line 460

def major( other )
  if other.is_a? Numeric
    ( self >= other ).conditional self, other
  else
    x, y = other.coerce self
    x.major other
  end
end

#minor(other) ⇒ Numeric

Get smaller number of two numbers

Parameters:

  • other (Numeric)

    The other number.

Returns:

  • (Numeric)

    The smaller number of the two.



474
475
476
477
478
479
480
481
# File 'lib/multiarray.rb', line 474

def minor( other )
  if other.is_a? Numeric
    ( self <= other ).conditional self, other
  else
    x, y = other.coerce self
    x.minor other
  end
end

#rNumeric

Get red component

Returns:



437
438
439
# File 'lib/multiarray.rb', line 437

def r
  self
end