Class: String
- Inherits:
-
Object
- Object
- String
- 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
- #ascii ⇒ Object
-
#b(base = nil) ⇒ Radix::Integer, Radix::Float
Takes a String and makes it into a Radix::Integer or Radix::Float as given base.
Instance Method Details
#ascii ⇒ Object
47 |
# File 'lib/radix/operator.rb', line 47 alias :ascii :b |
#b(base = nil) ⇒ 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
62 63 64 65 66 67 68 69 70 |
# 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 |