下载  >  开发技术  >  其它  > ruby programming

ruby programming 评分:

ruby programming, wiki.org 入门书籍
Contents 1 Overview 1.1 Features 1.2Re 2 Installing Ruby 7 2.1 Operating systems 2 Building from source 10 2.3 Compile opti 10 2.4 Testing installation 10 2.5 References 3 Ruby editors 13 4 Notation conventions 15 4.1C ommand-Iine examples ··,“ 15 5 Interactive Rub 5.1 Running irb 5.2 Understanding irb output 18 6 Mailing list FAQ .,19 7 Basic Ruby-Hello world 21 7.1 Hello world 21 7.2 Comments 22 7.3 Executable Ruby scripts....... 8 Basic Ruby -Strings 27 8.1 String literals 8.2 Single 27 8.3 Double quotes 28 8.4 puts 29 8.5 print..... 8.6 See also 30 9 Basic ruby- Alternate quotes 31 9.1 Alternate single quotes 31 9.2 Alternate double quotes 10 Basic ruby- Here documents 10.1 Here documents 33 10.2 Indenting 34 10.3 Quoting rules 35 11 Basic ruby -Introduction to objects 37 Il I What is an object? 37 11.2 Variables and objects 37 11. 3 Methods 38 11.4 Reassigning a variable 39 12 Basic ruby-Ruby basics 41 Contents 13 Dealing with variables 14 Program flow 45 15 Writing functions 47 1 6 Blocks 49 17 Ruby is really, really object-oriented 53 18 Basic Ruby -Data types 55 18.1 Ruby Data Types 55 18.2 Constants 8. 3 Symbol 56 18 4 Hashes 18.5 Arrays 58 18.6 Strings 62 18.7 Numbers (Integers and Floats) 66 18. 8 Additional string methods 9 Basic ruby - Writing methods 69 19.1 Defining methods 20 Basic Ruby -Classes and objects 20.1 Ruby classes 20.2 Creating Instances of a class 20.3 Creating Classes 71 20.4 Self 20.5 Class methods 72 21 Basic Ruby -Exceptions 75 22 Syntax-Lexicology 22.identifiers 22.2C 77 22. 3 Embedded documentation 22. 4 Reserved words 78 22.5Ex 78 23 Syntax- Variables and Constants 79 23.1 Local Variables 79 23.2 Instance variab 23. 3 Class Variables 23. 4 Global variables 23.5 Constants 23.6 PseudoⅤ ariables 23. 7 Pre-defined Variables 23. 8 Pre-defined Constants 85 23.9N 24 Syntax- Literals 24 Numerics 24.2 Strings 24. 3 Arra 24 4 Hash 92 24.5 Ranges 2 25 Syntax-Operators 95 25.1 95 25.2 96 Contents 25.3 Default scope 25.4 Local scope gotch 25.5 Logical And l00 25.6 Logical Or 101 26 Syntax -Control Structures 103 26.1 Control Structures 103 27 Syntax- Method calls 27.1 Method Calls 109 27.2 Method definitions 109 27.3 Dynamic methods lI8 27.4 Special methods .,,,119 27.5 Conclusion 28 Syntax-Cla 121 28. 1 Class definition 121 28.2 Declaring visibility 125 28.3 Inheritance 28.4 Mixing in modules 131 28.5 Ruby Class Meta-Model 132 29 Syntax-Hooks .133 29.1 const missing .....133 30 References 135 3 I Built-ln上 unctad 137 32 Predefined Variables 139 33 Predefined Classes 143 33.1 Footnotes l43 34 Objects 145 35 A1 rray 147 36 Class,.,,,,,,,,..,,,, 149 37 Comparable 151 38 Encoding 153 39E 155 39.1 Enumerable l55 40 Forms of enumerator 40.11.Asa for each 157 0.2 2. as a source of values from a block 157 4033. As an external iterator 158 41 Lazy evaluation 42 Methods which return numerators 161 43 More Enumerator readings .163 44 Exception 165 45 False class 167 46 I0-Fiber 169 47 IO 171 47.1 Encoding 47.2 gets l71 47.3 recv ··· 47.4 48 I0-File 173 Contents 49 File 175 49.1 File#chmod 175 49.2 Filetgrep 175 49.3 File. join 175 50 I0-File: Stat 177 51 File: Stat 179 52I0-GC l81 53 GC 183 53.1 Tuning the gC 183 53.2 Conservative 183 53. 3 Tunning jruby's gc 53.4 How to avoid performance penalty 54I0-GC- Profiler 187 55 Marshal 56 Marshal 191 57 Method ..193 58 Math 195 59 Module 197 60 Module -Class 199 61 NilClass 62 Numeric 203 63 Numeric-Integer 207 64 Numeric Integer- Bignum ...211 65 Numeric-Integer-Fixnum 213 66 Numeric -Float 215 67 Range 217 68 Regexp .219 69 Regexp Regular Expression 221 69.1 oniguruma 221 69.2 Simplifying regexes 221 69.3 Helper websites 69.4 Alternative Regular Expression Libraries 70 Rubyvm 223 70.1 Ruby vM: Instruction Sequence disassemble 223 71 String 225 72 Struct 227 73 Struct 229 74 Struct- Struct: Tms 231 75 Symbol 233 76 Time ..235 77 Thread 78 Thread 239 78.1 Thread local variables 239 78.2 Joining on multiple threads .240 78.3 Controlling Concurrency 240 79 True Class 241 80 Contributors 243 List of figures 249 ⅥI Contents 81 Licenses 253 81.1 GNU GENERAL PUBLIC LICENSE 253 81.2 GNU Free documentation license 254 81.3 GNU Lesser General Public License 254 1 Overview Ruby is an object-oriented scripting language developed by Yukihiro Matsumoto(Matz").The main web site for Ruby is ruby-lang. org. Development began in February 1993 and the first alpha version of Ruby was released in December 1994. It was developed to be an alternative to scripting languages such as Perl and Python. Ruby borrows heavily from Perl and the class library is essentially an object-oriented reorganization of Perl's functionality ruby also borrows from list and Smalltalk. While ruby does not borrow many features from Python, reading the code for Python helped Matz develop ruby I Mac os x comes with ruby already installed Most linux t distributions cither come with ruby preinstalled or allow you to easily install Ruby from the distributions repository of free software ou can also download and install Ruby on Windows 0. The more technically adept can download the Ruby source code and compile it for most operating systems 9, including Unix20, DOS BeOS22. OS/223. Windows, and Linux 24 1.1 Features Ruby combines features from Perl, Smalltalk, Eiffel26, Ada2/, Lisp, and Python. 28 1http://en,wikipediacrg/wiki,object-criented820programmirg k⊥ Dedia.Cg/viki/So 3http://en.wikipediacrg/wiki/yukihiros20matsumoto 4http://www.rubylar 5http://en.wikipediacrg/wiki/perl 6http:// 河iki nc各20_an 7 An Interview with the Creator of Ruby O'Reilly.Retrieved 2006-09-11 9 hLLp: //en. wikipedia. crg/wiki/Lisp 11 An Interview with the Creator of Ruby 12. o'Reilly. Retrieved 2006-09-11 13 ht /wiki/Mac各2cCS2 4http://en.wikipediacrg/wiki/linux 15 hLLp: //en. wikipedia.crg/wiki/rree%20sofLware 16http://en.wikipediacrg/wiki/microscfto2owindovs 17 Download Ruby 18.. Retrieved 2006-09-11 19http://en.wikipediacrg/wiki/operating20system 20http://en.wikipediacrg/wiki/unix 21 hLLp: //en. wikipedia.crg/wiki/DOS 22http://en.wikipedia.crg/viki/beos 23http://en.wikipediacrg/wiki/os2f2 24 About ruby 25. Retrieved 2006-09-11 26http://en.wikipedi三crg/wik立/Eiffel名20号28programming号201anguage名29 27 hLLp://en. wikipedia. crg/wiki/Ada2028programming620language629 28 About Ruby 29. Retrieved 2006-09-11 Overview 1.1.1 Object Oriented Ruby goes to great lengths to be a purely object oriented language. Every value in Ruby is an object, even the most primitive things: strings numbers and even rue and false. every object has a class and every class has one superclass. At the root of the class hierarchy is the class Object from which all other classes inherit Every class has a set of methods which can be called on objects of that class Methods are always called on an object- there are no "class methods, as there are in many other languages (though Ruby does a great job of faking them) Every object has a set of instance variables which hold the state of the object Instance variables are created and accessed from within methods called on the object Instance variables are completely private to an object. No other object can see them, not even other objects of the same class, or the class itself. All communication between Ruby objects happens through methods 1.1.2 Mixins In addition to classes, Ruby has modules. a module has methods, just like a class, but it has no instances. Instead a module can be included or "mixed in "to a class which adds the methods of that module to the class. This is very much like inheritance but far more flexible because a class can include many different modules. By building individual features into separate modules, functionality can be combined in elaborate ways and code easily reused. Mix-ins help keep Ruby code free of complicated and restrictive class hierarchies 1.1.3 Dynamic Ruby is a very dynamic programming language. Ruby programs arent compiled, in the way that C or Java programs are. All of the class, module and method definitions in a program are built by the code when it is run. a program can also modify its own definitions while it's running. Even the most primitive classes of the language like String and Integer can be opened up and extended. Rubyists call this monkey patching and it's the kind of thing you can' t get away with in most other languages Variables in Ruby are dynamically typed, which means that any variable can hold any type of object When you call a method on an object, Ruby looks up the method by name alone -it doesn't care about the type of the object. This is called duck typing and it lets you make classes that can pretend to be other classes, just by implementing the same methods 1.1.4 Singleton Classes When I said that every Ruby object has a class, I lied. The truth is, every object has two classes a"regular"class and a singleton class. An objects singleton class is a nameless class whose only instance is that object. Every object has its very own singleton class, created automatically alon with the object. Singleton classes inherit from their object's regular class and are initially empty, but you can open them up and add methods to them, which can then be called on the lone object belonging to them. This is Ruby's secret trick to avoidclass methods and keep its type system simple and elegant 4

