At a Glance; Contents; About the Author; Acknowledgments; Introduction; Chapter 1: A Taste of Ruby; Small Task, Big Impact; Development Environment Installation; Windows; Mac; 1.1 The First Recipe: aka Hello World; Problem; Solution; How It Works; 1.2 Does It Cost Anything to Say Hello?; Problem; Solution; How It Works; 1.3 Sherlock Holmes and Learning; Problem; Solution; How It Works; 1.4 1 2 3 4, 1 2 3 4; Problem; Solution; How It Works; Interactive Ruby Shell; Summary; Exercises; Exercise 1.1; Exercise 1.2; Exercise 1.3
Text of Note
2.13 Reading a File in One Shot Problem; Solution; How It Works; 2.14 Working with Strings; Problem; Solution; How It Works; Concatenation; Expression Evaluation; 2.15 Converting Numbers to a String; Problem; Solution; 2.16 Extracting Information from Strings; Problem; Task: Change the Order of Names; Solution; How It Works; Task: Totaling the Shopping List; Solution; Exercises; Exercise 2.1; Exercise 2.2; Chapter 3: Language Elements; Commenting on Commenting; Variables, Operators & Working with Numbers; Logical and Other Operators; Reference and Value Equality
Text of Note
Chapter 2: Working with Files and Strings Manipulating Strings; length or size; empty?; strip; Outline Placeholder; Outline Placeholder; capitalize; downcase and upcase; chars; index; insert; delete; include?; slice; count; partition; tr; reverse; sub (and gsub); scan; split; String Formatting; 2.1 Accepting Input from the Console; Problem; Solution; How It Works; 2.2 Accepting Numbers as Input; Problem; Solution; How It Works; 2.3 Handling the Newline; Problem; Solution; More on Getting Rid of the Newline; 2.4 Formatting Strings; Problem; Solution
Text of Note
Checking If an Object Is nil General Comparison Operator; Assignment Operators; Mass Assignment; Bitwise, Logical, and Ternary Operators; The Range Operators; The dot (.) Operator; Some Other Operators; Pattern Matching Operators; Using Ranges; Interval; Sequences; Conditions; Conditional Constructs/Control Flow; if; nil check; unless; Ternary operator; case; while; break, redo, next; until; for; 3.1 Handling Exceptions; Problem; Solution; Single Line Rescue; catch and throw; 3.2 Working with Predefined Variables and Constants; Problem; Solution
Text of Note
How It Works 2.5 Processing Command-Line Arguments; Problem; Solution; How It Works; 2.6 Reading from a File; Problem; Solution; How It Works; 2.7 Writing to a File; Problem; Solution; How It Works; 2.8 Getting Started with Exception Handling; Problem; Solution; Initial Execution Context; 2.9 Importing Code; Problem; Solution; 2.10 Creating and Deleting Directories; Problem; Solution; How It Works; 2.11 Creating a Whole Directory Path; Problem; Solution; How It Works; 2.12 Reading Multiple Lines from a File; Problem; Solution; How It Works
0
8
8
8
8
SUMMARY OR ABSTRACT
Text of Note
Solve your Ruby programming problems that occur during your day-to-day scripting work. This book contains a varied selection of practical and interesting code recipes designed to make your coding life easier. Ruby Recipes includes solutions to problems in working with data, handling exceptions, writing blocks, and using regular expressions. This book provides ready scripts for both simple complex scripting tasks, which you can use readily or with only minor modifications. These scripts cover areas such as collections, classes and structures, functional programming, and log handling. With these handy recipes at your fingertips, you will be able to solve those niggling problems and become even more efficient. You will: Install and run Ruby Read and write data Write functions Work with arrays, ranges, hashes, and iterators Handle dates and time Process XML as text Master OOP concepts such as classes, objects, subclassing, and inheritance Connect to databases