Sold Out
Book Categories |
Acknowledgments xvii
Introduction: What is Ruby? xix
Acquiring and Configuring Ruby xx
On a Unix or Unix-like System xx
On a Windows System xxi
Motivations for the Book xxi
Conventions xxii
Summary of Chapters xxii
Interactive Ruby and the Ruby Environment 1
Starting irb 2
Using irb 2
Expressions 2
Everything Is an Object 2
Integers, Fixnums, and Bignums 3
Addition, Concatenation, and Exceptions 4
Casting 4
Arrays 5
Booleans 6
Flow Control 6
Methods 8
Variables 9
Constants 10
Using the Ruby Interpreter and Environment 10
Amusements and Simple Utilities 13
Is It Payday? (check_payday.rb) 14
The Code 14
How It Works 14
The Results 16
Random Signature Generator (random_sig.rb and random_sig-windows.rb) 16
The Code 16
How It Works 16
Running the Script 19
The Results 19
Hacking the Script 19
The 99 Bottles of Beer Song (99bottles.rb) 20
The Code 20
How It Works 21
Running the Script 25
The Results 25
Sound File Player (shuffle_play.rb) 25
The Code 26
How It Works 27
Running the Script 29
The Results 29
Hacking the Script 30
Chapter Recap 31
Programmer Utilities 33
What Is Truth? (boolean_golf.rb) 33
The Code 34
How It Works 34
Hacking the Script 36
Running the Script 36
The Results 36
Making a List (array_join.rb) 36
The Code 37
How It Works 37
Running the Script 39
Hacking the Script 39
Command-Line Interface (uses_cli.rb and simple_cli.rb) 39
The Code 40
How It Works 42
Running the Script 44
Hacking the Script 45
Palindromes (palindrome.rb and palindrome2.rb) 45
The Code 45
How It Works 46
Hacking the Script 46
Running the Script 47
The Results 48
Chapter Recap 49
Text Manipulation 51
End-of-Line Conversion (dos2unix.rb) 51
The Code 52
How It Works 52
Running the Script 55
The Results 56
Hacking the Script 56
Showing Line Numbers (line_num.rb) 57
The Code 57
How It Works 57
Running the Script 58
The Results 58
Wrapping Lines of Text (softwrap.rb) 59
The Code 59
Running the Script 62
The Results 62
Hacking the Script 62
Counting Words in a File (word_count.rb) 62
The Code 63
How It Works 64
Running the Script 64
The Results 64
Word Histogram (most_common_words.rb) 65
The Code 65
How It Works 65
Running the Script 67
The Results 67
Hacking the Script 67
Rotating Characters in a String (rotate.rb) 68
The Code 68
How It Works 68
Running the Script 69
The Results 69
Chapter Recap 70
Number Utilities 71
Computing Powers (power_of.rb) 72
The Code 72
How It Works 73
Running the Script 74
The Results 75
Adding Commas to Numbers (commify.rb) 75
Inheritance 75
Modules 76
The Code 76
How It Works 78
Running the Script 81
The Results 81
Roman Numerals (roman_numeral.rb) 81
The Code 82
How It Works 83
Running the Script 86
The Results 86
Hacking the Script 87
Currency Conversion, Basic (currency_converter1.rb) 87
The Code 88
How It Works 89
Running the Script 90
The Results 90
Hacking the Script 90
Currency Conversion, Advanced (currency_converter2.rb) 90
The Code 91
How It Works 93
Running the Script 97
The Results 97
Hacking the Script 98
Chapter Recap 98
Functionalism with Blocks and Procs 99
Our First lambda (make_incrementer.rb) 100
The Code 100
How It Works 101
The Results 101
Using Procs for Filtering (matching_members.rb) 102
The Code 102
How It Works 102
Running the Script 103
The Results 103
Using Procs for Compounded Filtering (matching_compound_members.rb) 103
The Code 104
How It Works 105
The Results 107
Hacking the Script 108
Returning Procs as Values (return_proc.rb) 108
The Code 108
The Results 109
How It Works 109
Nesting lambdas 111
The Code 111
How It Works 112
Procs for Text (willow_and_anya.rb) 112
The Code 112
How It Works 115
Running the Script 118
The Results 118
Hacking the Script 119
Chapter Recap 119
Using, Optimizing, and Testing Functional Techniques 121
Basic Factorials and Fibonaccis (factorial1.rb through fibonacci5.rb) 122
The Code 122
How It Works 123
The Results 123
Hacking the Script 124
Benchmarking and Profiling (tests/test_opts.rb) 128
Benchmarking 128
The Code 128
How It Works 129
Running the Script 130
The Results 130
Profiling 131
Hacking the Script 132
Converting Temperatures (temperature_converter.rb) 132
The Code 132
How It Works 134
The Results 136
Hacking the Script 136
Testing temperature_converter.rb (tests/test_temp_converter.rb) 137
The Code 137
The Results 138
How It Works 139
Hacking the Script 139
Chapter Recap 140
HTML and XML Tools 141
Cleaning Up HTML (html_tidy.rb) 141
The Code 142
How It Works 144
Running the Script 146
The Results 147
Hacking the Script 148
Counting Tags (xml_tag_counter.rb) 148
The Code 149
How It Works 150
Running the Script 153
The Results 153
Hacking the Script 153
Extracting Text from XML (xml_text_extractor.rb) 154
The Code 154
How It Works 155
Running the Script 155
The Results 155
Hacking the Script 156
Validating XML (xml_well_formedness_checker.rb) 156
The Code 156
How It Works 157
Running the Script 158
The Results 158
Hacking the Script 158
Chapter Recap 159
More Complex Utilities and Tricks, Part I 161
Finding Codes in the Bible or Moby-Dick (els_parser.rb) 161
The Code 162
How It Works 164
Running the Script 167
The Results 167
Hacking the Script 168
Mutating Strings into Weasels (methinks.rb) 168
The Code 168
How It Works 171
Running the Script 174
The Results 174
Hacking the Script 175
Mutating the Mutation of Strings into Weasels (methinks_meta.rb) 176
The Code 177
How It Works 179
Running the Script 181
The Results 181
Hacking the Script 182
Chapter Recap 183
More Complex Utilities and Tricks, Part II 185
Overnight DJ (radio_playerl.rb) 186
The Code 186
How It Works 187
The Results 189
Hacking the Script 190
Better Overnight DJ (radio_player2.rb) 190
The Code 190
How It Works 191
The Results 192
Hacking the Script 193
Numbers by Name (to_lang.rb) 193
The Code 194
How It Works 198
The Results 201
Hacking the Script 202
Elegant Maps and Injects (symbol.rb) 203
The Code 203
How It Works 203
The Results 204
Hacking the Script 204
Chapter Recap 204
CGI and the Web 205
Common Gateway Interface 206
Preparation and Installation 206
A Simple CGI Script (simple_cgi.rb) 207
The Code 207
How It Works 208
The Results 210
Hacking the Script 210
Mod Ruby (mod_ruby_demo.rhtml and mod_ruby_demo.conf) 211
The Code 211
How It Works 213
The Results 214
Hacking the Script 214
CSS Stylesheets, Part I (stylesheet.rcss) 215
The Code 215
How It Works 216
The Results 217
Hacking the Script 218
CSS Stylesheets, Part II (stylesheet2.rcss) 218
The Code 218
How It Works 220
The Results 220
Hacking the Script 221
Chapter Recap 221
Rubygems and Rails Preparation 223
RubyGems 223
Installing RubyGems 224
Using RubyGems 224
Rails Preparation 227
What Is Rails? 228
Other Options for Installing Rails 228
Databases 229
The Structure of a Rails Application 229
Chapter Recap 235
A Simple Rails Project 237
Creating the Application 237
Initial Creation 238
Preparing the Database 238
Adding Data 238
Creating the Model and Controllers 240
Dissecting the Application 241
Dissecting the Photo Model 241
Dissecting the Controllers 242
Dissecting the Helpers 245
Dissecting the Album Controller's Views 251
Dissecting the Feed Controller's images View 254
Dissecting the Album Controller's Layout 256
Using CSS 257
Using the Application 257
Learning More About Rails 260
Chapter Recap 260
How does Ruby Compare to Other Languages? 261
C 261
Haskell 262
Java 262
Lisp 263
Perl 264
PHP 264
Python 265
Smalltalk 265
Summary of Ruby vs. Other Languages 266
Index 267
Login|Complaints|Blog|Games|Digital Media|Souls|Obituary|Contact Us|FAQ
CAN'T FIND WHAT YOU'RE LOOKING FOR? CLICK HERE!!! X
You must be logged in to add to WishlistX
This item is in your Wish ListX
This item is in your CollectionRuby by Example: Concepts and Code
X
This Item is in Your InventoryRuby by Example: Concepts and Code
X
You must be logged in to review the productsX
X
X
Add Ruby by Example: Concepts and Code, , Ruby by Example: Concepts and Code to the inventory that you are selling on WonderClubX
X
Add Ruby by Example: Concepts and Code, , Ruby by Example: Concepts and Code to your collection on WonderClub |