...展开详情
2018-09-24 上传 大小:1.05MB
举报 收藏
分享
ProgrammingRuby中文版(第二版)(清晰文字版pdf)随书源码

[随书代码。本无意收取一分,但为了能攒点分数,望谅解] 全球公认Ruby权威入门参考经典。灵活,优雅,巧妙,快捷。让编程成为你的直觉,让开发成为你的乐趣。你准备好步入动态语言大时代了吗? 。这是一本关于Ruby的权威著作。书中内容包含:广受赞誉Ruby使用教程;完全的Ruby语言参考;所有内建类、模块和方法的文档;所有98个标准库的描述等。本书是第2版。它不仅是您学习Ruby语言及其丰富特性的一本优秀教程,也可以作为日常编程时类和模块的参考手册。 Ruby官网推荐用书:http://www.ruby-doc.org/docs/ProgrammingRuby/

立即下载
The Ruby Programming Language中文版

The Ruby Programming Language中文版.pdf 内容不可选择复制,仅限pdf阅读

立即下载
The Ruby Programming Language 2008(英文版).pdf

The Ruby Programming Language 2008 (English)包含精致书签,可复制文档内容,结合中文版可以对ruby相关语法进行学习,个人感觉ruby很大,死读书不如结合一些实例进行了解更好,本手册更适合遇到问题再来翻阅

