Muutke küpsiste eelistusi

Beginning Ruby 3: From Beginner to Pro 4th ed. [Pehme köide]

  • Formaat: Paperback / softback, 585 pages, kõrgus x laius: 254x178 mm, kaal: 1156 g, 21 Illustrations, black and white; XXX, 585 p. 21 illus., 1 Paperback / softback
  • Ilmumisaeg: 09-Dec-2020
  • Kirjastus: APress
  • ISBN-10: 1484263235
  • ISBN-13: 9781484263235
  • Pehme köide
  • Hind: 57,96 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Tavahind: 68,19 €
  • Säästad 15%
  • Raamatu kohalejõudmiseks kirjastusest kulub orienteeruvalt 2-4 nädalat
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Tellimisaeg 2-4 nädalat
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 585 pages, kõrgus x laius: 254x178 mm, kaal: 1156 g, 21 Illustrations, black and white; XXX, 585 p. 21 illus., 1 Paperback / softback
  • Ilmumisaeg: 09-Dec-2020
  • Kirjastus: APress
  • ISBN-10: 1484263235
  • ISBN-13: 9781484263235

Learn the principles behind object-oriented programming in Ruby and within a few chapters create a fully functional Ruby 3-based application. You'll gain a basic understanding of many ancillary technologies such as databases, XML, web frameworks, and networking - some of which will be needed for your first Ruby application.  Based on the bestselling first and second editions, Beginning Ruby 3, 4th Edition is a leading guide to learn Ruby from the ground up.

The new edition of this book provides the same excellent introduction to Ruby as the previous editions plus updates for the newest version of Ruby, including performance through an improved allocator, decreased heap fragmentation and more.  Also, added: details on the just-in-time compiler, fewer limits on GIL (Global Interpreter Lock), and a static type checker. 

You’ll see why the light and agile Ruby programming language remains a popular open source scripting option for developers building today's web applications. This book can also be used as a textbook or companion to a textbook on beginning Ruby programming. After reading and using this book, you'll have a firm handle to program in the Ruby language.  

What You Will Learn

    Discover the fundamentals of Ruby and its object-oriented building blocks
  • Use the Ruby libraries, gems, and documentation
  • Work with files and databases
  • Write and deploy Ruby applications
  • Harness the various Ruby web frameworks and use them effectively
  • Do network programming with Ruby 

Who This Book Is For 

Beginning programmers, programmers new to Ruby, and web developers interested in learning the foundations of the Ruby programming language.

