Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/m500.rb
Instance Method Summary collapse
Instance Method Details
#to_K ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/m500.rb', line 23 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 |