class Array

Public Instance Methods

to_K() click to toggle source
# File lib/m500.rb, line 25
def to_K
  a = self.dup
  b = a.shift
  a.at(a.length-1).kind_of?(Array) ? c = a.delete_at(a.length-1) : c = ""
  tmp = true
  ret = nil
  a.each{|n| tmp = false if n.kind_of?(Numeric) and n<0 }
  if tmp then
    b >= 0  ? ret =  Kettenbruch.new!(b,a,c,1) :  ret =  Kettenbruch.new!(b,a,c,-1)
  else
    p "raise wrong input error"
  end
  ret
end