[#316551] "ensure" hiding actual error — Nit Khair <sentinel.2001@...>
In my main program I have a "begin ensure end".
2008/10/1 Nit Khair <sentinel.2001@gmx.com>:
Robert Klemme wrote:
2008/10/1 Nit Khair <sentinel.2001@gmx.com>:
Robert Klemme wrote:
Nit Khair wrote:
2008/10/1 Thomas B. <tpreal@gmail.com>:
Robert Klemme wrote:
On Wed, Oct 1, 2008 at 9:08 AM, Nit Khair <sentinel.2001@gmx.com> wrote:
Glen Holcomb wrote:
2008/10/1 Nit Khair <sentinel.2001@gmx.com>:
Stefan Lang wrote:
[#316561] String delete method help — Keith Johnston <keith@...>
Hi,
[#316571] Newbie question- Return method — James Schoonmaker <james.schoonmaker@...>
I'm trying to teach myself the basics of Ruby (based on the guide at
[#316580] Non blocking socket keep blocking on read ? — Serge Savoie <seurdge.sawa@...>
Hello everyone,
[#316597] Remotely passing value on system() or %x[] — Bikas De simex <mmabika@...>
Hi,
Alle Wednesday 01 October 2008, Bikas De simex ha scritto:
Stefano Crocco wrote:
Alle Thursday 02 October 2008, Bikas De simex ha scritto:
Stefano Crocco wrote:
Bikas De simex wrote:
Bikas De simex wrote:
[#316617] Ordered hash hack for < ruby 1.9? — Ben Johnson <bjohnson@...>
I am having an issue testing my code because hashes don't have a
On Wed, Oct 1, 2008 at 3:00 PM, Ben Johnson <bjohnson@binarylogic.com> wrote:
Why not iterate over myhash.keys.sort instead of just myhash.keys?
Patrick Doyle wrote:
Ben Johnson wrote:
That should have been called ordered_keys instead of ordered_values ...
Lex Williams wrote:
[#316650] simple gsub method — Jack Smith <js@...>
I have simplified my method for searching test to the following:
[#316678] printf statement - "args" as an Array (or something...) — John Pritchard-williams <monojohnny@...>
I'm trying to tart up some logged prepared SQL statements like this:
[#316686] Parsing non-delimited text file — Panu Kinnari <panu.kinnari@...>
Following post is a bit lengthy and I am not expecting to get fully
[#316696] eruby: problem defining a new method for Array — Davi Barbosa <d.barbosa+ruby@...>
Hello,
On Thu, Oct 2, 2008 at 4:19 PM, Davi Barbosa
[#316704] Problem extending (adding methods) to class — Nit Khair <sentinel.2001@...>
I am trying to extend a class developed by someone else (its from the
Nit Khair wrote:
Nit Khair wrote:
Lex Williams wrote:
Class defined inside a module behaves exactly the same as if she was defined
Jakub Pavl鱈k jn. wrote:
Hi --
David A. Black wrote:
Hi --
David A. Black wrote:
On Oct 2, 7:54 pm, Nit Khair <sentinel.2...@gmx.com> wrote:
ragav wrote:
[#316710] using win32-service — ahappydeath <silbermm@...>
I am trying to create a windows service with Ruby. I have successfully
[#316723] Is Assignment in a Conditional an Idiom? — worthee@...
Hi
On Thu, Oct 2, 2008 at 8:38 PM, <worthee@gmail.com> wrote:
On Thu, Oct 2, 2008 at 9:20 PM, Trans <transfire@gmail.com> wrote:
On Fri, Oct 3, 2008 at 5:16 AM, Robert Dober <robert.dober@gmail.com> wrote:
On Fri, Oct 3, 2008 at 10:18 PM, Gregory Brown
On 02.10.2008 20:35, worthee@gmail.com wrote:
Awesome!
2008/10/3 list. rb <list.rb@gmail.com>:
[#316732] pathname's each_entry — Claudio Greco <claudio_greco@...>
Hi all,
[#316760] Reg. Expressions with file directories — Trick Nick <bornemann1@...>
Im writing this program that is suppose to rename files using regular
[#316762] How to do ruby setup on linux? — Muhammad Asif <muasif80@...>
Hi All,
[#316768] mechanize 0.8.4 Released — Aaron Patterson <aaron@...>
mechanize version 0.8.4 has been released!
[#316788] Using Shell linux commands in Ruby! — Ch Asif <muasif80@...>
I have the following text that allows for having shell linux commands
pros and cons ?
[#316797] No warning for redefine — "Han Holl" <han.holl@...>
Hi,
[#316799] Iterate over array and add numbers of each object — Joshua Muheim <forum@...>
Hi all
[#316816] Explain this ruby regex — renton.dan@...
Can someone explain this regex ...
On Oct 3, 11:44=A0am, Ben Bleything <b...@bleything.net> wrote:
\w* does not match the space between string "one" and "two". it matches
[#316823] Calling a Defined Method at bottom of script — Jack Smith <js@...>
It seems that I have to place all the methods I have created at the top
[#316839] class << self — "Patrick Doyle" <wpdster@...>
Sorry if this is a FAQ, but I was just looking at some Ruby code and
None of them are really better; they all do the same thing. :)
Well, there is one difference -- the last one returns a different value for
Hi,
On Sat, Oct 04, 2008 at 07:13:03AM +0900, Stephen Celis wrote:
On Sunday 05 October 2008 12:23 pm, _why wrote:
Randy Kramer wrote:
[#316847] Making/Compiling Gems on Windows with MinGW — Cayce Balara <house@...>
Whenever I try to install a gem that doesn't have a precompiled binary
On Oct 3, 6:15=A0pm, Cayce Balara <ho...@balara.com> wrote:
>
[#316848] Tramadol Purchase Online 24/7 — manleyfuinclude@...
tramadol purchase
[#316859] Iterate through array and delete if match — jackster the jackle <johnsheahan@...>
I'm trying to delete elements of an array if they match a string but my
jackster the jackle wrote:
Tim Hunter wrote:
[#316876] module scope not clear to me — Nit Khair <sentinel.2001@...>
I had a program which inherits from a superclass. It also has
[#316894] Syntax to include custom Java classes — thiagobrandam <thiagobrandam@...>
Hi guys. This is a newbie's question: how do I do to include custom
I figured out how to do.
thiagobrandam wrote:
[#316904] Object Persistence for a MUD — Brent Dillingham <brentdillingham@...>
Hi all,
[#316907] stream closed (IOError) — "Eric Will" <rakaur@...>
This code:
Hi,
Line 231 is the @socket.close line. Nothing gets done to the socket
Hi,
On Sun, Oct 5, 2008 at 11:46 AM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
El Domingo, 5 de Octubre de 2008, Eric Will escribi=F3:
On Sun, Oct 5, 2008 at 12:03 PM, I=F1aki Baz Castillo <ibc@aliax.net> wrote=
Hi,
On Sun, Oct 5, 2008 at 12:33 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
On Sun, Oct 5, 2008 at 12:33 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
[#316912] question regarding sub!() — Martin Chandler <mchandler@...>
Hi,
[#316917] timeout question — Li Chen <chen_li3@...>
Hi all,
On Sun, Oct 5, 2008 at 8:36 PM, Li Chen <chen_li3@yahoo.com> wrote:
[#316958] Highline: Can I "ask" to STDERR — Jeremy Pruitt <jeremypruitt@...>
Hello, fellow ruby enthusiasts! I'm a first time caller, long time
[#316968] Ruby lacks atfork : The evil that lives in fork... — John Carter <john.carter@...>
Consider this simple usage of Thread and Process....
Hi,
On Mon, 6 Oct 2008, Yukihiro Matsumoto wrote:
Hi,
On Tue, 7 Oct 2008, Yukihiro Matsumoto wrote:
[#316978] Concurent (using threads) slower than sequential -doubt — Carlos Ortega <caof2005@...>
Hi Folks.
Hi,
2008/10/6 Yukihiro Matsumoto <matz@ruby-lang.org>
[#316988] Problem with comparing huge amount of strings — Jan Fischer <janfischer@...>
Hello together,
On Mon, Oct 6, 2008 at 1:03 AM, Jan Fischer <janfischer@mail.org> wrote:
Jan Fischer wrote:
[#316989] zena CMS first public release ! — "Gaspard Bucher" <gaspard@...>
After 3 years of work in my cave, I am happy to go out in the sunlight
[#317005] Hpricot elem index/position — "henryturnerlists@..." <henryturnerlists@...>
Hey,
[#317025] RINQ? — Trans <transfire@...>
Anyone else interested in creating a RINQ?
From: Trans [mailto:transfire@gmail.com]=20
[#317036] Mechanize select list help...? — Andy Pipes <mypipeline@...>
Hi.
[#317070] TestClass1 < TestClass0 < Test::Unit::TestCase — Emil Sandin <esandin@...>
Hi,
[#317091] Difference between Foo = Class.new and class Foo — Brandon Dimcheff <bdimchef@...>
I'm playing around with classes and discovered that
[#317100] how to remove strange characters — Li Chen <chen_li3@...>
Hi all,
SGksCgpPbiBUdWUsIE9jdCA3LCAyMDA4IGF0IDExOjI4IEFNLCBMaSBDaGVuIDxjaGVuX2xpM0B5
[#317122] Demand that Obama release his college records! Where is the media? — Micky <guuwwe@...>
Why is it important to see Obama's college records? Because the media
Micky wrote:
I enjoy the Ruby Talk mailing list as a reprieve from the politics that
On Oct 7, 11:24=A0pm, John W Kennedy <jwke...@attglobal.net> wrote:
On Wed, Oct 8, 2008 at 1:12 PM, Micky <guuwwe@hotmail.com> wrote:
[#317126] Ruby with Oracle forward slash error — Sam Sang <younoeme@...>
Hi,
2008/10/7 Sam Sang <younoeme@hotmail.com>:
On 16.10.2008 00:10, Sam Sang wrote:
Ok -- see what you mean, and doing that does make it a lot better! Just
[#317127] Looking for more Ruby-like way to create an array — Steve Nicholson <ssteve@...>
I'm creating an array that is the result of the members of another array
On Oct 7, 4:33=A0pm, Steve Nicholson <sst...@mac.com> wrote:
Hi --
[#317137] Ruby on Solaris 10? — jackster the jackle <johnsheahan@...>
I have a server running Solaris 10 that I need to install Ruby on in
[#317168] ruby-ole-1.2.8 released! — "Charles L." <aquasync@...>
The new version of ruby-ole has been released!
[#317184] calling methods of subclassed thread — "christoforever@..." <christoforever@...>
As you will see at the bottom of this code snippet, i've commented out
[#317200] Suggestions for common/global data in app (cli) — Nit Khair <sentinel.2001@...>
I am writing a (my first) client side ruby app. Many programs use the
[#317209] gem 1.3.0, netbeans 6.1 "Missing the Rails gem" — "Pablo Q." <paqs140482@...>
I'm on ubuntu 8.04 and I'm using netbeans 6.1 with native ruby option.
[#317219] gem_original_require zlib problem — Steve Dame <stephen.g.dame@...>
I'm trying to just to a first time install of gems (and net/ssh ) in
[#317221] Auto-recognize links? — Josh Pigford <josh@...>
In PHP I've got a few functions that will turn data into links based on
[#317228] Filling a hash from an enumerable — Pete Hodgson <phodgson@...>
Hi folks,
From: Pete Hodgson [mailto:phodgson@lyris.com]=20
[#317252] Bug in Vector class? — Dave Baldwin <dave.baldwin@3dlabs.com>
require 'matrix'
[#317259] tkxml — Trans <transfire@...>
Ok. How about any interest in creating Tk GUIs form an xml markup. Eg.
[#317271] simple regexp help needed - pull phrase out of string — Max Williams <toastkid.williams@...>
Hey folks. I feel like this should be easy but it's been a long week
[#317286] "print" not showing immediately in output, but "puts" is — Aryk Grosz <tennisbum2002@...>
Several times I have come across this issue. It seems to be dependent on
On Oct 9, 2008, at 3:28 PM, Aryk Grosz wrote:
Thanks for the information Rob.
[#317299] Error with gems 1.2.0 on ubuntu hardy — Bruno Moura <brunormoura@...>
First I apologize my poor English.
Bruno Moura wrote:
Thank's but After zlib1g libs installation the problem has not solved
[#317301] parse tree for 1.9 — Roger Pack <rogerpack2005@...>
Anybody know if there is anything like parse_tree for 1.9?
[#317302] stickler 0.1.0 Released — Jeremy Hinegardner <jeremy@...>
stickler version 0.1.0 has been released.
[#317308] Help me to better understand modules — Zouplaz <user@...>
Hello, I would like to use ruby modules for the first time. I understand
[#317313] minitest 1.3.0 Released — Ryan Davis <ryand-ruby@...>
[#317326] Thread: super should be first line or last line? — "christoforever@..." <christoforever@...>
While playing around with ruby threads I noticed that if you dont call
[#317337] Modular Arithmetic (#179) — Matthew Moss <matt@...>
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=
[#317342] Ruby Sleep — Ricardo Giorni <ricardogg@...>
Hi all
[#317344] Running Multiple Versions of Ruby on Debian? — John Griffiths <indiehead@...>
Well so far things are going kind of good, I've built my own server and
[#317345] mkmf generates corrupt makefile in 1.8.6 — "Avdi Grimm" <avdi@...>
I just noticed (because libxml-ruby wouldn't compile) that the mkmf.rb
[#317359] Why is Ruby Website Search Broken? — Steve Dame <stephen.g.dame@...>
Is it just me, or is everyone aware that the Ruby main search is broken
[#317363] Writing an OO wrapper (UI) — Nit Khair <sentinel.2001@...>
I am writing an app generator for ncurses-ruby.
On Fri, Oct 10, 2008 at 12:05 PM, Nit Khair <sentinel.2001@gmx.com> wrote:
Martin DeMello wrote:
[#317395] Automatic ClassLoader (to eliminate 'require') — Alexey Petrushin <axyd80@...>
Hello!
module AutoRequire
Thanks! It works! :)
Alexey Petrushin wrote:
I'm hurry up, there are some bugs in current implementation. Do not use
I released it as gem, Quick Start here
On 15.06.2009 21:18, Alexey Petrushin wrote:
Not exactly understood what you mean, as i know 'autoload' works almost
2009/6/16 Alexey Petrushin <axyd80@gmail.com>:
Now i understood, you are absolutely right, explicit 'require' gives you
[#317401] Calc Days from Date — relzne@...
Hello.
[#317406] newbie q: stripping duplicates — pierodancona@...
This is certainly well known, but not to me.
[#317421] "FireRuby" (Ruby script for FirePHP) — "T.N.T." <tnt@...>
Hello group
[#317422] Sample for Metaprogramming — relzne@...
Hi.
relzne@bluewin.ch wrote:
On Sun, Oct 12, 2008 at 02:35:34AM +0900, Sebastian Hungerecker wrote:
Chad Perrin wrote:
On Thu, Oct 16, 2008 at 12:27:05AM +0900, Sebastian Hungerecker wrote:
[#317436] ANN: Sequel 2.6.0 Released — Jeremy Evans <code@...>
* Sequel provides thread safety, connection pooling and a concise DSL
[#317442] Compare Arrays — Tj Superfly <nonstickglue@...>
Hey, I just have a quick question about arrays.
[#317451] Hi I have a Debian 4 machine with Ruby 1.8.6 (installed from source) and some gems including Rails 2.1 and Phusion Passenger 2.0.3 (mod_rails, which needs fastthread and rack gems). I want to update to the latest patch of that version (1.8.6-p287), but I have my concerns. Can I do it safely? Is there any warning, any catch? Will I have to reinstall RubyGems and every single gem? What's your advice before patching? Will all the dependent apps be screwed up? I'm asking this because, unfortunately, there's no "make uninstall" command after installing Ruby from source... Really! I tried, but failed miserably. The only choice I see is to erase the folder where it's located, I doubt installing the patch overwrites all the files. Any suggestion is welcomed. Later... Juan "The Neurochild" EscajadilloUpdating Ruby 1.8.6 to 1.8.6-p287 in Debian 4 — The Neurochild <neurochild@...>
Hi
[#317452] Updating Ruby 1.8.6 to 1.8.6-p287 in Debian 4 — The Neurochild <neurochild@...>
Hi
On Sun, 12 Oct 2008 11:41:58 -0500, Erik Hollensbe wrote:
In article <40c7d0973ffa54eff620c0c70682d3c5@ruby-forum.com>,
Ollivier Robert wrote:
On Mon, Oct 13, 2008 at 6:56 AM, Brian Candler <b.candler@pobox.com> wrote:
Gregory Brown wrote:
[#317462] description, what is it? — Zhenning Guan <g.zhen.ning@...>
I read a class like this.what's the description work for?
[#317468] why the object doesn't respond to its method? — Li Chen <chen_li3@...>
Hi all,
Li Chen wrote:
Thomas B. wrote:
Li Chen wrote:
[#317485] regexp with accent insensitive ?? — Davi Barbosa <d.barbosa+ruby@...>
Hello,
[#317486] Procedure vs method — Kless <jonas.esp@...>
What advantage or difference has a procedure (Proc) over a method?
Kless wrote:
[#317502] Sorting help — Binh Ly <binh@...>
Hello All,
2008/10/13 Binh Ly <binh@pigbaby.net>:
Hi All,
On 13.10.2008 18:20, Joe W=F6lfel wrote:
[#317510] dynamic evaluation from a database — Allan Peda <allan.peda@...>
Hi,
[#317547] spreadsheet 0.6.0 Released — "Hannes Wyss" <hannes.wyss@...>
spreadsheet version 0.6.0 has been released!
[#317549] Namespacing my classes — Zouplaz <user@...>
Hello, as I want to avoid name clashes I tried to organise them like
Zouplaz <user@domain.invalid> writes:
On Oct 13, 9:12=A0am, p...@informatimago.com (Pascal J. Bourguignon)
On 13.10.2008 18:49, Yossef Mendelssohn wrote:
[#317554] visual studio 2005 — Eric Teng <renyu_teng@...>
Hi guys,
[#317566] Accessing Ruby Object in Memory — Bryan Richardson <btrichardson@...>
Hello all,
[#317574] Unable to trap C-z, C-y, C-s and C-q — Nit Khair <sentinel.2001@...>
I need to trap ^Y, ^Z, ^S, ^Q etc in my app. Have googled a lot but
[#317583] Ruby audio API (hopefully in a new thread, sorry for the duplication) — Joe Wfel <joe@...>
Hi All,
[#317601] Using DBI and MySQL gems — Owein Herrmann <oherrmann@...>
Quick question:
Owein Herrmann wrote:
Erik Hollensbe wrote:
[#317606] Problem with bind for Socket class — Vladimir Fekete <fekete@...>
Hi *,
[#317607] Using Net SSH to issue command on remote windows XP — Saritha Yeddula <syeddula@...>
Hi,
Hi,
Heesob Park wrote:
[#317622] Re: Threads — Phy Prabab <phyprabab@...>
Never mind, I resolved the issue by reading a bit more. Sorry to waste the thread.
[#317642] User home — Kless <jonas.esp@...>
Is there any method to get the value of user home which in Linux would
[#317649] Get system name — Kless <jonas.esp@...>
Is there any method that returns the operating sytem being used?
Check out the Ruby Constants... PLATFORM could be one.
[#317658] Remove only TRAILING whitespace — Bob Smyph <eric.ramsey@...>
Is there any way to only remove trailing white space from a string. I
[#317673] Multiple Processors on Windows 64-bit — Bryan Richardson <btrichardson@...>
Hello all,
2008/10/14 Bryan Richardson <btrichardson@gmail.com>:
Thanks for the reply Robert. I'm accessing a MySQL database from the
2008/10/15 Bryan Richardson <btricha@gmail.com>:
Well, I'm not sure the 'start /affinity' approach is fixing my problem
[#317684] Xml Decleration using builder — Dan Webb <dbw@...>
I'm trying to create an XML file and I don't see any way with the
[#317694] Lame question about instance variable and attribute — dkmd_nielsen <donn@...>
Assuming an attribute :field is defined, is there a processing
[#317706] Problem stored values in Oracle — Mario Ruiz <mario@...>
If I enter in my website the value テゥI9テ〈'テ從Pt窶「 the last character is
I found the problem.
[#317729] Could not find RubyGem - because it's not a gem — Daniel Berger <djberg96@...>
Hi all,
[#317735] Diff for 2 Text Files — jackster the jackle <johnsheahan@...>
Is there an easy way available in Ruby to compare two text files and
[#317758] Big endian convention in Ruby — Zangief Ief <z4n9ief@...>
Hello,
On 16.10.2008 10:26, Zangief Ief wrote:
Thanks you for you answer.
Zangief Ief wrote:
On 16.10.2008 15:25, Brian Candler wrote:
Thank you all for your help.
Zangief Ief wrote:
Just to make this clearer: the padding operation just pads the message
Brian Candler wrote:
Ashrith Barthur wrote:
Brian Candler wrote:
[#317759] How to go from a ruby script to a working website? — Ralph Wood <esmero@...>
As you've probably guessed by the title, total newbie here.
[#317760] Problem with warbler — Bahaw Anyone <bahaw@...>
I am using jruby 1.1.4 and installed warbler 0.9.11 in Windows XP. When
Btw, I am using JDK 1.5.
Bahaw Anyone wrote:
Bahaw Anyone wrote:
[#317765] newbie to ruby, search an array — Chris Ashton <christopherashton@...>
hi, im fairly new to ruby and cud do with some help
Chris Ashton wrote:
thanks for the help, i really appreciate it, worked a treat
[#317769] A Ruby block question — David Trasbo <davidtrasbo@...>
I am in need of making a method that accepts a block. It basicly needs
Alle Thursday 16 October 2008, David Trasbo ha scritto:
Stefano Crocco wrote:
Alle Thursday 16 October 2008, David Trasbo ha scritto:
Stefano Crocco wrote:
David Trasbo wrote:
Hi --
David A. Black wrote:
On Thu, 16 Oct 2008, David Trasbo wrote:
David A. Black wrote:
David Trasbo wrote:
Hi --
David A. Black wrote:
[#317776] I found way to protect Source Code! :) — Alexey Petrushin <axyd80@...>
Hello!
Interesting solution. May I also suggest that you try
Ade Inovica wrote:
Mike Gold wrote:
Thanks for advices :)
On Sun, Oct 19, 2008 at 05:07:59AM +0900, Alexey Petrushin wrote:
On Fri, Oct 17, 2008 at 1:55 AM, Mike Gold <mike.gold.4433@gmail.com> wrote:
On Fri, Oct 24, 2008 at 02:41:58PM +0900, Ryan Davis wrote:
On Sat, Oct 25, 2008 at 06:07:00AM +0900, Ryan Davis wrote:
[#317786] symbol confusions!! — Jay Pangmi <jaeezzy@...>
Hi, I'm new to ruby and I'm going thru pretty good as I've done java but
On Oct 16, 2008, at 8:07 AM, Jay Pangmi wrote:
[#317799] Quiz summary coming later tonight — Matthew Moss <matt@...>
Quiz summary is a little delayed, but will show up today.
[#317807] what is [] here — Raj Singh <neeraj.jsr@...>
class User
[#317821] newbie adding to array question — Roger Reeks <christopherashton@...>
[#317848] Shoes GUI - downloading site, using reg exs on body — Double Minus <nathan.wisman@...>
So I want my app to download the text of a site's body (easy) and then I
On Fri, Oct 17, 2008 at 03:05:51AM +0900, Double Minus wrote:
[#317867] Damn you cmd.exe! — "Adam Skobi" <dxm997@...>
Hi,
[#317870] about lambda and its binding — Rolando Abarca <funkaster@...>
is there a way to specify the binding of a proc created through lambda?
[#317875] Need help to install "linguistics" gem — "Hunt Jon" <jona.hunt777@...>
Hi,
[#317878] instance counter — Pierre Lebrun <anthonylebrun@...>
Please forgive the trite nature of this question, I'm new to ruby and OO
Tommy Nordgren wrote:
On 17.10.2008 07:19, Mike Gold wrote:
Robert Klemme wrote:
> I've spent too much time tracking down the bewildering bugs caused by
2008/10/19 Marc Heiler <shevegen@linuxmail.org>:
2008/10/20 Robert Klemme <shortcutter@googlemail.com>:
2008/10/20 Pit Capitain <pit.capitain@gmail.com>:
2008/10/20 Robert Klemme <shortcutter@googlemail.com>:
[#317896] socket recv or gets? — Jamal Soueidan <jamal@...>
Hello there,
[#317921] RSA public_encrypt bug? — "Dani Pardo" <jiffier@...>
Hi, I'm trying to encrypt some data with an RSA public key, this is
[#317938] Error Exception if script doesn't run — jackster the jackle <johnsheahan@...>
I need to know if my script fails to run for any reason and capture the
jackster the jackle wrote:
I notice that any shell commands that I have in the script that fail do
jackster the jackle wrote:
It seems to work but not for this command, perhaps since scp gets
jackster the jackle wrote:
Tim Hunter wrote:
jackster the jackle wrote:
Brian Candler wrote:
jackster the jackle wrote:
That really helps clear things up..thanks.
[#317966] Counting — Tom Clarke <thomas.clarke08@...>
How would i go about making Ruby count to say 1000 usin only multiples
Sorry i meant to say 2 and 5
Tom Clarke wrote:
Don't need no stinkin' select either;) It's much faster if you don't
[#317987] Hiding default console window — -- -- <matma.rex@...>
I wrote simple Ruby console program that reads file, modifies it in way
[#317989] define_method inside a module — MR Damien <mr.damien@...>
hi,
MR Damien wrote:
[#317996] Ruby and OpenSSL: no such file to load -- openssl (RuntimeError) — "Redd Vinylene" <reddvinylene@...>
I'm getting this error on Cygwin when trying to run this tiny little Rails app:
On Sat, Oct 18, 2008 at 3:28 PM, Redd Vinylene <reddvinylene@gmail.com> wrote:
On Sat, Oct 18, 2008 at 10:17 AM, Redd Vinylene <reddvinylene@gmail.com> wrote:
[#318008] Low level syntax highlighting tools? — "Gregory Brown" <gregory.t.brown@...>
I'll confess I didn't research this deeply, in hopes that someone
[#318021] Handling invalid options with OptionParser — Adam Penny <adam_penny@...>
Hi there,
[#318035] Using a result as a constant object? — Phy Prabab <phyprabab@...>
Hello,
Phy Prabab wrote:
2008/10/19 Tim Hunter <TimHunter@nc.rr.com>:
[#318037] Launch ruby script from Quicksilver — Adam Walters <ajwalters@...>
Hello,
[#318047] prob with ranges — Junkone <junkone1@...>
i looked at an example
[#318071] Proc metaprogramming tricks? — Adam Skobi <dxm997@...>
Hi,
=0D=0A>> I'm building a DSL and trying some weird syntax structures. My DSL
[#318088] Emacs / rcodetools — Leon Bogaert <leon@...>
Hi all,
[#318104] require sqlite? — Jamal Soueidan <jamal@...>
Hi,
[#318112] Rake Rule name problem — Jim flip <james@...>
That should read
[#318128] Best Command Prompt — gewton <gjhames@...>
There's a good command interpreter for ruby instead of irb? Like
[#318135] Way to split a string based on fixed length? — Wayne Molina <wayne@...>
This is probably a newb question but I can't seem to figure it out. I
[#318139] Gems (1.3.0) not visible from ruby (1.8.7) — Joni Niemi <joni.niemi@...>
Hi,
[#318163] Block method to yield stdout? — "List.rb" <list.rb@...>
All, I've written a distribution service that spawns processes using
[#318166] Threading best practices? — Dolazy <francis.rammeloo@...>
I am developing a small GUI application using jruby. It will be used
[#318179] Can anyone tell me why my code isn't working? — Adam Penny <adam_penny@...>
Hi there,
[#318200] what's different between self.method and class << self? — Zhenning Guan <g.zhen.ning@...>
we can define a instance method in lots way.
[#318215] Ruby way to take some action only once in a loop? — "Evgeniy Dolzhenko" <dolzenko@...>
This example is slightly contrived, but I hope it does illustrate the question.
Hi,
2008/10/21 Nobuyoshi Nakada <nobu@ruby-lang.org>:
2008/10/21 Robert Klemme <shortcutter@googlemail.com>:
You do not say if the "do once" code must rely on something obtained in
On Tue, Oct 21, 2008 at 9:05 AM, Lloyd Linklater <lloyd@2live4.com> wrote:
[#318222] Problems with "scruffy" — Andrés Suárez <ansuga@...>
Hi,
[#318237] Cygwin: Dir.glob ALWAYS accesses floppy?? — Hugh Sasse <hgs@...>
I'm finding under Cygwin, with
If cygwin is installed on your c drive, then you will want to avoid
Welcome back, Hugh!
[#318240] Stripping characters off a string — "Chris Causer" <chy.causer@...>
Hi everyone,
Isn't it like
On Tue, Oct 21, 2008 at 4:39 PM, Evgeniy Dolzhenko <dolzenko@gmail.com>wrote:
[#318241] packing algorithm in Ruby — John Small <jds340@...>
I have a simple problem in Rails, I need to pack lists of things onto
[#318255] Where is libopenssl-ruby — "Ruby Student" <ruby.student@...>
While installing Rails, I came across the fact that I need this library,
[#318256] Help with regular expression — "Ruby Student" <ruby.student@...>
Team,
[#318282] convert html to image — cjokomay <cjokomay@...>
I would like to take an html file, or even just an html string, and
[#318286] Trollop 1.10 released — William Morgan <wmorgan-ruby-talk@...>
Trollop version 1.10 has been released!
William Morgan wrote:
Reformatted excerpts from rogerpack2005's message of 2008-10-21:
Hi,
[#318294] $LOAD_PATH and different OSes — Greg Willits <lists@...>
Looking for best practice guidance on dealing with differing paths to
[#318301] extending object with another object — Ittay Dror <ittay.dror@...>
Hi,
[#318309] Is there a method_eval or similar thing ? — Nit Khair <sentinel.2001@...>
I have a method called askyesno which takes a string and returns whether
I think that maybe you can wrap everything in a class:
Sandro Paganotti wrote:
On Wed, Oct 22, 2008 at 7:54 AM, Nit Khair <sentinel.2001@gmx.com> wrote:
Nit Khair wrote:
Brian Candler wrote:
[#318323] What exactly does "rubyish" or "ruby way" mean? — Nit Khair <sentinel.2001@...>
Over the last month I have been reading a lot of blogs, searching, going
[#318339] Rake: How do I Override Var's Used by a Rule? — Brock Rycenga <brock.rycenga@...>
All:
[#318367] subclass a class in the namespace of the that subclass — Trans <transfire@...>
Ever get stuck on a problem, and then after staring at it for way too
[#318371] neatest way to extend Struct — "Martin DeMello" <martindemello@...>
I want a Structlike class that takes a hash constructor, so I can say
Hi --
[#318378] i need to represent data as percentages — Trick Nick <bornemann1@...>
basically i go through a document count up the total number of times the
[#318393] ruby_parser 2.0.0 Released — Ryan Davis <ryand-ruby@...>
Very, very cool.
[#318408] using buttons in CGI — Asaf Asaf <assafdassa@...>
Hi all,
[#318458] Any nice way to get a temporary directory? — Kenneth McDonald <kenneth.m.mcdonald@...>
I'd like to be able to obtain a temporary directory in the same way I
Could you call Dir.mkdir with the result of Dir.tmpdir plus the name of the
There is, sadly, no Dir.tmpdir function in Ruby.
On Thu, Oct 23, 2008 at 4:45 PM, Kenneth McDonald
[#318482] Problem with using active support core extensions in my own ruby programs — Jonathan Groll <lists@...>
This code used to perform correctly with activesupport 2.0.2:
[#318483] Errors while file uploading thr 'net/http' or 'rest-open-uri' client — saurabh.purnaye@...
I am trying to upload a file to API thr the 'net/http' or 'rest-open-uri'
[#318486] Bound macro in ruby — Me Me <emanuelef@...>
Hi all,
2008/10/24 Me Me <emanuelef@tiscali.it>:
[#318487] LDAP authentication in Windows 2003 AD — Damjan Rems <d_rems@...>
Le 24 octobre 13:53, Damjan Rems a 馗rit :
On Fri, Oct 24, 2008 at 6:15 AM, F. Senault <fred@lacave.net> wrote:
[#318502] Bowling Scores (#181) — Matthew Moss <matt@...>
Apologies for not having the Long Division quiz summary done yet. It
[#318509] How to tell if two paths point to the same file? — Kenneth McDonald <kenneth.m.mcdonald@...>
I've tried using File.expand_path to normalize path names, but this
Hi,
From the documentation, that seems to compare to different files to
[#318523] RubyMacros 0.1.0 Released — "Caleb Clausen" <vikkous@...>
RubyMacros is a lisp-like macro pre-processor for Ruby. More than just a
[#318526] help with regular expressions — Vandana <nairvan@...>
Hi all,
Vandana wrote:
On Fri, Oct 24, 2008 at 6:05 PM, Siep Korteling <s.korteling@gmail.com>wrote:
[#318547] Word + win32ole - how to find formatting of a word? — Mohit Sindhwani <mo_mail@...>
HI! I'm trying to use Ruby and win32ole to parse a Word document. So
> HI! I'm trying to use Ruby and win32ole to parse a Word document. So
[#318552] Join all text files in a folder, with a single line of Ruby code — luisbebop <luisbebop@...>
I did a single line of code in Ruby, which joins all text files in a
luisbebop wrote:
luisbebop wrote:
William James wrote:
Hi,
Nobuyoshi Nakada wrote:
> ruby -pe'1' *
luisbebop wrote:
From: Joel VanderWerf [mailto:vjoel@path.berkeley.edu]=20
Pe wrote:
Hi,
From: Nobuyoshi Nakada [mailto:nobu@ruby-lang.org]=20
Hi,
[#318555] Drafting of Ruby International Standard — Shugo Maeda <shugo@...>
Hello,
Is your extraction of the language specification from the various
[#318570] Open a MS Excel file from within Ruby — RichardOnRails <RichardDummyMailbox58407@...>
Hi.
[#318576] regular expressions and conditionals — Matt Harrison <iwasinnamuknow@...>
I'm writting a little program to convert some source files to html.
[#318577] question about method call — Li Chen <chen_li3@...>
Hi all,
2008/10/25 Li Chen <chen_li3@yahoo.com>:
Robert Klemme wrote:
[#318578] Extracting information from "john-2222-8888@domain.com" — Bob Sanders <small.business.strategy@...>
Hello,
[#318601] Hash.merge_add! extension - how does this code look? — "Greg Hauptmann" <greg.hauptmann.ruby@...>
Hi,
Greg Hauptmann wrote:
thanks for highlighting this! Is the quickest way to normalise to Array via
Greg Hauptmann wrote:
I just noticed the code suggested might have a problem when the
thanks all for feedback to date - here's my latest take
interesting - is it really Ruby approach to let things 'break' during
Greg Hauptmann wrote:
[#318602] QtRuby: system tray — Andrew Lepyokhin <la.bizzz@...>
Hello, fellow rubyists!
[#318610] Init attributes and set value — Stephan Meier <phoenix@...>
Hey all,
[#318620] Two Variables to One Definition? — Tj Superfly <nonstickglue@...>
Is it possible to send two different variables to one definition and
[#318634] Iconv problem - not handling \r correctly — Louise Rains <rainyglade@...>
I have an XML file that I need to process. I'm working in the Windows
[#318643] Named arguments gem — Macario Ortega <macarui@...>
Daniel Berger wrote:
[#318649] connection error in webrick server — Cedric Rosario <xeddr@...>
I did a simple server in ruby using webrick as shown in the
On 27.10.2008 07:06, Cedric Rosario wrote:
[#318657] Access module's anonymous parent — Xavier Shay <contact@...>
I want the following eval to output "Foo called", without having a named
[#318664] save object reference in db? — Jamal Soueidan <jamal@...>
Hi everyone,
[#318675] Days in a year — Pål Bergström <pal@...>
How do I get number of days in a year?
[#318681] how to detect if #super exists? — Chuck Remes <cremes.devlist@...>
I'm writing some modules that I use to replace/extend the
2008/10/27 Chuck Remes <cremes.devlist@mac.com>:
[#318682] format an integer — Me Me <emanuelef@...>
Hi,
Q_txt =3D res_q[0][1]
[#318687] How to update gem to a version that's not the latest ? — Gaudi Mi <swearingendw@...>
I posted an earlier question but am amending it with this question
[#318700] float equality — "guille lists" <guilledist@...>
Hi,
On Mon, Oct 27, 2008 at 11:50 AM, guille lists <guilledist@gmail.com> wrote:
> Totally off-topic, but has any one figured out exactly why 1/9
[#318721] automatic code conversion from Ruby to C ? — "Axel Etzold" <AEtzold@...>
Dear all,
On 27.10.2008 20:44, Axel Etzold wrote:
2008/10/27 Robert Klemme <shortcutter@googlemail.com>:
Dear Florian, Brian, Robert and Mohit,
[#318771] Ruby 1.9.1 preview1 is out — "Yugui (Yuki Sonoda)" <yugui@...>
Hi all,
[#318808] irb: Is it possible to automatically create a subsession on startup? — wfisk <william.fisk@...>
In irb I can create an object and then create a new subsession with
yes I am using .irbrc, but it doesn't work when you pur
[#318809] lambda and multiple arguments: how?! — nvp <ruby-lists@...>
Hello,
[#318813] oracle_enhanced adapter 'uninitialized constant' error — Cetric Blue <shalicheng@...>
Hi,
And here is what's in my database.yml file:
On Tue, Oct 28, 2008 at 1:06 PM, Cetric Blue <shalicheng@gmail.com> wrote:
Todd Benson wrote:
On Tue, Oct 28, 2008 at 2:02 PM, Cetric Blue <shalicheng@gmail.com> wrote:
[#318815] createing directories and moving files into it — Bee Tard <scappa@...>
I have an undetermined list of directories.
[#318817] Proper way to define a subclass within parent file? — Scott Strattner <strattner@...>
I am starting to build a script to manipulate various network device
[#318821] OSX: Can't install RMagick. Can't find the ImageMagick lib — Joshua Muheim <forum@...>
Hi all
> Gem files will remain installed in
>> Results logged to
[#318860] Simple LDAP query — "Chris Henderson" <henders254@...>
I'm using ruby-1.8.6 and trying to query my Windows Active Directory
[#318871] OSX: require seems very slow — Matt Wynne <matt@...>
Hi,
[#318874] socket from python to ruby — Devis Battisti <batdevis@...>
I'd want to port this code from python to ruby:
[#318879] Bug or not a bug? array*=int — "Kyle Schmitt" <kyleaschmitt@...>
So I'm wondering, is this a bug, or not a bug, or a type-o in the docs?
On Wed, Oct 29, 2008 at 8:30 AM, Kyle Schmitt <kyleaschmitt@gmail.com> wrote:
[#318888] project manager panel in SciTE — Li Chen <chen_li3@...>
Hi all,
[#318896] RubyGems 1.3.1 — Eric Hodel <drbrain@...7.net>
= Announce: RubyGems Release 1.3.1
On Oct 30, 1:46=A0am, Bil Kleb <Bil.Kleb-use...@nasa.gov> wrote:
I've had a look for exception in here but nothing quite does the job.=20
[#318897] Hosting for Ruby Latinoamerica — "Pablo Q." <paqs140482@...>
Hi all,
[#318905] which is right place to submit bugs — Roger Pack <rogerpack2005@...>
What is the relationship between
Hi,
> Hi,
Ryan Davis wrote:
Hi,
[#318908] Sorting Array Of Dates — Chandu Chandu <chandu_750@...>
Hi, Everyone I am a newbie to ruby....
[#318913] array comparison — Chad Perrin <perrin@...>
I can easily write a program to compare the contents of arrays, of
[#318914] Question about case statement and lambdas — Jeff <cohen.jeff@...>
I fear this has an obvious answer that I'm just not figuring out.
[#318918] how to set up Epson FX 2175 printer — Dureza Diaz <durezauberita@...>
Hi all..
[#318955] Using Expect in Ruby — "stephan.zimmer" <stephan.zimmer@...>
I'm using Expect inside of a ruby script to control an external
[#318970] Roguelike project? — Tim Mcd <tmcdowell@...>
Anyone interested in a Roguelike game written in Ruby/Ncurses project?
> Anyone interested in a Roguelike game written in Ruby/Ncurses project?
On Fri, Oct 31, 2008 at 3:42 AM, Matthew Moss <matt@moss.name> wrote:
Michael Fellinger wrote:
On Sat, Nov 1, 2008 at 1:46 AM, Nit Khair <sentinel.2001@gmx.com> wrote:
Michael Fellinger wrote:
Michael Fellinger wrote:
Nit Khair wrote:
Nit Khair wrote:
Nit Khair wrote:
>>> Michael Fellinger wrote:
On Mon, Nov 10, 2008 at 12:16 AM, Nit Khair <sentinel.2001@gmx.com> wrote:
Michael Fellinger wrote:
Nit Khair wrote:
On Mon, Nov 10, 2008 at 4:57 AM, Nit Khair <sentinel.2001@gmx.com> wrote:
Michael Fellinger wrote:
Michael Fellinger wrote:
On 30/10/2008, Tim Mcd <tmcdowell@gmail.com> wrote:
Michal Suchanek wrote:
On 01/11/2008, Nit Khair <sentinel.2001@gmx.com> wrote:
On Sun, Nov 2, 2008 at 7:55 AM, Michal Suchanek <hramrach@centrum.cz> wrote:
Michael Fellinger wrote:
On Sun, Nov 2, 2008 at 6:32 AM, Nit Khair <sentinel.2001@gmx.com> wrote:
[#318977] Ruby Mastermind Game — Steve Jones <ppksam14@...>
Hi all,
[#318988] how to sort this array — Li Chen <chen_li3@...>
Hi,
[#318995] Newbie Metchanize Question — Becca Girl <cschall@...>
Hello.
[#319019] rb_sys_fail(socket(2)) Ticket #9438 — "Shawn Fessenden" <s_fessenden@...>
Where are we with respect to the (Windows) one click installer & this issue?
[#319021] XML builder performance — Xin Zheng <crazygecko@...>
Hi all,
On Fri, Oct 31, 2008 at 9:01 AM, Xin Zheng <crazygecko@gmail.com> wrote:
[#319044] Netbeans 6.1 IDE - new install - ruby error? jruby? — "Brian A." <judobrian+ruby-forum@...>
Hello -
[#319055] How to access to local variables in enclosing scopes? — Yuh-Ruey Chen <maian330@...>
I'm familiar with other popular scripting languages (JS and Python),
Replying to multiple posts:
[#319067] Data Structs in Ruby — Edipofederle Edipofederle <edipofederle@...>
Hello,
[#319094] FFI 0.1.1 (Foreign Function Interface) for Ruby 1.8.6/7 and 1.9 — Charles Oliver Nutter <charles.nutter@...>
The JRuby team is proud to announce the release of FFI for Ruby 1.8.6/7
* Charles Oliver Nutter (charles.nutter@sun.com) wrote:
Thomas Hurst wrote:
Charles Oliver Nutter wrote:
Clifford Heath wrote:
Charles Oliver Nutter wrote:
On 1 nov. 08, at 11:19, Charles Oliver Nutter wrote:
Luc Heinrich wrote:
On 1 nov. 08, at 12:16, Charles Oliver Nutter wrote:
On Sat, Nov 01, 2008 at 08:16:39AM +0900, Charles Oliver Nutter wrote:
Sylvain Joyeux wrote:
>> Interesting. On what kind of architectures is the binding part working ? I'm
We (JRuby and Rubinius contributors) designed in the ability to
Charles Oliver Nutter wrote:
Charles Oliver Nutter wrote:
On Tue, Nov 04, 2008 at 04:54:35AM +0900, Charles Oliver Nutter wrote:
On Fri, 31 Oct 2008 18:16:39 -0500, Charles Oliver Nutter wrote:
On Tue, Nov 4, 2008 at 2:38 PM, Ken Bloom <kbloom@gmail.com> wrote:
Sean O'halpin wrote:
Nit Khair wrote:
On Tue, Nov 4, 2008 at 7:02 PM, Charles Oliver Nutter
Sean O'Halpin wrote:
On Wed, Nov 5, 2008 at 4:34 AM, Charles Oliver Nutter
Sean O'halpin wrote:
On Wed, Nov 5, 2008 at 5:11 PM, Nit Khair <sentinel.2001@gmx.com> wrote:
On Wed, Nov 5, 2008 at 5:11 PM, Nit Khair <sentinel.2001@gmx.com> wrote:
SSB0cmllZCB0byBydW4gYWxsIGV4YW1wbGVzIGJ1dCBubyBvbmUgd29ya2VkLiBJdCBwcmludHMg
[ANN] main-2.8.3
NAME
main.rb
SYNOPSIS
a class factory and dsl for generating command line programs real
quick
URI
http://codeforpeople.com/lib/ruby/
http://rubyforge.org/projects/codeforpeople/
http://codeforpeople.rubyforge.org/svn/
INSTALL
gem install main
DESCRIPTION
main.rb features the following:
- unification of option, argument, keyword, and environment
parameter
parsing
- auto generation of usage and help messages
- support for mode/sub-commands
- io redirection support
- logging hooks using ruby's built-in logging mechanism
- intelligent error handling and exit codes
- use as dsl or library for building Main objects
- parsing user defined ARGV and ENV
- zero requirements for understanding the obtuse apis of *any*
command
line option parsers
- leather pants
in short main.rb aims to drastically lower the barrier to writing
uniform
command line applications.
for instance, this program
require 'main'
Main {
argument 'foo'
option 'bar'
def run
p params['foo']
p params['bar']
exit_success!
end
}
sets up a program which requires one argument, 'bar', and which may
accept one
command line switch, '--foo' in addition to the single option/mode
which is always
accepted and handled appropriately: 'help', '--help', '-h'. for
the most
part main.rb stays out of your command line namespace but insists
that your
application has at least a help mode/option.
main.rb supports sub-commands in a very simple way
require 'main'
Main {
mode 'install' do
def run() puts 'installing...' end
end
mode 'uninstall' do
def run() puts 'uninstalling...' end
end
}
which allows a program, called 'a.rb', to be invoked as
ruby a.rb install
and
ruby a.rb uninstall
for simple programs main.rb is a real time saver but it's for more
complex
applications where main.rb's unification of parameter parsing, class
configuration dsl, and auto-generation of usage messages can really
streamline
command line application development. for example the following
'a.rb'
program:
require 'main'
Main {
argument('foo'){
cast :int
}
keyword('bar'){
arity 2
cast :float
defaults 0.0, 1.0
}
option('foobar'){
argument :optional
description 'the foobar option is very handy'
}
environment('BARFOO'){
cast :list_of_bool
synopsis 'export barfoo=value'
}
def run
p params['foo'].value
p params['bar'].values
p params['foobar'].value
p params['BARFOO'].value
end
}
when run with a command line of
BARFOO=true,false,false ruby a.rb 42 bar=40 bar=2 --foobar=a
will produce
42
[40.0, 2.0]
"a"
[true, false, false]
while a command line of
ruby a.rb --help
will produce
NAME
a.rb
SYNOPSIS
a.rb foo [bar=bar] [options]+
PARAMETERS
* foo [ 1 -> int(foo) ]
* bar=bar [ 2 ~> float(bar=0.0,1.0) ]
* --foobar=[foobar] [ 1 ~> foobar ]
the foobar option is very handy
* --help, -h
* export barfoo=value
and this shows how all of argument, keyword, option, and
environment parsing
can be declartively dealt with in a unified fashion - the dsl for all
parameter types is the same - and how auto synopsis and usage
generation saves
keystrokes. the parameter synopsis is compact and can be read as
* foo [ 1 -> int(foo) ]
'one argument will get processed via int(argument_name)'
1 : one argument
-> : will get processed (the argument is required)
int(foo) : the cast is int, the arg name is foo
* bar=bar [ 2 ~> float(bar=0.0,1.0) ]
'two keyword arguments might be processed via
float(bar=0.0,1.0)'
2 : two arguments
~> : might be processed (the argument is
optional)
float(bar=0.0,1.0) : the cast will be float, the default
values are
0.0 and 1.0
* --foobar=[foobar] [ 1 ~> foobar ]
'one option with optional argument may be given directly'
* --help, -h
no synopsis, simple switch takes no args and is not required
* export barfoo=value
a user defined synopsis
SAMPLES
<========< samples/a.rb >========>
~ > cat samples/a.rb
require 'main'
ARGV.replace %w( 42 ) if ARGV.empty?
Main {
argument('foo'){
required # this is the default
cast :int # value cast to Fixnum
validate{|foo| foo == 42} # raises error in failure case
description 'the foo param' # shown in --help
}
def run
p params['foo'].given?
p params['foo'].value
end
}
~ > ruby samples/a.rb
true
42
~ > ruby samples/a.rb --help
NAME
a.rb
SYNOPSIS
a.rb foo [options]+
PARAMETERS
foo (1 -> int(foo))
the foo param
--help, -h
<========< samples/b.rb >========>
~ > cat samples/b.rb
require 'main'
ARGV.replace %w( 40 1 1 ) if ARGV.empty?
Main {
argument('foo'){
arity 3 # foo will given three
times
cast :int # value cast to Fixnum
validate{|foo| [40,1].include? foo} # raises error in failure
case
description 'the foo param' # shown in --help
}
def run
p params['foo'].given?
p params['foo'].values
end
}
~ > ruby samples/b.rb
true
[40, 1, 1]
~ > ruby samples/b.rb --help
NAME
b.rb
SYNOPSIS
b.rb foo foo foo [options]+
PARAMETERS
foo (3 -> int(foo))
the foo param
--help, -h
<========< samples/c.rb >========>
~ > cat samples/c.rb
require 'main'
ARGV.replace %w( foo=40 foo=2 bar=false ) if ARGV.empty?
Main {
keyword('foo'){
required # by default keywords are not required
arity 2
cast :float
}
keyword('bar'){
cast :bool
}
def run
p params['foo'].given?
p params['foo'].values
p params['bar'].given?
p params['bar'].value
end
}
~ > ruby samples/c.rb
true
[40.0, 2.0]
true
false
~ > ruby samples/c.rb --help
NAME
c.rb
SYNOPSIS
c.rb foo=foo [bar=bar] [options]+
PARAMETERS
foo=foo (2 -> float(foo))
bar=bar (1 ~> bool(bar))
--help, -h
<========< samples/d.rb >========>
~ > cat samples/d.rb
require 'main'
ARGV.replace %w( --foo=40 -f2 ) if ARGV.empty?
Main {
option('foo', 'f'){
required # by default options are not required, we could use
'foo=foo'
# above as a shortcut
argument_required
arity 2
cast :float
}
option('bar=[bar]', 'b'){ # note shortcut syntax for optional
args
# argument_optional # we could also use this method
cast :bool
default false
}
def run
p params['foo'].given?
p params['foo'].values
p params['bar'].given?
p params['bar'].value
end
}
~ > ruby samples/d.rb
true
[40.0, 2.0]
nil
false
~ > ruby samples/d.rb --help
NAME
d.rb
SYNOPSIS
d.rb --foo=foo [options]+
PARAMETERS
--foo=foo, -f (2 -> float(foo))
--bar=[bar], -b (0 ~> bool(bar=false))
--help, -h
<========< samples/g.rb >========>
~ > cat samples/g.rb
require 'main'
ARGV.replace %w( 42 ) if ARGV.empty?
Main {
argument( 'foo' )
option( 'bar' )
run { puts "This is what to_options produces:
#{params.to_options.inspect}" }
}
~ > ruby samples/g.rb
This is what to_options produces: {"help"=>nil, "foo"=>"42",
"bar"=>nil}
~ > ruby samples/g.rb --help
NAME
g.rb
SYNOPSIS
g.rb foo [options]+
PARAMETERS
foo (1 -> foo)
--bar
--help, -h
<========< samples/h.rb >========>
~ > cat samples/h.rb
require 'main'
# block-defaults are instance_eval'd in the main instance and can
be combined with
# mixins
#
# ./h.rb #=> forty-two
# ./h.rb a #=> 42
# ./h.rb b #=> 42.0
#
Main {
fattr :default_for_foobar => 'forty-two'
option(:foobar) do
default{ default_for_foobar }
end
mixin :foo do
fattr :default_for_foobar => 42
end
mixin :bar do
fattr :default_for_foobar => 42.0
end
run{ p params[:foobar].value }
mode :a do
mixin :foo
end
mode :b do
mixin :bar
end
}
~ > ruby samples/h.rb
"forty-two"
~ > ruby samples/h.rb --help
NAME
h.rb
SYNOPSIS
h.rb (a|b) [options]+
PARAMETERS
--foobar
--help, -h
DOCS
test/main.rb
vim -p lib/main.rb lib/main/*rb
API section below
HISTORY
2.8.3
- support for block defaults
API
Main {
###########################################################################
# CLASS LEVEL
API #
###########################################################################
#
# the name of the program, auto-set and used in usage
#
program 'foo.rb'
#
# a short description of program functionality, auto-set and used
in usage
#
synopsis "foo.rb arg [options]+"
#
# long description of program functionality, used in usage iff set
#
description <<-hdoc
this text will automatically be indented to the right level.
it should describe how the program works in detail
hdoc
#
# used in usage iff set
#
author 'ara.t.howard@gmail.com'
#
# used in usage
#
version '0.0.42'
#
# stdin/out/err can be anthing which responds to read/write or a
string
# which will be opened as in the appropriate mode
#
stdin '/dev/null'
stdout '/dev/null'
stderr open('/dev/null', 'w')
#
# the logger should be a Logger object, something 'write'-able, or
a string
# which will be used to open the logger. the logger_level
specifies the
# initalize verbosity setting, the default is Logger::INFO
#
logger(( program + '.log' ))
logger_level Logger::DEBUG
#
# you can configure exit codes. the defaults are shown
#
exit_success # 0
exit_failure # 1
exit_warn # 42
#
# the usage object is rather complex. by default it's an object
which can
# be built up in sections using the
#
# usage["BUGS"] = "something about bugs'
#
# syntax to append sections onto the already pre-built usage
message which
# contains program, synopsis, parameter descriptions and the like
#
# however, you always replace the usage object wholesale with one
of your
# chosing like so
#
usage <<-txt
my own usage message
txt
###########################################################################
# MODE
API #
###########################################################################
#
# modes are class factories that inherit from their parent class.
they can
# be nested *arbitrarily* deep. usage messages are tailored for
each mode.
# modes are, for the most part, independant classes but parameters
are
# always a superset of the parent class - a mode accepts all of
it's parents
# paramters *plus* and additional ones
#
option 'inherited-option'
argument 'inherited-argument'
mode 'install' do
option 'force' do
description 'clobber existing installation'
end
def run
inherited_method()
puts 'installing...'
end
mode 'docs' do
description 'installs the docs'
def run
puts 'installing docs...'
end
end
end
mode 'un-install' do
option 'force' do
description 'remove even if dependancies exist'
end
def run
inherited_method()
puts 'un-installing...'
end
end
def run
puts 'no mode yo?'
end
def inherited_method
puts 'superclass_method...'
end
###########################################################################
# PARAMETER
API #
###########################################################################
#
# all the parameter types of argument|keyword|option|environment
share this
# api. you must specify the type when the parameter method is used.
# alternatively used one of the shortcut methods
# argument|keyword|option|environment. in otherwords
#
# parameter('foo'){ type :option }
#
# is synonymous with
#
# option('foo'){ }
#
option 'foo' {
#
# required - whether this paramter must by supplied on the
command line.
# note that you can create 'required' options with this keyword
#
required # or required true
#
# argument_required - applies only to options.
#
argument_required # argument :required
#
# argument_optional - applies only to options.
#
argument_optional # argument :optional
#
# cast - should be either a lambda taking one argument, or a symbol
# designation one of the built in casts defined in Main::Cast.
supported
# types are :boolean|:integer|:float|:numeric|:string|:uri.
built-in
# casts can be abbreviated
#
cast :int
#
# validate - should be a lambda taking one argument and returning
# true|false
#
validate{|int| int == 42}
#
# synopsis - should be a concise characterization of the
paramter. a
# default synopsis is built automatically from the parameter. this
# information is displayed in the usage message
#
synopsis '--foo'
#
# description - a longer description of the paramter. it appears
in the
# usage also.
#
description 'a long description of foo'
#
# arity - indicates how many times the parameter should appear on
the
# command line. the default is one. negative arities are
supported and
# follow the same rules as ruby methods/procs.
#
arity 2
#
# default - you can provide a default value in case none is
given. the
# alias 'defaults' reads a bit nicer when you are giving a list of
# defaults for paramters of > 1 arity
#
defaults 40, 2
#
# you can add custom per-parameter error handlers using the
following
#
error :before do
puts 'this fires *before* normal error handling using
#instance_eval...'
end
error do
puts 'this fires *instead of* normal error handling using
#instance_eval...'
end
error :after do
puts 'this fires *after* normal error handling using
#instance_eval...'
end
}
###########################################################################
# INSTANCE LEVEL
API #
###########################################################################
#
# you must define a run method. it is the only method you must
define.
#
def run
#
# all parameters are available in the 'params' hash and via the
alias
# 'param'. it can be indexed via string or symbol. the values
are all
# Main::Parameter objects
#
foo = params['foo']
#
# the given? method indicates whether or not the parameter was
given on
# the commandline/environment, etc. in particular this will
not be true
# when a default value was specified but no parameter was given
#
foo.given?
#
# the list of all values can be retrieved via 'values'. note
that this
# is always an array.
#
p foo.values
#
# the __first__ value can be retrieved via 'value'. note that
this
# never an array.
#
p foo.value
#
# the methods debug|info|warn|error|fatal are delegated to the
logger
# object
#
info{ "this goes to the log" }
#
# you can set the exit_status at anytime. this status is used
when
# exiting the program. exceptions cause this to be ext_failure
if, and
# only if, the current value was exit_success. in otherwords an
# un-caught exception always results in a failing exit_status
#
exit_status exit_failure
#
# a few shortcuts both set the exit_status and exit the program.
#
exit_success!
exit_failure!
exit_warn!
end
}
enjoy.
a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama