Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/radix/operator.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#b(base) ⇒ Radix::Integer, Radix::Float

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

Parameters:

Returns:



51
52
53
54
55
56
57
# File 'lib/radix/operator.rb', line 51

def b(base)
  if index('.')
    Radix::Float.new(self, base)
  else
    Radix::Integer.new(self, base)
  end
end