About the Authors xix
About the Technical Reviewer xxi
Foreword xxiii
Acknowledgments xxvii
Introduction xxix
Part I Foundations and Scaffolding
1(138)
Chapter 1 Let's Get It Started: Installing Ruby
3(10)
Installing Ruby
4(7)
Windows
4(2)
Mac OS X/macOS
6(1)
Linux
7(3)
Other Platforms
10(1)
Summary
11(2)
Chapter 2 Programming == Joy: A Whistle-Stop Tour of Ruby and Object Orientation
13(24)
Baby Steps
14(5)
irb: Interactive Ruby
14(1)
Ruby Is "English for Computers"
15(1)
Why Ruby Makes a Great Programming Language
16(1)
Trails for the Mind
17(2)
Turning Ideas into Ruby Code
19(9)
How Ruby Understands Concepts with Objects and Classes
20(1)
The Making of a Person
20(3)
Basic Variables
23(1)
From People to Pets
23(5)
Everything Is an Object
28(6)
Kernel Methods
29(1)
Passing Data to Methods
30(2)
Using the Methods of the String Class
32(2)
Using Ruby in a Non-object-Oriented Style
34(1)
Summary
35(2)
Chapter 3 Ruby's Building Blocks: Data, Expressions, and Flow Control
37(58)
Numbers and Expressions
37(10)
Basic Expressions
38(1)
Variables
38(3)
Comparison Operators and Expressions
41(2)
Looping Through Numbers with Blocks and Iterators
43(2)
Floating Point Numbers
45(2)
Constants
47(1)
Text and Strings
47(14)
String Literals
47(2)
String Expressions
49(2)
Interpolation
51(2)
String Methods
53(1)
Regular Expressions and String Manipulation
54(7)
Arrays and Lists
61(8)
Basic Arrays
61(3)
Splitting Strings into Arrays
64(1)
Array Iteration
65(1)
Other Array Methods
66(3)
Hashes
69(4)
Basic Hash Methods
70(2)
Hashes Within Hashes
72(1)
Flow Control
73(10)
If and Unless
73(2)
The Ternary Operator
75(1)
Elsif and Case
76(2)
Case Pattern Matching
78(1)
While and Until
79(1)
Code Blocks
80(3)
Other Useful Building Blocks
83(8)
Dates and Times
83(4)
Ranges
87(1)
Symbols
88(2)
Converting Objects to Other Classes
90(1)
Summary
91(4)
Chapter 4 Developing Your First Ruby Application
95(28)
Working with Source Code Files
95(5)
Creating a Test File
96(1)
A Simple Source Code File
97(1)
Running Your Source Code
98(2)
Our Application: A Text Analyzer
100(12)
Required Basic Features
101(1)
Building the Basic Application
102(1)
Obtaining Some Dummy Text
102(1)
Loading Text Files and Counting Lines
103(2)
Counting Characters
105(1)
Counting Words
106(2)
Counting Sentences and Paragraphs
108(2)
Calculating Averages
110(1)
The Source Code So Far
111(1)
Adding Extra Features
112(7)
Percentage of "Useful" Words
112(3)
Summarizing by Finding "Interesting" Sentences
115(3)
Analyzing Files Other Than text.txt
118(1)
The Completed Program
119(3)
Summary
122(1)
Chapter 5 The Ruby Ecosystem
123(16)
Ruby's History
124(5)
The Land of the Rising Sun
124(1)
Ruby's Influences
125(1)
Go West
126(3)
Alternative Ruby Implementations
129(1)
Ruby on Rails
129(3)
Why Rails Came into Existence
130(1)
How the Web (2.0) Was Won
131(1)
The Open Source Culture
132(1)
What Is Open Source?
132(1)
Where and How to Get Help
133(2)
Mailing Lists
133(1)
Chat
134(1)
Documentation
134(1)
Forums
135(1)
Joining the Community
135(2)
Give Help to Others
135(1)
Contribute Code
136(1)
News Sites and Sources
137(1)
Summary
137(2)
Part II The Core of Ruby
139(252)
Chapter 6 Classes, Objects, and Modules
141(56)
Why Use Object Orientation?
141(4)
Object Orientation Basics
145(25)
Local, Global, Object, and Class Variables
146(5)
Class Methods vs. Instance Methods
151(2)
Inheritance
153(4)
Overriding Existing Methods
157(2)
Reflection and Discovering an Object's Methods
159(2)
Encapsulation
161(5)
Polymorphism
166(2)
Nested Classes
168(1)
The Scope of Constants
169(1)
Modules, Namespaces, and Mix-ins
170(14)
Namespaces
171(3)
Mix-ins
174(10)
Building a Dungeon Text Adventure with Objects
184(11)
Dungeon Concepts
184(1)
Creating the Initial Classes
185(1)
Structs: Quick and Easy Data Classes
186(3)
Creating Rooms
189(1)
Making the Dungeon Work
190(5)
Summary
195(2)
Chapter 7 Projects and Libraries
197(18)
Projects and Using Code from Other Files
197(5)
Basic File Inclusion
197(3)
Inclusions from Other Directories
200(1)
Logic and Including Code
201(1)
Nested Inclusions
202(1)
Libraries
202(11)
The Standard Libraries
203(3)
RubyGems
206(4)
Bundler
210(3)
Summary
213(2)
Chapter 8 Documentation, Error Handling, Debugging, and Testing
215(32)
Documentation
215(7)
Generating Documentation with RDoc
216(2)
RDoc Techniques
218(1)
Producing Documentation for an Entire Project
218(2)
Modifiers and Options
220(2)
Debugging and Errors
222(10)
Exceptions and Error Handling
223(4)
Catch and Throw
227(1)
The Ruby Debugger
228(4)
Testing
232(1)
The Philosophy of Test-Driven Development
233(6)
Unit Testing
236(2)
More Minitest Assertions
238(1)
Benchmarking and Profiling
239(5)
Simple Benchmarking
239(3)
Profiling
242(2)
Summary
244(3)
Chapter 9 Files and Databases
247(50)
Input and Output
247(22)
Keyboard Input
248(1)
File I/O
249(20)
Basic Databases
269(8)
Text File Databases
269(3)
Storing Objects and Data Structures
272(5)
Relational Databases and SQL
277(17)
Relational Database Concepts
277(1)
MySQL, PostgreSQL, and SQLite
278(1)
Installing SQLite
279(1)
A Crash Course in Basic Database Operations and SQL
280(5)
Using SQLite with Ruby
285(6)
Connecting to Other Database Systems
291(2)
ActiveRecord: A Sneak Peek
293(1)
Summary
294(3)
Chapter 10 Distributing Ruby Code and Libraries
297(24)
Distributing Basic Ruby Programs
297(4)
The Shebang Line
299(1)
Associated File Types in Windows
300(1)
Detecting Ruby's Runtime Environment
301(4)
Easy OS Detection with RUBY PLATFORM
301(1)
Environment Variables
302(2)
Accessing Command-Line Arguments
304(1)
Distributing Ruby Libraries As Gems
305(7)
Creating a Gem
305(6)
Installing Your Gem
311(1)
RubyGems.org
312(1)
Deploying Ruby Applications As Remote Services
312(8)
CGI Scripts
313(3)
Generic HTTP Servers
316(4)
Summary
320(1)
Chapter 11 Advanced Ruby Features
321(22)
Dynamic Code Execution
321(7)
Bindings
322(2)
Other Forms of eval
324(2)
Creating Your Own Version of attr accessor
326(2)
Running Other Programs from Ruby
328(4)
Getting Results from Other Programs
328(1)
Transferring Execution to Another Program
329(1)
Running Two Programs at the Same Time
329(1)
Interacting with Another Program
330(2)
Threads
332(3)
Basic Ruby Threads in Action
332(2)
Advanced Thread Operations
334(1)
Fibers
335(4)
A Fiber in Action
336(1)
Passing Data to a Fiber
337(1)
Non-blocking Fiber
338(1)
Why Fibers?
339(1)
Unicode, Character Encodings, and UTF-8 Support
339(3)
Ruby 1.9 and Beyond's Character Encoding Support
340(2)
Summary
342(1)
Chapter 12 Tying It Together: Developing a Larger Ruby Application
343(48)
Let's Build a Bot
343(3)
What Is a Bot?
343(2)
Why a Bot?
345(1)
How?
345(1)
Creating a Simple Text Processing Library
346(14)
Building the WordPlay Library
346(8)
Testing the Library
354(3)
WordPlay's Source Code
357(3)
Building the Bot's Core
360(19)
The Program's Lifecycle and Parts
361(1)
Bot Data
362(5)
Constructing the Bot Class and Data Loader
367(2)
The responsejo Method
369(6)
Playing with the Bot
375(4)
Main Bot Code Listing
379(4)
bot.rb
379(4)
Basic Client.rb
383(1)
Extending the Bot
383(6)
Using Text Files As a Source of Conversation
384(1)
Connecting the Bot to the Web
384(4)
Bot-to-Bot Conversations
388(1)
Summary
389(2)
Part III Ruby Online
391(146)
Chapter 13 Two Web Application Approaches: Rails and Sinatra
393(50)
Background
393(2)
The Limitations and Benefits of Our Approach
394(1)
Pros and Cons of the Frameworks Covered
394(1)
Rails: Ruby's Killer App
395(33)
What Is Rails and Why Use It?
395(3)
Installing Rails
398(2)
Building a Basic Rails Application
400(13)
Controllers and Views
413(7)
Models and Relationships
420(2)
Sessions and Filters
422(2)
Other Features
424(2)
Where to Go Next: References, Books, and Example Apps
426(2)
Sinatra: Lightweight, Simple Web Applications
428(12)
The Extreme Simplicity of Sinatra
428(1)
General URL Routing and Parameter Matching
429(2)
Views, Templates, and Static Files
431(5)
Request Flow Control
436(4)
Summary
440(3)
Chapter 14 Ruby and the Internet
443(28)
HTTP and the Web
443(15)
Downloading Web Pages
444(10)
Processing Web Content
454(4)
Email
458(4)
Receiving Mail with POP3
458(2)
Sending Mail with SMTP
460(2)
File Transfers with FTP
462(6)
Connection and Basic FTP Actions
462(3)
Downloading Files
465(2)
Uploading Files
467(1)
Summary
468(3)
Chapter 15 Networking and Sockets
471(22)
Networking Concepts
471(2)
TCP and UDP
471(1)
IP Addresses and DNS
472(1)
Basic Network Operations
473(4)
Checking Machine and Service Availability
473(1)
Performing DNS Queries
474(3)
Servers and Clients
477(13)
UDP Client and Server
477(3)
Building a Simple TCP Server
480(2)
Multi-client TCP Servers
482(1)
GServer
483(3)
A GServer-Based Chat Server
486(4)
Web/HTTP Servers
490(1)
Summary
490(3)
Chapter 16 Useful Ruby Libraries
493(44)
abbrev
494(2)
Installation
494(1)
Examples
494(1)
Further Information
495(1)
Base64
496(3)
Installation
496(1)
Examples
496(3)
Further Information
499(1)
Benchmark
499(2)
Installation
499(1)
Examples
499(1)
Further Information
500(1)
chronic
501(1)
Installation
501(1)
Examples
501(1)
Further Information
502(1)
Digest
502(4)
Installation
503(1)
Examples
503(2)
Further Information
505(1)
English
506(2)
Installation
506(1)
Examples
506(2)
Further Information
508(1)
ERB
508(3)
Installation
508(1)
Examples
508(2)
Further Information
510(1)
Json
511(1)
Installation
511(1)
Examples
511(1)
Further Information
512(1)
Logger
512(3)
Installation
512(1)
Examples
513(2)
Further Information
515(1)
Nokogiri
515(2)
Installation
516(1)
Examples
516(1)
Further Information
517(1)
Pp
517(2)
Installation
517(1)
Examples
518(1)
Further Information
519(1)
RedCarpet
519(1)
Installation
519(1)
Examples
520(1)
Further Information
521(1)
StringScanner
522(3)
Installation
522(1)
Examples
522(3)
Further Information
525(1)
tempfile
525(3)
Installation
525(1)
Examples
526(2)
Further Information
528(1)
uri
528(5)
Installation
528(1)
Examples
529(4)
Further Information
533(1)
zlib
533(4)
Installation
533(1)
Examples
533(2)
Further Information
535(2)
Appendix A Ruby Primer and Review for Developers
537(34)
The Basics
537(4)
Definition and Concepts
537(3)
The Ruby Interpreter and Running Ruby Code
540(1)
Interactive Ruby
541(1)
Expressions and Flow Control
541(8)
Basic Expressions
541(1)
Class Mismatches
542(2)
Comparison Expressions
544(1)
Flow
545(4)
Object Orientation
549(9)
Objects
550(1)
Classes and Methods
550(3)
Reflection
553(3)
Reopening Classes
556(1)
Method Visibility
556(2)
Data
558(7)
Strings
558(1)
Regular Expressions
558(2)
Numbers
560(2)
Arrays
562(1)
Hashes (Associative Arrays)
563(1)
Complex Structures
564(1)
Input/Output
565(2)
Files
565(1)
Databases
566(1)
Web Access
566(1)
Libraries
567(4)
File Organization
568(1)
Packaging
568(3)
Appendix B Useful Resources
571(6)
Tutorials and Guides
571(1)
General Ruby Tutorials and Information
571(1)
Ruby on Rails
572(1)
Other
572(1)
References
572(2)
Ruby
573(1)
Ruby on Rails
573(1)
Ruby-Related Content
574(1)
Aggregators and News
574(1)
Forums
575(1)
Mailing Lists
575(1)
What
576(1)
Index 577
Carleton DiLeo is a founder, author, and developer who brings nearly two decades of experience working with technology. His expertise includes building high-traffic websites, big data systems, and video games. This wide base of knowledge provides Carleton with a unique perspective when working with Ruby.

Peter Cooper is an experienced Ruby developer, trainer, and publisher who runs Ruby Inside, the most popular blog in the Ruby and Rails worlds, with 18,000 subscribers. He also curates RubyFlow, a popular Ruby community link blog. Over the past few years he has developed, launched, and sold two startups (Feed Digest and Code Snippets), both powered by Ruby and Rails.