文字
分享

Standard Library



Ruby comes ``out of the box'' with a large and useful library of modules and classes. This chapter contains a sampling of the more useful of these.

Interestingly, and unlike some of the code in later chapters, all of these libraries are written in Ruby. You'll find the source in the lib subdirectory of the standard Ruby distribution.

class Complex
Parent: Numeric
Version: 1.6

Index:

new Arithmetic operations <=> == abs abs2 arg conjugate image polar real to_f to_i to_r to_s


require "complex"
v1 = Complex(2,3)
上一篇:内建类和方法下一篇:OO设计