Class: Array

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

Instance Method Summary collapse

Instance Method Details

#b(base) ⇒ Object



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

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

#br(base = nil) ⇒ Object

Convenience method for creating a Radix::Rational.

TODO: Keep #br? Or find another way?

Returns [Radix::Rational]



221
222
223
224
225
# File 'lib/radix/rational.rb', line 221

def br(base=nil)
  args = dup
  args << base if base
  Radix::Rational.new(*args)
end