Ruby Developers Guide 1st Edition Syngress 2024 scribd download
Ruby Developers Guide 1st Edition Syngress 2024 scribd download
com
https://ebookname.com/product/ruby-developers-guide-1st-
edition-syngress/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/ruby-for-rails-ruby-techniques-for-
rails-developers-david-black/
ebookname.com
https://ebookname.com/product/head-first-ruby-a-brain-friendly-
guide-1st-edition-mcgavren/
ebookname.com
https://ebookname.com/product/metaprogramming-ruby-program-like-the-
ruby-pros-1st-edition-paolo-perrotta/
ebookname.com
https://ebookname.com/product/free-radical-effects-on-membranes-1st-
edition-sadis-matalon-eds/
ebookname.com
Language Development An Introduction 8th Edition Allyn
Bacon Communication Sciences and Disorders Robert E. Owens
https://ebookname.com/product/language-development-an-
introduction-8th-edition-allyn-bacon-communication-sciences-and-
disorders-robert-e-owens/
ebookname.com
https://ebookname.com/product/how-to-cheat-in-photoshop-the-art-of-
creating-photorealistic-montages-3rd-edition-steve-caplin/
ebookname.com
https://ebookname.com/product/the-company-of-strangers-a-natural-
history-of-economic-life-revised-edition-paul-seabright/
ebookname.com
https://ebookname.com/product/search-engine-optimization-bible-2nd-
edition-edition-jerri-l-ledford/
ebookname.com
Convict Hell Macquarie Harbour 1822 1833 1st Edition David
W. Cameron
https://ebookname.com/product/convict-hell-macquarie-
harbour-1822-1833-1st-edition-david-w-cameron/
ebookname.com
1 YEAR UPGRADE
BUYER PROTECTION PLAN
RUBY D e v e l o p e r ’s
Guide
Robert Feldt
Lyle Johnson
Michael Neumann Technical Editor
183_Ruby_FM.qxd 1/7/02 4:04 PM Page i
solutions@syngress.com
With more than 1,500,000 copies of our MCSE, MCSD, CompTIA, and Cisco
study guides in print, we continue to look for ways we can better serve the
information needs of our readers. One way we do that is by listening.
Readers like yourself have been telling us they want an Internet-based ser-
vice that would extend and enhance the value of our books. Based on
reader feedback and our own strategic plan, we have created a Web site
that we hope will exceed your expectations.
Best of all, the book you’re now holding is your key to this amazing site.
Just go to www.syngress.com/solutions, and keep this book handy when
you register to verify your purchase.
Thank you for giving us the opportunity to serve your needs. And be sure
to let us know if there’s anything else we can do to help you get the
maximum value from your investment. We’re listening.
www.syngress.com/solutions
183_Ruby_FM.qxd 1/7/02 4:04 PM Page ii
183_Ruby_FM.qxd 1/7/02 4:04 PM Page iii
1 YEAR UPGRADE
BUYER PROTECTION PLAN
Ruby
D e v e l o p e r ’s G u i d e
Robert Feldt
Lyle Johnson
Michael Neumann Technical Editor
183_Ruby_FM.qxd 1/7/02 4:04 PM Page iv
Syngress Publishing, Inc., the author(s), and any person or firm involved in the writing, editing, or
production (collectively “Makers”) of this book (“the Work”) do not guarantee or warrant the results to be
obtained from the Work.
There is no guarantee of any kind, expressed or implied, regarding the Work or its contents.The Work is
sold AS IS and WITHOUT WARRANTY. You may have other legal rights, which vary from state to state.
In no event will Makers be liable to you for damages, including any loss of profits, lost savings, or other
incidental or consequential damages arising out from the Work or its contents. Because some states do not
allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation
may not apply to you.
You should always use reasonable care, including backup and other appropriate precautions, when working
with computers, networks, data, and files.
Syngress Media®, Syngress®,“Career Advancement Through Skill Enhancement®,” and “Ask the Author
UPDATE®,” are registered trademarks of Syngress Publishing, Inc. “Mission Critical™,”“Hack Proofing™,”
and “The Only Way to Stop a Hacker is to Think Like One™” are trademarks of Syngress Publishing, Inc.
Brands and product names mentioned in this book are trademarks or service marks of their respective
companies.
KEY SERIAL NUMBER
001 UJG4TFR2T5
002 AKJ7T4MAS4
003 VMERF3854N
004 SGD34BK9HN
005 85DFMU6N7H
006 NFG438GEM4
007 BAQ2HTR46T
008 CV5TR56KMR
009 83N5M4BT6Y
010 GT67FRWFEC
PUBLISHED BY
Syngress Publishing, Inc.
800 Hingham Street
Rockland, MA 02370
The Ruby Developer’s Guide
Copyright © 2002 by Syngress Publishing, Inc. All rights reserved. Printed in the United States of America.
Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or
distributed in any form or by any means, or stored in a database or retrieval system, without the prior
written permission of the publisher, with the exception that the program listings may be entered, stored,
and executed in a computer system, but they may not be reproduced for publication.
Printed in the United States of America
1 2 3 4 5 6 7 8 9 0
ISBN: 1-928994-64-4
Technical Editor: Michael Neumann Cover Designer: Michael Kavish
Acquisitions Editor: Catherine B. Nolan Page Layout and Art by: Reuben Kantor and Shannon Tozier
Developmental Editor: Kate Glennon Copy Editor: Jesse Corbeil
Indexer: Robert Saigh
Distributed by Publishers Group West in the United States and Jaguar Book Group in Canada.
183_Ruby_FM.qxd 1/7/02 4:04 PM Page v
Acknowledgments
We would like to acknowledge the following people for their kindness and support
in making this book possible.
Richard Kristof and Duncan Anderson of Global Knowledge, for their generous
access to the IT industry’s best courses, instructors, and training facilities.
Ralph Troupe, Rhonda St. John, and the team at Callisma for their invaluable insight
into the challenges of designing, deploying and supporting world-class enterprise
networks.
Karen Cross, Lance Tilford, Meaghan Cunningham, Kim Wylie, Harry Kirchner,
Kevin Votel, Kent Anderson, and Frida Yara of Publishers Group West for sharing
their incredible marketing experience and expertise.
Mary Ging, Caroline Hird, Simon Beale, Caroline Wheeler,Victoria Fuller, Jonathan
Bunkell, and Klaus Beran of Harcourt International for making certain that our
vision remains worldwide in scope.
Annabel Dent of Harcourt Australia for all her help.
David Buckland,Wendi Wong, Marie Chieng, Lucy Chong, Leslie Lim, Audrey Gan,
and Joseph Chan of Transquest Publishers for the enthusiasm with which they receive
our books.
Kwon Sung June at Acorn Publishing for his support.
Ethan Atkin at Cranbury International for his help in expanding the Syngress
program.
Jackie Gross, Gayle Vocey, Alexia Penny, Anik Robitaille, Craig Siddall, Darlene
Morrow, Iolanda Miller, Jane Mackay, and Marie Skelly at Jackie Gross & Associates
for all their help and enthusiasm representing our product in Canada.
Lois Fraser, Connie McMenemy, and the rest of the great folks at Jaguar Book Group
for their help with distribution of Syngress books in Canada.
v
183_Ruby_FM.qxd 1/7/02 4:04 PM Page vi
Technical Editor’s
Acknowledgements
I’d like to thank the Syngress staff for their support, and John Small, who
encouraged me in overseeing the writing of this book. I’d like to thank
Matz for creating such a wonderful language; Dave and Andy for two
really great books about programming in general, and Ruby; Kentaro
Goto for his tutorial that directed me three years ago to Ruby; and
Hiroshi Nakamura for many valuable comments and explanations about
SOAP4R. Finally, thank you to the team of Merlin.zwo for being patient
with me, as well as to the whole Ruby community for letting me partici-
pate in such a great development.
vi
183_Ruby_FM.qxd 1/7/02 4:04 PM Page vii
Contributors
focuses on what can be learned from applying the complex but robust
systems found in nature to tools and methods for developing and testing
software. Robert also teaches courses on software engineering to students
in the Computer Science and Computer Engineering programs at
Chalmers University.
Robert holds a master’s degree from Chalmers University and is a
member of the IEEE. He has previously worked as a consultant software
engineer. He programs mostly in C, Haskell, and Ruby and uses Ruby
frequently in his research since its dynamic nature allows him to easily test
new ideas. He is working on a number of larger Ruby projects, including
the Rockit compiler construction toolkit and the RubyVM project, to
build a set of plug-and-play components for assembling Ruby virtual
machines.
Robert currently resides in Gothenburg, Sweden with his wife,
Mirjana, and daughter, Ebba. He wants to acknowledge them for their
support and love.
viii
183_Ruby_FM.qxd 1/7/02 4:04 PM Page ix
ix
183_Ruby_FM.qxd 1/7/02 4:04 PM Page x
183RubyToC.qxd 1/7/02 4:31 PM Page xi
Contents
Foreword xxiii
Chapter 1
■ Ruby’s design
Booting Ruby 1
philosophy is known
as the Principle of Introduction 2
Least Surprise. That An Overview of Ruby 2
means that Ruby Installing Ruby and its Tools 3
works the way that
you expect it to Installing Ruby on Unix 5
work. The more you Installing Ruby from Source Code 5
develop with Ruby, Installing from Packages 7
the more you’re
going to realize that Installing Ruby on a Windows System 7
you’re spending Installing Applications and Libraries
time producing from RAA 8
code—real code
which works, is IDE and Editor Support in Ruby 10
readable, and solves Emacs 11
the problems at VIM 12
hand.
Other Editors 12
RubyWin 12
Ruby Development Environment (RDE) 13
Additional Tools a Rubyist Must Have 13
Ruby Interactive (Ri) 14
Interactive Ruby (IRb) 15
Debugging Ruby Applications
with debug.rb 17
A Short Syntax Style Guide 22
Using Comments 22
Naming 23
Iterators 24
Indentation, Spacing, Parentheses 24
xi
183RubyToC.qxd 1/7/02 4:31 PM Page xii
xii Contents
Dangerous Ruby 25
Local Variables versus Methods 25
More Whitespace Issues 25
Block Local Variables 26
Comparing Ruby 26
Java 26
Perl 32
Language Constructs 32
Object-Oriented Programming 33
Access Control 34
Arrays and Hashes 35
Hashes 36
Iterators 36
Convincing Management to Use Ruby 37
Summary 39
Solutions Fast Track 39
Frequently Asked Questions 41
Chapter 2
GUI Toolkits for Ruby 43
Introduction 44
Using this Book’s Sample Applications 45
Using the Standard Ruby GUI:Tk 46
Obtaining Tk 46
Ruby/Tk Basics 47
Creating Responses to Tk’s Callbacks
and Events 48
Working with Ruby/Tk’s Layout Managers 50
Ruby/Tk Sample Application 54
Using the SpecTcl GUI Builder 67
Obtaining Tk Extensions:Tix and BLT 68
Using the GTK+ Toolkit 68
Obtaining Ruby/GTK 69
Ruby/GTK Basics 70
Programming Signals and Signal Handlers 71
Working with Ruby/GTK’s Layout Managers 72
Ruby/GTK Sample Application 76
183RubyToC.qxd 1/7/02 4:31 PM Page xiii
Contents xiii
xiv Contents
{129}
"The ship Argo was the theme of many songs during the oldest
periods of the Grecian Epic, even earlier than the Odyssey.
The king Æêtês, from whom she is departing, the hero Jason,
who commands her, and the goddess Hêrê, who watches over him,
enabling the Argo to traverse distances and to escape dangers
which no ship had ever before encountered, are all
circumstances briefly glanced at by Odysseus in his narrative
to Alkinous. ... Jason, commanded by Pelias to depart in quest
of the golden fleece belonging to the speaking ram which had
carried away Phryxus and Hellé, was encouraged by the oracle
to invite the noblest youth of Greece to his aid, and fifty of
the most distinguished amongst them obeyed the call. Hêraklês,
Thêseus, Telamôn and Pêleus, Kastor and Pollux, Idas and
Lynkeus--Zêtês and Kalaïs, the winged sons of
Boreas--Meleager, Amphiaraus, Kêpheus, Laertês, Autolykus,
Menœtius, Aktor, Erginus, Euphêmus, Ankæus, Pœas,
Periklymenus, Augeas, Eurytus, Admêtus, Akastus, Kæneus,
Euryalus, Pêneleôs and Lêitus, Askalaphus and Ialmenus, were
among them. ... Since so many able men have treated it as an
undisputed reality, and even made it the pivot of systematic
chronological calculations, I may here repeat the opinion long
ago expressed by Heyne, and even indicated by Burmann, that
the process of dissecting the story, in search of a basis of
fact, is one altogether fruitless."
{130}
ARGOS.--ARGOLIS.--ARGIVES.
ARGOS: B. C. 496-421.
Calamitous War with Sparta.
Non-action in the Persian War.
Slow recovery of the crippled State.
ALSO IN:
G. Grote, History of Greece, part 2, chapter 36 (volume 4).
{131}
ARGOS: B. C. 421-418.
League formed against Sparta.
Outbreak of War.
Defeat at Mantinea.
Revolution in the Oligarchical and Spartan interest.
ARGOS: B. C. 395-387.
Confederacy against Sparta.
The Corinthian War.
Peace of Antalcidas.
See GREECE: B. C. 399-387.
ARGOS: B. C. 371.
Mob outbreak and massacre of chief citizens.
ARGOS: B. C. 338.
Territories restored by Philip of Macedon.
ARGOS: B. C. 271.
Repulse and death of Pyrrhus, king of Epirus.
ARGOS: B. C. 229.
Liberated from Macedonian control.
ARGOS: A. D. 1463.
Taken by the Turks, retaken by the Venetians.
----------ARGOS: End----------
ARGYRASPIDES, The.
ALSO IN:
C. Thirlwall, History of Greece, chapter 58.
ARGYRE.
See CHRYSE.
ARIA.--AREIOS.--AREIANS.
The name by which the Herirud and its valley, the district of
modern Herat, was known to the ancient Greeks. Its inhabitants
were known as the Areians.
ARIANA.
"Strabo uses the name Ariana for the land of all the nations
of Iran, except that of the Medes and Persians, i. e., for the
whole eastern half of Iran."--Afghanistan and Beloochistan.
ARIANISM.--ARIANS.
ALSO IN:
J. Alzog, Manual of Univ. Ch. History, section 110-114.
See, also,
GOTHS: A. D. 341-381;
FRANKS: A. D. 481-511;
also, GOTHS (VISIGOTHS): A. D. 507-509.
"On the northern shore of the lake [of Nemi] right under the
precipitous cliffs on which the modern village of Nemi is
perched, stood the sacred grove and sanctuary of Diana
Nemorensis, or Diana of the Wood. ... The site was excavated
in 1885 by Sir John Saville Lumley, English ambassador at
Rome. For a general description of the site and excavations,
see the Athenæum, 10th October, 1885. For details of
the finds see 'Bulletino dell' Instituto di Corrispondenza
Archeologica,' 1885.--The lake and the grove were
sometimes known as the lake and grove of Aricia. But the town
of Aricia (the modern La Riccia) was situated about three
miles off, at the foot of the Alban Mount. ... According to
one story, the worship of Diana at Nemi was instituted by
Orestes, who, after killing Thoas, King of the Tauric
Chersonese (the Crimea), fled with his sister to Italy,
bringing with him the image of the Tauric Diana. ... Within
the sanctuary at Nemi grew a certain tree, of which no branch
might be broken. Only a runaway slave was allowed to break
off, if he could, one of its boughs. Success in the attempt
entitled him to fight the priest in single combat, and if he
slew him he reigned in his stead with the title of King of the
Wood (Rex Nemorensis). Tradition averred that the fateful
branch was that Golden Bough which, at the Sibyl's bidding,
Æneas plucked before he essayed the perilous journey to the
world of the dead. ... This rule of succession by the sword
was observed down to imperial times; for amongst his other
freaks Caligula, thinking that the priest of Nemi had held
office too long, hired a more stalwart ruffian to slay him."
ARICONIUM.
A town of Roman Britain which appears to have been the
principal mart of the iron manufacturing industry in the
Forest of Dean.
See LYGIANS.
ARIKARAS, The.
ARIMINUM.
ARISTOCRACY.--OLIGARCHY.
ARISTOMNEAN WAR.
ARIZONA:
Aboriginal Inhabitants.
ARIZONA: A. D. 1848.
Partial acquisition from Mexico.
ARIZONA: A. D. 1853.
Purchase by the United States of the southern part from Mexico.
The Gadsden Treaty.
----------ARIZONA: End----------
ARKANSAS, The.
ARKANSAS: A. D. 1803.
Embraced in the Louisiana Purchase.
ARKANSAS: A. D. 1819-1836.
Detached from Missouri.
Organized as a Territory.
Admitted as a State.
ARKANSAS: A. D.1862(December).
The Battle of Prairie Grove.
{134}
ARKANSAS: A. D. 1864.
First steps toward Reconstruction.
ARKANSAS: A. D. 1865-1868.
Reconstruction completed.
----------ARKANSAS: End----------
ARKITES, The.
ARLES: Origin.
See SALVES.
ARLES: A. D. 508-510.
Siege by the Franks.
ARLES: A. D. 933.
Formation of the kingdom.
ARLES: A. D. 1032-1378.
The breaking up of the kingdom and its gradual absorption in
France.
ARLES: 1092-1207.
The gay court of Provence.
----------ARLES: End----------
ARMAGEDDON.
See MEGIDDO.
ARMAGNACS.
See FRANCE: A. D. 1380-1415, and 1415-1419.
ARMENIA:
ARMENIA: B. C. 69-68.
War with the Romans.
Great defeat at Tigranocerta
Submission to Rome.
ARMENIA: A. D. 115-117.
ARMENIA: A. D. 1016-1073.
Conquest and devastation by the Seljuk Turks.