The Well-Grounded Rubyist
David A. Black
Language: English
Pages: 536
ISBN: 1617291692
Format: PDF / Kindle (mobi) / ePub
Summary
The Well-Grounded Rubyist, Second Edition addresses both newcomers to Ruby as well as Ruby programmers who want to deepen their understanding of the language. This beautifully written and totally revised second edition includes coverage of features that are new in Ruby 2.1, as well as expanded and updated coverage of aspects of the language that have changed.
Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.
About the Technology
This is a good time for Ruby! It's powerful like Java or C++, and has dynamic features that let your code react gracefully to changes at runtime. And it's elegant, so creating applications, development tools, and administrative scripts is easier and more straightforward. With the long-awaited Ruby 2, an active development community, and countless libraries and productivity tools, Ruby has come into its own.
About the Book
The Well-Grounded Rubyist, Second Edition is a beautifully written tutorial that begins with your first Ruby program and goes on to explore sophisticated topics like callable objects, reflection, and threading. The book concentrates on the language, preparing you to use Ruby in any way you choose. This second edition includes coverage of new Ruby features such as keyword arguments, lazy enumerators, and Module#prepend, along with updated information on new and changed core classes and methods.
What's Inside
- Clear explanations of Ruby concepts
- Numerous simple examples
- Updated for Ruby 2.1
- Prepares you to use Ruby anywhere for any purpose
About the Author
David A. Black is an internationally known Ruby developer, author, trainer, speaker, event organizer, and founder of Ruby Central, as well as a Lead Consultant at Cyrus Innovation.
Table of Contents
- Bootstrapping your Ruby literacy
- Objects, methods, and local variables
- Organizing objects with classes
- Modules and program organization
- The default object (self), scope, and visibility
- Control-flow techniques
- Built-in essentials
- Strings, symbols, and other scalar objects
- Collection and container objects
- Collections central: Enumerable and Enumerator
- Regular expressions and regexp-based string operations
- File and I/O operations
- Object individuation
- Callable and runnable objects
- Callbacks, hooks, and runtime introspection
PART 1 RUBY FOUNDATIONS
PART 2 BUILT-IN CLASSES AND MODULES
PART 3 RUBY DYNAMICS
ZeroMQ: Messaging for Many Applications
Microsoft SQL Server 2012 Internals
C# 4.0 in a Nutshell: The Definitive Reference
Amazon Web Services: Migrating your .NET Enterprise Application
Think Like a Programmer: An Introduction to Creative Problem Solving
Foundation ActionScript 3.0 with Flash CS3 and Flex
examples of a few of them. Here we’ll look at those in more detail, and at several more of the most commonly used ones. These switches are summarized in table 1.2 and then explained separately. Table 1.2 Summary of commonly used Ruby command-line switches Switch Description Example of usage -c Check the syntax of a program file without executing the program ruby -c c2f.rb -w Give warning messages during program execution ruby -w c2f.rb -e Execute the code provided in quotation marks
performer is Mark Twain. The seat is Second Balcony, row J, seat 12, and it costs $5.50. The code for this example consists of a series of calls to the methods defined earlier: ticket.event, ticket.venue, and so forth. The printing code embeds those calls—in other words, embeds the return values of those methods (“Author’s reading”, “Town Hall”, and so on)—in a succession of output commands, and adds connectors (“, at”, “, on”, and so forth) to make the text read well and look nice. The Twain
construct what’s a class and what’s a module—nor, for that matter, whether Hammer is a plain old constant. (Tools has to be a class or module, because it’s got Hammer nested inside it.) In many cases, the fact that you can’t tell classes from modules in this kind of context doesn’t matter; what matters is the nesting or chaining of names in a way that makes sense. That’s just as well, because you can’t tell what’s what without looking at the source code or the documentation. This is a consequence
sam kaplan
the built-in, original String class, you need to put the constant path separator :: (double colon) at the beginning of the class name: def history ::String.new(maker + ", " + date) end This way, you get a Ruby String object instead of a Violin::String object. Like the slash at the beginning of a pathname, the :: in front of a constant means “start the search for this at the top level.” (Yes, you could just piece the string together inside double quotes, using interpolation, and bypass