立即下载
Ruby_Programming

本书为日本公认的最好的Ruby入门教程。松本行弘亲自审校并作序推荐。本书支持最新的Ruby 2.0,也附带讲解了可运行于1.9版本的代码,事无巨细且通俗易懂地讲解了编写程序时所需要的变量、常量、方法、类、流程控制等的语法,以及主要类的使用方法和简单的应用,让没有编程经验的读者也能轻松掌握Ruby,找到属于自己的快乐编程方式,做到融会贯通并灵活运用到实际工作中。 本书适合Ruby初学者学习参考。

立即下载
Ruby Programming

Best Ruby Programming book

立即下载
《Ruby Programming—向Ruby之父学程序设计(第2版)》电子书

本书是为了让完全没有程序设计经验的读者也能灵活地使用Ruby,因此书中详细地说明了各种知识。

立即下载
Programming Ruby 2.0 1.9 pdf

Programming Ruby 2.0 1.9 pdf

立即下载
Ruby.Programming_向Ruby之父学程序设计(第2版).pdf (含书签)

[Ruby.Programming_向Ruby之父学程序设计(第2版)].(日)高桥征义,(日)后藤裕藏.扫描版(ED2000.COM).pdf ) 带书签

立即下载
The Ruby Programming Language

The Ruby Programming Language

立即下载
Ruby Programming Language 2008 pdf

David Flanagan, Yukihiro Matsumoto The Ruby Programming Language is the authoritative guide to Ruby and provides comprehensive coverage of versions 1.8 and 1.9 of the language. It was written (and illustrated!) by an all-star team: David Flanagan, bestselling author of programming language "bibles"

立即下载
The Ruby Programming Language (part 2)

第二个压缩包 The Ruby Programming Language 一共两个压缩包 Part 1在http://download.csdn.net/source/424086

立即下载
programming ruby

automation test ruby

立即下载
Ruby.Programming_向Ruby之父学程序设计(第2版).pdf

中文名: Ruby Programming——向Ruby之父学程序设计(第2版) 作者: (日)高桥征义 (日)后藤裕藏译者: 博硕文化 资源格式: PDF 版本: 扫描版 出版社: 电子工业出版社书号: 9787121077029发行时间: 2009年04月01日 地区: 大陆 语言: 简体中文 简介: 编辑推荐   本书内容:   第一部分:通过简单的Ruby程序来介绍程序的基本架构。   第二部分:介绍基础语法规则,以及类、模块等面向对象程序设计的思考方法与用词。    第三部分:对一些基础类逐一介绍其功能与用法。 第四部分:介绍一些比较高级的功能,比如Ruby的环境参数、环境

立即下载
The Ruby Programming Language 介绍

NULL 博文链接:https://hlee.iteye.com/blog/356947

立即下载
Ruby Programming 向Ruby之父学程序设计(第2版)(中文版)

Ruby Programming 向Ruby之父学程序设计(第2版)(中文版)

立即下载
Programming Ruby中文版 (第二版)

Programming Ruby中文版 (第二版),高清资源。 Programming Ruby中文版 (第二版),高清资源。

立即下载
The Ruby Programming Language (part 1)

2008新作,是英文版啊. Ruby的作者的作品, part.1 一共两个压缩包 Part 2在http://download.csdn.net/source/424089

立即下载
Ruby编程Ruby Programming

本书是面向初学者和高级读者的Ruby编程指南。

立即下载
《Ruby Programming_向Ruby之父学程序设计_第2版》PDF版本下载.txt

《Ruby Programming_向Ruby之父学程序设计_第2版》PDF版本下载

立即下载
Ruby.Programming

ruby入门资料.Ruby.Programming.

立即下载