class String
Adds the b(base) method to this ruby class for quickly creating Radix
instances.
Public Instance Methods
ascii()
click to toggle source
# File lib/radix/operator.rb, line 49 def ascii force_encoding('ASCII') end
b(base=nil)
click to toggle source
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
@param [Fixnum, Array
<String>] base
The desired base.
@return [Radix::Integer, Radix::Float
]
# File lib/radix/operator.rb, line 62 def b(base=nil) return ascii unless base if index('.') Radix::Float.new(self, base) else Radix::Integer.new(self, base) end end
Also aliased as: ascii