Ruby by Example Concepts and Code 1st Edition by Kevin Baird – Ebook PDF Instant Download/Delivery: 1593271603, 9781593271602
Full download Ruby by Example Concepts and Code 1st Edition after payment
Product details:
ISBN 10: 1593271603
ISBN 13: 9781593271602
Author: Kevin C. Baird
There may be no better way to learn how to program than by dissecting real, representative examples written in your language of choice. Ruby by Example analyzes a series of Ruby scripts, examining how the code works, explaining the concepts it illustrates, and showing how to modify it to suit your needs. Baird’s examples demonstrate key features of the language (such as inheritance, encapsulation, higher-order functions, and recursion), while simultaneously solving difficult problems (such as validating XML, creating a bilingual program, and creating command-line interfaces). Each chapter builds upon the previous, and each key concept is highlighted in the margin to make it easier for you to navigate the book. You’ll learn how to: –Use the interactive Ruby shell (irb) to learn key features of the language –Extend Ruby using RubyGems, the Ruby package manager –Create numerical utilities, as well as utilities that process and analyze HTML/XML –Implement purely functional and metaprogramming techniques to save time and effort –Optimize, profile, and test your code to make sure that it not only does its job, but does it well –Create web applications using Rails Ruby is the fastest growing programming language today, and for good reason: its elegant syntax and readable code make for prolific and happy programmers. But it can be difficult to understand and implement without a little help. Ruby by Example shows you how to take advantage of Ruby as you explore Ruby’s fundamental concepts in action.
Ruby by Example Concepts and Code 1st Table of contents:
1. Interactive Ruby and the Ruby Environment
Starting irb
Using irb
Expressions
Everything Is an Object
Integers, Fixnums, and Bignums
Addition, Concatenation, and Exceptions
Casting
Arrays
Booleans
Flow Control
Methods
Variables
Constants
Using the Ruby Interpreter and Environment
2. Amusements and Simple Utilities
#1 Is It Payday? (check_payday.rb)
The Code
How It Works
Defining Constants
Defining Variables
The Results
#2 Random Signature Generator (random_sig.rb and random_sig-windows.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#3 The 99 Bottles of Beer Song (99bottles.rb)
The Code
How It Works
Running the Script
The Results
#4 Sound File Player (shuffle_play.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
Chapter Recap
3. Programmer Utilities
#5 What Is Truth? (boolean_golf.rb)
The Code
How It Works
Hacking the Script
Running the Script
The Results
#6 Making a List (array_join.rb)
The Code
How It Works
Running the Script
Hacking the Script
#7 Command-Line Interface (uses_cli.rb and simple_cli.rb)
The Code
How It Works
Running the Script
Hacking the Script
#8 Palindromes (palindrome.rb and palindrome2.rb)
The Code
How It Works
Hacking the Script
Running the Script
The Results
Chapter Recap
4. Text Manipulation
#9 End-of-Line Conversion (dos2unix.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#10 Showing Line Numbers (line_num.rb)
The Code
How It Works
Running the Script
The Results
#11 Wrapping Lines of Text (softwrap.rb)
The Code
Running the Script
The Results
Hacking the Script
#12 Counting Words in a File (word_count.rb)
The Code
How It Works
Running the Script
The Results
#13 Word Histogram (most_common_words.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#14 Rotating Characters in a String (rotate.rb)
The Code
How It Works
Recursion
Running the Script
The Results
Chapter Recap
5. Number Utilities
#15 Computing Powers (power_of.rb)
The Code
How It Works
Running the Script
The Results
#16 Adding Commas to Numbers (commify.rb)
Inheritance
Modules
The Code
How It Works
The format_int Method
The format_float Method
Type Testing
Running the Script
The Results
#17 Roman Numerals (roman_numeral.rb)
The Code
How It Works
Class Variables
Hash.merge
More Recursion
Multiples of Our Base
Multiplying Strings by Integers
Running the Script
The Results
Hacking the Script
#18 Currency Conversion, Basic (currency_converter1.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#19 Currency Conversion, Advanced (currency_converter2.rb)
The Code
How It Works
Downloading Rates Information
What If You Can’t Download New Rates?
Running the Script
The Results
Hacking the Script
Chapter Recap
6. Functionalism with Blocks and Procs
#20 Our First lambda (make_incrementer.rb)
The Code
How It Works
The Results
#21 Using Procs for Filtering (matching_members.rb)
The Code
How It Works
Running the Script
The Results
#22 Using Procs for Compounded Filtering (matching_compound_members.rb)
The Code
How It Works
Blocks, Procs, and the Ampersand
Filtering with Each Proc via map
Finding the Intersections with inject
Array Intersections
The Results
Hacking the Script
#23 Returning Procs as Values (return_proc.rb)
The Code
The Results
How It Works
Proc.call(args) vs. Proc[args]
Using Procs as Blocks
The inspect Method
#24 Nesting lambdas
The Code
How It Works
#25 Procs for Text (willow_and_anya.rb)
The Code
The Him Class
The SameTimeSamePlace Class
The willow_and_anya.rb Script
How It Works
The Him Class: Creating Procs with lambda
The SameTimeSamePlace Class: Alternatives to lambda for Creating Procs
Flexible Arity for Proc.new
Blocks, Arguments, and yield
Using Both Him and SameTimeSamePlace in willow_and_anya.rb
Running the Script
The Results
Hacking the Script
Chapter Recap
7. Using, Optimizing, and Testing Functional Techniques
#26 Basic Factorials and Fibonaccis (factorial1.rb through fibonacci5.rb)
The Code
How It Works
The Results
Hacking the Script
Using include? (factorial2.rb and fibonacci2.rb)
Passing the returns1 or returns_self Array as an Argument (factorial3.rb and fibonacci3.rb)
Making RETURNS1 or RETURNS_SELF a Class Constant (factorial4.rb and fibonacci4.rb)
Memoization of Results (factorial5.rb and fibonacci5.rb)
#27 Benchmarking and Profiling (tests/test_opts.rb)
Benchmarking
The Code
How It Works
Running the Script
The Results
Profiling
Hacking the Script
#28 Converting Temperatures (temperature_converter.rb)
The Code
How It Works
The Results
Hacking the Script
#29 Testing temperature_converter.rb (tests/test_temp_converter.rb)
The Code
The Results
How It Works
Hacking the Script
Chapter Recap
8. HTML and XML Tools
#30 Cleaning Up HTML (html_tidy.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#31 Counting Tags (xml_tag_counter.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#32 Extracting Text from XML (xml_text_extractor.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#33 Validating XML (xml_well_formedness_checker.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
Chapter Recap
9. More Complex Utilities and Tricks, Part I
#34 Finding Codes in the Bible or Moby-Dick (els_parser.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#35 Mutating Strings into Weasels (methinks.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
#36 Mutating the Mutation of Strings into Weasels (methinks_meta.rb)
The Code
How It Works
Running the Script
The Results
Hacking the Script
Chapter Recap
10. More Complex Utilities and Tricks, Part II
#37 Overnight DJ (radio_player1.rb)
The Code
How It Works
The Results
Hacking the Script
#38 Better Overnight DJ (radio_player2.rb)
The Code
How It Works
The Results
Hacking the Script
#39 Numbers by Name (to_lang.rb)
The Code
representable_in_english.rb
representable_in_spanish.rb
to_lang.rb
How It Works
The Two Mixins
The Main Code
The Results
Hacking the Script
#40 Elegant Maps and Injects (symbol.rb)
The Code
How It Works
The Results
Hacking the Script
Chapter Recap
11. CGI and the Web
Common Gateway Interface
Preparation and Installation
#41 A Simple CGI Script (simple_cgi.rb)
The Code
How It Works
The Results
Hacking the Script
#42 Mod Ruby (mod_ruby_demo.rhtml and mod_ruby_demo.conf)
The Code
mod_ruby_demo.conf
mod_ruby_demo.rhtml
How It Works
The Results
Hacking the Script
#43 CSS Stylesheets, Part I (stylesheet.rcss)
The Code
How It Works
The Results
Hacking the Script
#44 CSS Stylesheets, Part II (stylesheet2.rcss)
The Code
How It Works
The Results
Hacking the Script
Chapter Recap
12. RubyGems and Rails Preparation
RubyGems
Installing RubyGems
Using RubyGems
Listing Installed and Installable Gems
Installing Gems
Updating Gems
Learning More About RubyGems
Rails Preparation
What Is Rails?
Other Options for Installing Rails
Via Operating System Package Manager
From Source
Pre-Packaged
Databases
The Structure of a Rails Application
Generating a Rails Application
Viewing Your Rails Application
Basics for Generating Applications
Chapter Recap
13. A Simple Rails Project
Creating the Application
Initial Creation
Preparing the Database
Adding Data
Creating the Model and Controllers
Creating the Photo Model
Creating the Album and Feed Controllers
Dissecting the Application
Dissecting the Photo Model
Dissecting the Controllers
Dissecting the Album Controller
Dissecting the Application Controller
Dissecting the Feed Controller
Dissecting the Helpers
Dissecting the Album Helper
Dissecting the ApplicationHelper
Dissecting the FeedHelper
Dissecting the FooterHelper
Dissecting the Album Controller’s Views
Dissecting the index View
Dissecting the show View
Dissecting the Feed Controller’s images View
Dissecting the Album Controller’s Layout
Using CSS
Using the Application
Learning More About Rails
Chapter Recap
A. How Does Ruby Compare to Other Languages?
C
Haskell
Java
Lisp
Perl
PHP
Python
Smalltalk
Summary of Ruby vs. Other Languages
Index
About the Author
Colophon
People also search for Ruby by Example Concepts and Code 1st :
ruby by example
ruby example code
ruby examples for beginners
example ruby code
Tags:
Kevin Baird,Example,Code