class Array

Adds the b(base) method to this ruby class for quickly creating Radix instances.

Public Instance Methods

b(base) click to toggle source

Takes array and makes it into a Radix::Integer or Radix::Float as given base. Float is determined by a “.” character in array instance.

@param [Fixnum, Array<String>] base

The desired base.

@return [Radix::Integer, Radix::Float]

# File lib/radix/operator.rb, line 86
def b(base)
  if index('.')
    Radix::Float.new(self, base)
  else
    Radix::Integer.new(self, base)
  end
end
br(base=nil) click to toggle source

Adds convenience method for creating a Radix::Rational.

@todo Keep br? Or find another way? @return [Radix::Rational]

# File lib/radix/rational.rb, line 289
def br(base=nil)
  args = dup
  args << base if base
  Radix::Rational.new(*args)
end