[#181897] Teaching Ruby to COBOL programmers — "Wilson Bilkovich" <wilsonb@...>

This isn't a troll, I promise. I'm actually going to be doing this tomorrow.

20 messages 2006/03/01

[#182007] Indexing system - ruby newbie — Adam Groves <adam.groves@...>

Hi there,

19 messages 2006/03/01
[#182014] Re: Indexing system - ruby newbie — "Dave Burt" <dave@...> 2006/03/01

Adam Groves wrote:

[#182016] Re: Indexing system - ruby newbie — Ross Bamford <rossrt@...> 2006/03/01

On Wed, 2006-03-01 at 22:33 +0900, Dave Burt wrote:

[#182033] Can Anyone Recommend A Good DSL Book? — "Sean Mountcastle" <smountcastle@...>

I apologize if this has been asked on this list before (I did a quick

14 messages 2006/03/01

[#182116] Confusion Over Keyword Arguments — "Mr. Big" <no@...>

Ruby 2.0 will include new syntax for hash literals: {a:3, b:4}. However,

18 messages 2006/03/01

[#182207] cleaner Ruby in a rails view — petermichaux@...

Hi,

33 messages 2006/03/02
[#182210] Re: cleaner Ruby in a rails view — "Scott" <bauer.mail@...> 2006/03/02

You can make sure that item.cart_item_optional_values is always equal

[#182211] Re: cleaner Ruby in a rails view — petermichaux@... 2006/03/02

is something like the following acceptable?

[#182245] Re: cleaner Ruby in a rails view — dblack@... 2006/03/02

Hi --

[#182250] Re: cleaner Ruby in a rails view — Charlie Bowman <charlie@...> 2006/03/02

As a side thought. Why doesn't the nil class have an each method that

[#182256] Re: cleaner Ruby in a rails view — dblack@... 2006/03/02

Hi --

[#182257] Re: cleaner Ruby in a rails view — Charlie Bowman <charlie@...> 2006/03/02

I know this is the ruby list and not the rails list but it would be nice

[#182261] Re: cleaner Ruby in a rails view — James Edward Gray II <james@...> 2006/03/02

On Mar 2, 2006, at 9:33 AM, Charlie Bowman wrote:

[#182282] Re: cleaner Ruby in a rails view — "Brian Cully" <bcully@...> 2006/03/02

In lisp, nil is the empty set, and can be enumerated in the standard

[#182270] gsub problem — huseyin polat <huseyinpolat@...>

I have spend over 4 hours for this.. here is the question masters, very

17 messages 2006/03/02

[#182399] IDE suggestions — "Barrie Jarman" <hscbaj@...>

Im new (this week) to ruby and would like to know what IDE's people are

19 messages 2006/03/03

[#182407] Array comparison returning nil — Julian Gall <julian.gall@...>

I am comparing two arrays with:

16 messages 2006/03/03

[#182410] The Golden Fibonacci Ratio (#69) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

15 messages 2006/03/03

[#182438] Ruby on the mobile? — "Berger, Daniel" <Daniel.Berger@...>

Hi all,

18 messages 2006/03/03

[#182493] Best tools for compiling Ruby (Windows)? — "Glenn Smith" <glenn.ruby@...>

Hi

22 messages 2006/03/03
[#182529] Re: Best tools for compiling Ruby (Windows)? — "Curt Hibbs" <ml.chibbs@...> 2006/03/04

On 3/3/06, Glenn Smith <glenn.ruby@gmail.com> wrote:

[#184736] Re: Best tools for compiling Ruby (Windows)? — Kaspar Schiess <eule@...> 2006/03/18

Hello Glenn,

[#182547] Kirbybase Hacks NilClass — James Edward Gray II <james@...>

I'm examining Kirbybase for use it a project and was surprised to

37 messages 2006/03/04
[#182548] Re: Kirbybase Hacks NilClass — dblack@... 2006/03/04

Hi --

[#182554] Re: Kirbybase Hacks NilClass — Jamey Cribbs <jcribbs@...> 2006/03/04

dblack@wobblini.net wrote:

[#182645] ruby pass like statement — rtilley <rtilley@...>

When laying out programs in Python, sometimes during preliminary design,

13 messages 2006/03/05

[#182655] asserting in code vs unit tests — Esad Hajdarevic <esad.spammenot@...>

Hi!

14 messages 2006/03/05
[#182678] Re: asserting in code vs unit tests — "E. Saynatkari" <none@...> 2006/03/05

Esad Hajdarevic wrote:

[#182746] Erubis 1.1.0 - an implementation of eRuby — "kwatch" <kwa@...>

I have released Erubis 1.1.0.

2 messages 2006/03/06
[#182849] Re: [ANN] Erubis 1.1.0 - an implementation of eRuby — "Gyoung-Yoon Noh" <nohmad@...> 2006/03/07

On 3/6/06, kwatch <kwa@kuwata-lab.com> wrote:> I have released Erubis 1.1.0.> http://rubyforge.org/projects/erubis/>> Erubis is an implementation of eRuby.> It has the following features:>> * Auto sanitizing support> * Embedded pattern changeable (default '<% %>')> * Auto trimming spaces around '<% %>'> * Context object available> * Print statement available> * Faster mode support> * Easy to expand in subclass>> Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.>> Sample code (example.rb):> --------------------> ## eRuby script> ## ('<%= %>' is escaped and '<%== %>' is not escaped when XmlEruby)> input = <<END> <ul>> <% for item in list %>> <li><%= item %>> <%== item %></li>> <% end %>> </ul>> END>> ## create Eruby object> require 'erubis'> eruby = Erubis::XmlEruby.new(input) # or Erubis::Eruby.new(input)>> ## get result> list = ['<aaa>', 'b&b', '"ccc"']> puts eruby.result(binding())> -------------------->> result:> ====================> $ ruby example.rb> <ul>> <li>&lt;aaa&gt;> <aaa></li>> <li>b&amp;b> b&b</li>> <li>&quot;ccc&quot;> "ccc"</li>> </ul>> ====================>> See doc/users-guide.html in archive for details.>>> : Enhancement from 1.0.1>> * '<%# .. %>' supported. Erubis ignores '<%# %>'.>> * New class PrintEruby and PrintXmlEruby available.> These class enables you to embed print statement in eRuby> (this feature is not supported in ERB).>> ex. example.eb> --------------------> ## data and context> list = ['aaa', 'bbb', 'ccc']> context = { :list => list }>> ## eRuby script> ## (use print statement instead of <%= item %>)> input = <<-END> <ul>> <% for item in list %>> <li><% print item %></li>> <% end %>> </ul>> END>> ## create eruby and get result as string> require 'erubis'> eruby = Erubis::PrintEruby.new(input)> str = eruby.evaluate(context) # don't use result()!> print str> -------------------->> result:> ====================> $ ruby example.rb> <ul>> <li>aaa</li>> <li>bbb</li>> <li>ccc</li>> </ul>> ====================>> Have fun!>> --> regards,> kwatch>>>

[#182802] What is the best way to iterate through two containers of the same length? — "Mark Watson" <mark.watson@...>

If I have two containers c1 and c2 of the same length, what is the

14 messages 2006/03/06

[#182835] Python looking better ... — James Britt <james_b@...>

... though they need someone to improve the grammar:

20 messages 2006/03/06

[#182855] No documentation for modules on RubyForge? — Aaron Becker <aaronbecker17@...>

13 messages 2006/03/07

[#182929] Is there link extractor or similar html processing libs for Ruby — "Desireco" <zeljko@...>

Hi,

17 messages 2006/03/07

[#182954] Valid email address from CGI input? — "John N. Alegre" <info@...>

Is there any Ruby package that will check a input email for validity? I

13 messages 2006/03/07

[#182956] RubyCocoa and libxml-ruby-0.3.6 — pere.noel@... (Une b騅ue)

i have two versions of Ruby with my computer, the default Tiger one

29 messages 2006/03/07

[#182992] Running windows shell command — "dfaroi@..." <dfaroi@...>

Hi all,

14 messages 2006/03/07

[#182993] Whatever happened to the improved Ruby website proj? — ptkwt@... (Phil Tomson)

This came up in another thread, but I haven't seen an answer there so here's

18 messages 2006/03/07

[#183016] Having a block executed in the context of an instance — Mike Austin <noone@...>

I'm writing a property driven ui and would like to do things like:

23 messages 2006/03/08

[#183050] newbie question about scope, variables, declarations of variables and option strict (as in perl) — "Talha Oktay" <toktay@...>

Hello,

9 messages 2006/03/08

[#183071] unicode in ruby — Richard Gyger <richard@...>

i'm using IO.foreach to parse the lines in a file. now i'm trying to get

35 messages 2006/03/08
[#183075] Re: unicode in ruby — pere.noel@... (Une b騅ue) 2006/03/08

Michal Suchanek <hramrach@centrum.cz> wrote:

[#183148] Re: unicode in ruby — Richard Gyger <richard@...> 2006/03/08

so, you guys are telling me a language developed since the year 2000

[#183576] Re: unicode in ruby — Anthony DeRobertis <aderobertis@...> 2006/03/10

Austin Ziegler wrote:

[#183618] Re: unicode in ruby — "Austin Ziegler" <halostatue@...> 2006/03/11

On 3/10/06, Michal Suchanek <hramrach@centrum.cz> wrote:> On 3/10/06, Austin Ziegler <halostatue@gmail.com> wrote:>> On 3/8/06, Richard Gyger <richard@bytethink.com> wrote:>>> so, you guys are telling me a language developed since the year 2000>>> doesn't support unicode strings natively? in my opinion, that's a>>> pretty glaring problem.>> Please note that Ruby itself is ten years old. Unicode has only>> *recently* (the last three or four years, with the release of Windows>> XP) become a major factor, especially in Japan. Unix support for>> Unicode is still in the stone ages because of the nonsense that POSIX>> put on Unix ages ago. (When Unix filesystems can write UTF-16 as>> their native filename format, then we're going to be much better.>> That will, however, break some assumptions by really stupid>> programs.)> Why the hell utf-16? It is no longer compatible with ascii, yet 16> bits are far from sufficient to cover current unicode. So you still> get multiword characters. It is not even dword aligned for fast> processing by current cpus. I would like utf-8 for compatibility, and> utf-32 for easy string processing. But I do not see much use for> utf-16.

[#183702] Re: unicode in ruby — "Michal Suchanek" <hramrach@...> 2006/03/11

On 3/11/06, Austin Ziegler <halostatue@gmail.com> wrote:> On 3/10/06, Michal Suchanek <hramrach@centrum.cz> wrote:> > On 3/10/06, Austin Ziegler <halostatue@gmail.com> wrote:> >> On 3/8/06, Richard Gyger <richard@bytethink.com> wrote:> >>> so, you guys are telling me a language developed since the year 2000> >>> doesn't support unicode strings natively? in my opinion, that's a> >>> pretty glaring problem.> >> Please note that Ruby itself is ten years old. Unicode has only> >> *recently* (the last three or four years, with the release of Windows> >> XP) become a major factor, especially in Japan. Unix support for> >> Unicode is still in the stone ages because of the nonsense that POSIX> >> put on Unix ages ago. (When Unix filesystems can write UTF-16 as> >> their native filename format, then we're going to be much better.> >> That will, however, break some assumptions by really stupid> >> programs.)> > Why the hell utf-16? It is no longer compatible with ascii, yet 16> > bits are far from sufficient to cover current unicode. So you still> > get multiword characters. It is not even dword aligned for fast> > processing by current cpus. I would like utf-8 for compatibility, and> > utf-32 for easy string processing. But I do not see much use for> > utf-16.>> UTF-16 is actually pretty performant and the implementation of wchar_t> on MacOS X and Windows is (you guessed it!) UTF-16. The filesystems for> both of these operating systems (which have *far* superior Unicode> support than anything else) both use UTF-16 as the native filename> encoding (this is true for HFS+, NTFS4, and NTFS5). The only difference> between what MacOS X does and Windows does for this is that Apple chose> to use decomposed characters instead of composed characters (e.g.,> LOWERCASE E + COMBINING ACUTE ACCENT instead of LOWERCASE E ACUTE> ACCENT).>> Look at the performance numbers for ICU4C: it's pretty damn good. UTF-32> isn't exactly space conservative (since with UTF-16 *most* of the BMP> can be represented with a single wchar_t, and only a few need surrogates> taking up exactly *two* wchar_ts, whereas *all* characters would take up> four uint32_t under UTF-32). ICU4C uses UTF-16 internally. Exclusively.

[#183808] Re: unicode in ruby — "Austin Ziegler" <halostatue@...> 2006/03/12

On 3/11/06, Michal Suchanek <hramrach@centrum.cz> wrote:> On 3/11/06, Austin Ziegler <halostatue@gmail.com> wrote:>> UTF-16 is actually pretty performant and the implementation of>> wchar_t on MacOS X and Windows is (you guessed it!) UTF-16. The>> filesystems for both of these operating systems (which have *far*>> superior Unicode support than anything else) both use UTF-16 as the>> native filename encoding (this is true for HFS+, NTFS4, and NTFS5).>> The only difference between what MacOS X does and Windows does for>> this is that Apple chose to use decomposed characters instead of>> composed characters (e.g., LOWERCASE E + COMBINING ACUTE ACCENT>> instead of LOWERCASE E ACUTE ACCENT).>>>> Look at the performance numbers for ICU4C: it's pretty damn good.>> UTF-32 isn't exactly space conservative (since with UTF-16 *most* of>> the BMP can be represented with a single wchar_t, and only a few need>> surrogates taking up exactly *two* wchar_ts, whereas *all* characters>> would take up four uint32_t under UTF-32). ICU4C uses UTF-16>> internally. Exclusively.> I do not care what Windows, OS X, or ICU uses. I care what I want to> use. Even if most characters are encoded with single word you have to> cope with multiword characters. That means that a character is not a> simple type. You cannot have character arrays. And no library can> completely wrap this inconsistency and isolate you from dealing with> it.

[#183932] Re: unicode in ruby — "Michal Suchanek" <hramrach@...> 2006/03/13

On 3/12/06, Austin Ziegler <halostatue@gmail.com> wrote:> On 3/11/06, Michal Suchanek <hramrach@centrum.cz> wrote:> > On 3/11/06, Austin Ziegler <halostatue@gmail.com> wrote:> >> UTF-16 is actually pretty performant and the implementation of> >> wchar_t on MacOS X and Windows is (you guessed it!) UTF-16. The> >> filesystems for both of these operating systems (which have *far*> >> superior Unicode support than anything else) both use UTF-16 as the> >> native filename encoding (this is true for HFS+, NTFS4, and NTFS5).> >> The only difference between what MacOS X does and Windows does for> >> this is that Apple chose to use decomposed characters instead of> >> composed characters (e.g., LOWERCASE E + COMBINING ACUTE ACCENT> >> instead of LOWERCASE E ACUTE ACCENT).> >>> >> Look at the performance numbers for ICU4C: it's pretty damn good.> >> UTF-32 isn't exactly space conservative (since with UTF-16 *most* of> >> the BMP can be represented with a single wchar_t, and only a few need> >> surrogates taking up exactly *two* wchar_ts, whereas *all* characters> >> would take up four uint32_t under UTF-32). ICU4C uses UTF-16> >> internally. Exclusively.> > I do not care what Windows, OS X, or ICU uses. I care what I want to> > use. Even if most characters are encoded with single word you have to> > cope with multiword characters. That means that a character is not a> > simple type. You cannot have character arrays. And no library can> > completely wrap this inconsistency and isolate you from dealing with> > it.>> If you're simply dealing with text, you don't need arrays of characters.> Frankly, if you don't care what Windows, OS X, and ICU use, then you're> completely ignorant of the real world and what is useful and necessary> for Unicode.

[#183959] Re: unicode in ruby — "Austin Ziegler" <halostatue@...> 2006/03/13

On 3/13/06, Michal Suchanek <hramrach@centrum.cz> wrote:> On 3/12/06, Austin Ziegler <halostatue@gmail.com> wrote:>> On 3/11/06, Michal Suchanek <hramrach@centrum.cz> wrote:>>> I do not care what Windows, OS X, or ICU uses. I care what I want to>>> use. Even if most characters are encoded with single word you have>>> to cope with multiword characters. That means that a character is>>> not a simple type. You cannot have character arrays. And no library>>> can completely wrap this inconsistency and isolate you from dealing>>> with it.>> If you're simply dealing with text, you don't need arrays of>> characters. Frankly, if you don't care what Windows, OS X, and ICU>> use, then you're completely ignorant of the real world and what is>> useful and necessary for Unicode.> The native encoding is bound to be different between platforms. I want> to use an encoding that I like on all platforms, and convert the> strings for filenames or whatever to fit the current platform. That is> why I do not care what a particular platform you name uses.

[#184083] Re: unicode in ruby — "Michal Suchanek" <hramrach@...> 2006/03/14

On 3/13/06, Austin Ziegler <halostatue@gmail.com> wrote:> On 3/13/06, Michal Suchanek <hramrach@centrum.cz> wrote:> > On 3/12/06, Austin Ziegler <halostatue@gmail.com> wrote:> >> On 3/11/06, Michal Suchanek <hramrach@centrum.cz> wrote:> >>> I do not care what Windows, OS X, or ICU uses. I care what I want to> >>> use. Even if most characters are encoded with single word you have> >>> to cope with multiword characters. That means that a character is> >>> not a simple type. You cannot have character arrays. And no library> >>> can completely wrap this inconsistency and isolate you from dealing> >>> with it.> >> If you're simply dealing with text, you don't need arrays of> >> characters. Frankly, if you don't care what Windows, OS X, and ICU> >> use, then you're completely ignorant of the real world and what is> >> useful and necessary for Unicode.> > The native encoding is bound to be different between platforms. I want> > to use an encoding that I like on all platforms, and convert the> > strings for filenames or whatever to fit the current platform. That is> > why I do not care what a particular platform you name uses.>> I think you're just confused here, Michal.In what way?>> >> By the way, you are wrong -- you *can* have arrays of characters.> >> It's just that those characters are not guaranteed to be a fixed> >> length. It will be the same with Ruby moving forward.> > Yes, you can have arrays of strings. Nice. But to turn a text string> > into a string of characters you have to turn it into an array of> > strings. Instead of just indexing an array of basic types that> > represent the characters.>> > And there is a need to look at the actual characters at times.There> > are programs that actually process the text, not only save what the> > user entered in a web form. I can think of text editors, terminal> > emulators, and linguistic tools. I am sure there are others.>> NO! This is where you're 100% wrong. Text editors, terminal emulators,> and linguistic tools *especially* should never be looking at the raw> bytes underneath the character strings. They should be dealing with the> characters as discrete entities.

[#184027] Re: unicode in ruby — "Bill Kelly" <billk@...> 2006/03/14

From: "Austin Ziegler" <halostatue@gmail.com>

[#184087] Re: unicode in ruby — "Michal Suchanek" <hramrach@...> 2006/03/14

On 3/14/06, Bill Kelly <billk@cts.com> wrote:> From: "Austin Ziegler" <halostatue@gmail.com>> >> > On 3/13/06, Anthony DeRobertis <aderobertis@metrics.net> wrote:> >>> >> UTF-8 can take more than one octet to represent a> >> character; UTF-16 can take more than two; UTF-32> >> more than four; etc.> >> > No. UTF-32 does not have surrogates. Unicode is perfectly> > representable in either 20 or 21 bits. A single character is *always*> > representable in a uint32_t sized space with UTF-32.>> Hi, I have zero background in non-ASCII character representations,> but the following post has been echoing in my head as a data point> for... can't believe it's been three-and-a-half years:>> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/46284>> Does that have any relation to your current context? Curt seems to> be talking not of surrogates, but saying "combining characters"> mean variable-length issues still exist with UTF-32 ?>well, in some languages you get characters like "LATIN CAPITAL LETTERA WITH ACUTE".In a string you can either get the above or "LATIN CAPITAL LETTER A"followed by "COMBINING ACUTE" or somesuch. This is decomposed.

[#183090] Newbie: sorting an array of custom objects — Einar Ht <ebuffer@...>

Hi,

12 messages 2006/03/08

[#183125] Looking for good reads on Ruby TK GUI programming — "Harry Truax" <htruax@...>

Hello,

17 messages 2006/03/08
[#183253] Re: Looking for good reads on Ruby TK GUI programming — Hidetoshi NAGAI <nagai@...> 2006/03/09

From: "Harry Truax" <htruax@stf.com>

[#183200] globals outside of OO scripting — rtilley <rtilley@...>

When writing methods as functions (I know they're methods pretending to

15 messages 2006/03/08

[#183226] My Ruby talk @ work.. — Stephen Waits <steve@...>

I just finished my "Learn Ruby" talk for the programmers here at work.

16 messages 2006/03/08

[#183251] text editor — Dan <dan@...>

hey all, does anyone know where I can find a good text editor for code?

20 messages 2006/03/09

[#183385] "ruby myscript.rb" Works, "./myscript.rb" Doesn't — "Nathan O." <nathan.olberding@...>

I have a script. When I run it via "ruby myscript.rb", it works great.

12 messages 2006/03/09

[#183472] Looking for a Ruby Programmer Looking for a Fun Project. ;) — Mark <kramiam@...>

hi there, I'm glad to have found this forum.

12 messages 2006/03/10

[#183594] Help me understand why the Ruby block is slower than without — Alan Burch <orotone@...>

I just wrote my first Ruby script. I'm an experienced C and perl

36 messages 2006/03/10
[#183597] Re: Help me understand why the Ruby block is slower than without — "William James" <w_a_x_man@...> 2006/03/10

[#183660] Re: Help me understand why the Ruby block is slower than without — James Edward Gray II <james@...> 2006/03/11

On Mar 10, 2006, at 4:57 PM, Alan Burch wrote:

[#183647] abstract method in Ruby — "kwatch" <kwa@...>

To define abstract method in Ruby, I use NotImplementedError like the

54 messages 2006/03/11
[#183749] Re: [RCR] abstract method in Ruby — "kwatch" <kwa@...> 2006/03/12

Logan,

[#183815] Re: [RCR] abstract method in Ruby — Yukihiro Matsumoto <matz@...> 2006/03/12

Hi,

[#183838] Re: [RCR] abstract method in Ruby — "kwatch" <kwa@...> 2006/03/13

Erik Veenstra wrote:

[#183841] Re: [RCR] abstract method in Ruby — ara.t.howard@... 2006/03/13

On Mon, 13 Mar 2006, kwatch wrote:

[#183870] Re: [RCR] abstract method in Ruby — nobu@... 2006/03/13

Hi,

[#183918] Re: [RCR] abstract method in Ruby — ara.t.howard@... 2006/03/13

On Mon, 13 Mar 2006 nobu@ruby-lang.org wrote:

[#184022] Re: [RCR] abstract method in Ruby — nobu@... 2006/03/14

Hi,

[#184060] Re: [RCR] abstract method in Ruby — "Bill Barnhill" <xmlarchitect@...> 2006/03/14

Hmm, just some thoughts.

[#184061] Re: [RCR] abstract method in Ruby — "Bill Barnhill" <xmlarchitect@...> 2006/03/14

Oops, my apologies, forgot an end in example.

[#183921] Re: abstract method in Ruby — ilan berci <coder68@...> 2006/03/13

A good portion of the GoF patterns rely on abstract methods (visitor,

[#183938] Re: abstract method in Ruby — ara.t.howard@... 2006/03/13

On Tue, 14 Mar 2006, ilan berci wrote:

[#183958] Re: abstract method in Ruby — "Austin Ziegler" <halostatue@...> 2006/03/13

On 3/13/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:> On Tue, 14 Mar 2006, ilan berci wrote:>> A good portion of the GoF patterns rely on abstract methods (visitor,>> abstract factory, template method, etc... ) which IMO only shine in>> statically typed languages. It would be a shame to port all patterns>> (and their required prerequisite: abstract methods) simply because>> they are recognized in the static world and therefore would make a>> good fit in Ruby.>>>> The additional code needed for the ruby "abstract method" approach>> doesn't make the code any more readable. The extra LoC actually>> slows down the maintenance developer as she has to wade through more.> i disagree strongly here. check out these two snippets that i am> working on as we speak:>> def will_process_holding *a, &b> raise NotImplementedError> end> def process_holding *a, &b> raise NotImplementedError> end> def will_process_incoming(*a, &b)> raise NotImplementedError> end> def process_incoming(*a, &b)> raise NotImplementedError> end>> vs>> abstract_method "will_process_holding"> abstract_method "process_holding"> abstract_method "will_process_incoming"> abstract_method "process_incoming"

[#183703] from Python to Ruby in 10 seconds — "John M. Gabriele" <john_sips_teaz@...>

I think this subject might make for a very nice article in

12 messages 2006/03/11

[#183754] Agile Web Developement with Rails in Italian — Mc Osten <riko@...>

I have recently seen the italian version of "Agile Web Developement with

15 messages 2006/03/12

[#183801] array element access — Tomas Fischer <tomas_fischer99_spamremoveit_@...>

Hi,

15 messages 2006/03/12

[#183948] Alternate notation for eigenclass — "Trans" <transfire@...>

Rather then using a specific method for accessing the

29 messages 2006/03/13
[#184080] Re: Alternate notation for eigenclass — gwtmp01@... 2006/03/14

[#184086] Re: Alternate notation for eigenclass — dblack@... 2006/03/14

Hi --

[#184024] Writing Good #each Methods? — James Herdman <james.herdman@...>

I'm working my way through The Ruby Course slides at the moment and am

13 messages 2006/03/14

[#184139] some questions on language syntax — Pavel Smerk <smerk@...>

Hi, I'm new to this language and as I'm Perl user, some things seems

14 messages 2006/03/14

[#184245] Time object problems - 1.8.2 — "Greg Lorriman" <temp@...>

I am trying to efficiently get the date part of a Time object.

13 messages 2006/03/15

[#184260] How to compile Ruby on Windows — AlphaBeta <idontwantspam@...>

Does anybody have a kind of "step by step" instructions on how to

22 messages 2006/03/15
[#184264] Re: How to compile Ruby on Windows — "Glenn Smith" <glenn.ruby@...> 2006/03/15

I've been down this path but had a few problems and gave up.

[#184273] Re: How to compile Ruby on Windows — =?ISO-8859-15?Q?Daniel_V=F6lkerts?= <daniel@...> 2006/03/15

Glenn Smith schrieb:

[#184289] Re: How to compile Ruby on Windows — "Wilson Bilkovich" <wilsonb@...> 2006/03/15

On 3/15/06, Daniel Vkerts <daniel@voelkerts.de> wrote:

[#184318] Re: How to compile Ruby on Windows — "Glenn Smith" <glenn.ruby@...> 2006/03/15

Blimey!

[#184340] Re: How to compile Ruby on Windows — "Wilson Bilkovich" <wilsonb@...> 2006/03/15

I know you were kidding, but I felt like sending an e-mail, so..

[#184347] Re: How to compile Ruby on Windows — "Glenn Smith" <glenn.ruby@...> 2006/03/15

Yes I should point out that no offence was meant to you with my previous

[#184348] Re: How to compile Ruby on Windows — "Wilson Bilkovich" <wilsonb@...> 2006/03/15

Yeah, I knew that.. Didn't mean for my response to come out sounding defensive.

[#184352] Re: How to compile Ruby on Windows — "Glenn Smith" <glenn.ruby@...> 2006/03/15

I think what would be nice to achieve from all this is that when Matz and

[#184286] Ruby for Java Folks? — Eric Schwartz <emschwar@...>

I've agreed to give a brief talk on Ruby for the Pikes Peak Java

12 messages 2006/03/15

[#184332] csv nil check and update — "Geoff" <samekh@...>

Greetings!

14 messages 2006/03/15

[#184474] specify a mandatory block parameter — Shea Martin <null@...0>

I think I know the answer to this already, but...

15 messages 2006/03/16

[#184480] Card tricks with Ruby — grrr <grrr@...>

So suppose you have a deck of cards, that might have some number of cards.

30 messages 2006/03/16
[#184484] Re: Card tricks with Ruby — "Matthew Moss" <matthew.moss.coder@...> 2006/03/16

deck = (1..52).to_a

[#184523] Re: Card tricks with Ruby — Stephen Waits <steve@...> 2006/03/17

Matthew Moss wrote:

[#184506] ANN: Third Drop of RubyCLR — "John Lam" <drjflam@...>

This is the biggest release so far of the RubyCLR bridge:

17 messages 2006/03/17

[#184541] Are college professors teaching computer science with ruby? — "anne001" <anne@...>

I was wondering if anybody taught the traditional computer courses in

26 messages 2006/03/17

[#184560] Space Merchant (#71) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

39 messages 2006/03/17
[#184872] Re: [QUIZ] Space Merchant (#71) — Ross Bamford <rossrt@...> 2006/03/20

Here is my Galaxy implementation. It seems to do everything it needs to

[#184907] Re: [QUIZ] Space Merchant (#71) — James Edward Gray II <james@...> 2006/03/20

On Mar 20, 2006, at 2:41 AM, Ross Bamford wrote:

[#184908] Re: [QUIZ] Space Merchant (#71) — Timothy Bennett <timothy.s.bennett@...> 2006/03/20

I'm working on a planet.rb.

[#184623] incremental rebuild with Rake — "Simon Strandgaard" <neoneye@...>

I am using Rake for testing c++ code.

11 messages 2006/03/17

[#184658] Ruby Hacking Guide Translation — "Vincent Isambart" <vincent.isambart@...>

Hi everyone,

11 messages 2006/03/17

[#184710] Core lib clean-up — "Trans" <transfire@...>

Looking at the latest ruby-doc.org/core API docs, I suprise how it has

11 messages 2006/03/18
[#184734] Re: Core lib clean-up — James Edward Gray II <james@...> 2006/03/18

On Mar 18, 2006, at 4:38 AM, Trans wrote:

[#184754] Re: Core lib clean-up — "Trans" <transfire@...> 2006/03/18

> Which is a standard library, not a core class. It shouldn't be in

[#184774] Re: Core lib clean-up — James Britt <james_b@...> 2006/03/19

Trans wrote:

[#184765] safe way to calc md5 on very large files — rtilley <rtilley@...>

I'm calculating md5 checksums on very large files (2 GB). This is a safe

12 messages 2006/03/18

[#184840] Using emacs on Apple's PowerBook — Dae San Hwang <daesan@...>

I apologize for the off topic post, but knowing that many ruby

32 messages 2006/03/19
[#184842] Re: [OT] Using emacs on Apple's PowerBook — Daniel Harple <dharple@...> 2006/03/19

On Mar 19, 2006, at 9:55 PM, Dae San Hwang wrote:

[#184846] Re: [OT] Using emacs on Apple's PowerBook — Dae San Hwang <daesan@...> 2006/03/19

Actually, I'm not old enough of an emacs user to be accustomed to

[#184849] Re: [OT] Using emacs on Apple's PowerBook — zuzu <sean.zuzu@...> 2006/03/19

On 3/19/06, Dae San Hwang <daesan@gmail.com> wrote:> Actually, I'm not old enough of an emacs user to be accustomed to> caps-lock positioned control key. But how do you live without right> control/meta keys? Do you actually press 'caps-lock + a' with only> left fingers to move to the beginning of a line?>> daesan

[#184852] Re: [OT] Using emacs on Apple's PowerBook — Dae San Hwang <daesan@...> 2006/03/19

On Mar 20, 2006, at 8:12 AM, zuzu wrote:

[#184862] Re: [OT] Using emacs on Apple's PowerBook — Nicolas Kassis <nic.kassis@...> 2006/03/20

Dae San Hwang wrote:

[#184867] Re: [OT] Using emacs on Apple's PowerBook — zuzu <sean.zuzu@...> 2006/03/20

On 3/20/06, Nicolas Kassis <nic.kassis@gmail.com> wrote:> Dae San Hwang wrote:>> > I apologize for the off topic post, but knowing that many ruby> > programmers are emacs/PowerBook users, I don't think this is> > completely irrelevant..> >> > For all you emacs/PowerBook users, how do you live with your> > PowerBook? I've been thinking about buying a powerbook for four years> > now but didn't only because using emacs key bindings seems extremely> > awkward on Apple's laptops. On the lower left side of powerbook, there> > is a 'fn' key which confuses my figures on the correct positions of> > control/meta(option) keys. On the lower right side of powerbook, there> > is no control/meta keys due to the placement of near useless arrow keys.> >> > I actually had expected someone would build/sell a customized> > PowerBook keyboards tailored for emacs users by now.. I am confused> > since no other emacs users seem to be bothered by this. I really think> > Apple should at least provide an option of the replacement keyboard> > for emacs PowerBook users.> >> > With the introduction of MacBook Pro and near ubiquitousness of WiFi> > connection, my desire for a laptop couldn't have been higher. Can> > anybody who share this dilemma comment on this?> >> > For those of you who think I'm a total nut for expecting Apple to> > solve my person problem, emacs key bindings have been supported in all> > text widgets of Cocoa applications ever since Mac OS X came out and> > it's only logical to expect their hardware to be designed in line with> > their software features.> >> > sorry for the rant,> >> > daesan> >> >> I feel you pain. To add to this, I really can't figure out how to make> the alt key become the Meta key in the terminal based emacs. I added the> (setq mac-command-key-is-meta nil)> but nothing works neither the apple key or the alt key is the meta key.> Did I miss something?

[#184934] Re: [OT] Using emacs on Apple's PowerBook — Dae San Hwang <daesan@...> 2006/03/20

Thank you for all the comments regarding my earlier post. I really

[#184936] Re: [OT] Using emacs on Apple's PowerBook — "Nick Sieger" <nicksieger@...> 2006/03/20

On 3/20/06, Dae San Hwang <daesan@gmail.com> wrote:

[#184938] Re: [OT] Using emacs on Apple's PowerBook — Timothy Bennett <timothy.s.bennett@...> 2006/03/20

On Mar 20, 2006, at 8:38 AM, Nick Sieger wrote:

[#184946] Re: [OT] Using emacs on Apple's PowerBook — ruben <snowbender@...> 2006/03/20

[#184891] once again looking for my module methods — "Trans" <transfire@...>

Gee. Once again I want my module methods inherited.

26 messages 2006/03/20
[#184929] Re: once again looking for my module methods — Iain D Broadfoot <ibroadfo@...> 2006/03/20

dblack@wobblini.net said something:

[#185034] Re: once again looking for my module methods — eastcoastcoder@... 2006/03/21

BTW, There's an RCP asking for this.

[#185035] Re: once again looking for my module methods — dblack@... 2006/03/21

Hi --

[#184982] Re: iterate chars in a string — "Berger, Daniel" <Daniel.Berger@...>

> -----Original Message-----

18 messages 2006/03/20

[#185177] Ruby on HP-UX — "Tim Nordloh" <tnordloh@...>

I have read a couple of posts regarding compiling Ruby on HP-UX 11i, and

34 messages 2006/03/21
[#185182] Re: Ruby on HP-UX — James Edward Gray II <james@...> 2006/03/21

On Mar 21, 2006, at 2:48 PM, Tim Nordloh wrote:

[#185185] Re: Ruby on HP-UX — Mauricio Fernandez <mfp@...> 2006/03/21

On Wed, Mar 22, 2006 at 06:33:50AM +0900, James Edward Gray II wrote:

[#185187] Re: Ruby on HP-UX — James Edward Gray II <james@...> 2006/03/21

On Mar 21, 2006, at 3:51 PM, Mauricio Fernandez wrote:

[#185188] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/21

Looking into it, I might be able to download a newer version, if it's

[#185195] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/21

ok, I uncommented entries in the ext/Setup file one-by-one, and here's what

[#185290] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/22

These first couple of lines look like a malformed gcc command to me. Anyon=

[#185295] Re: Ruby on HP-UX — Mauricio Fernandez <mfp@...> 2006/03/22

On Thu, Mar 23, 2006 at 12:07:30AM +0900, Tim Nordloh wrote:

[#185340] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/22

Ok, I hand-modified it and ended up with this....

[#185361] Re: Ruby on HP-UX — MenTaLguY <mental@...> 2006/03/22

I really think this approach of removing things until it compiles is a mistake; if you did eventually get something that built, you'd just end up with a build of Ruby that most likely won't run any useful Ruby scripts.

[#185409] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/22

Well, my basic Ruby scripts run ok for my basic needs, and no -- I don't

[#185423] Re: Ruby on HP-UX — MenTaLguY <mental@...> 2006/03/22

On Thu, 23 Mar 2006 06:46:28 +0900, "Tim Nordloh" <tnordloh@gmail.com> wrote:

[#185427] Re: Ruby on HP-UX — Benjohn Barnes <benjohn@...> 2006/03/22

[#185455] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/23

MenTaLGuY,

[#185458] Re: Ruby on HP-UX — James Edward Gray II <james@...> 2006/03/23

On Mar 22, 2006, at 8:05 PM, Tim Nordloh wrote:

[#185466] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/23

At this point, I'm not asking for a lot, just a hint would help, such as,

[#185472] Re: Ruby on HP-UX — MenTaLguY <mental@...> 2006/03/23

libcrypto is provided by openssl, yes

[#185480] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/23

I'll work on at least openssl, since it is the squeaky wheel at the moment.

[#185569] Re: Ruby on HP-UX — MenTaLguY <mental@...> 2006/03/23

On Thu, 23 Mar 2006 13:36:34 +0900, "Tim Nordloh" <tnordloh@gmail.com> wrote:

[#185587] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/23

Thanks, Mental, that helped immensely. I'm learning a lot.

[#185590] Re: Ruby on HP-UX — "Tim Nordloh" <tnordloh@...> 2006/03/23

New steps:

[#185218] Ruby for [...] programmers — "Doug Bromley" <doug.bromley@...>

Hi all

9 messages 2006/03/22

[#185241] Rails vs. Ruby Evolution — gwtmp01@...

I was just reading through http://scottraymond.net/articles/

39 messages 2006/03/22
[#185242] Re: Rails vs. Ruby Evolution — "Bill Kelly" <billk@...> 2006/03/22

From: <gwtmp01@mac.com>

[#185285] Re: Rails vs. Ruby Evolution — "Avdi Grimm" <avdi.grimm@...> 2006/03/22

On 3/22/06, Bill Kelly <billk@cts.com> wrote:

[#185559] Re: Rails vs. Ruby Evolution — "Austin Ziegler" <halostatue@...> 2006/03/23

On 3/22/06, Avdi Grimm <avdi.grimm@gmail.com> wrote:> On 3/22/06, Bill Kelly <billk@cts.com> wrote:>> I like the approach taken by Nitro (http://www.nitrohq.com/) which>> seems to be working in close collaboration with the facets>> (http://facets.rubyforge.org/) library. I'm just learning Nitro, but>> from what I've read, they seem to be consciously factoring their core>> extensions out to the facets library where appropriate, which makes>> those extensions available for anyone to use, on a method-by-method>> granularity. Neat. :)> There's a fair amount of overlap between ActiveSupport and Facets,> from what I've seen. It would be nice if the Rails team would> collaborate with the Facets team, since the original intent of Facets,> as I understand it, was to provide a single source for all the handy> extensions people were coming up with.

[#185254] Is this a kind of design patterns? — "Sam Kong" <sam.s.kong@...>

Hi!

23 messages 2006/03/22
[#185268] Re: Is this a kind of design patterns? — Robert Klemme <bob.news@...> 2006/03/22

Sam Kong wrote:

[#185348] Re: Is this a kind of design patterns? — Jim Weirich <jim@...> 2006/03/22

Robert Klemme wrote:

[#185284] questions/suggestions from a Ruby newbie — Diego.Virasoro@...

Hi,

17 messages 2006/03/22

[#185327] scope issue of variable in iterator — Mohammad Khan <mkhan@...>

mkhan@mkhan:~$ irb

13 messages 2006/03/22

[#185341] Re: Programming challenge: wildcard exclusion in cartesian products — Dirk Thierbach <dthierbach@...>

[Had to drop alt.comp.lang.haskell, otherwise my newsserver doesn't accept it]

17 messages 2006/03/22

[#185459] what on earth.. — "Joe Van Dyk" <joevandyk@...>

a = 5

17 messages 2006/03/23

[#185526] perl regexp to ruby one conversion ? — pere.noel@... (Une b騅ue)

i've a perl regexp :

14 messages 2006/03/23

[#185538] understanding aRegexp === aString — pere.noel@... (Une b騅ue)

i'm experiencing with regexp and ruby and follo the page

11 messages 2006/03/23

[#185649] socket_sendfile — Eric Hodel <drbrain@...7.net>

= socket_sendfile

16 messages 2006/03/24

[#185688] iterator class not working — "Peter Ertl" <pertl@...>

Hi,

21 messages 2006/03/24
[#185695] Re: iterator class not working — Ross Bamford <rossrt@...> 2006/03/24

On Fri, 2006-03-24 at 21:38 +0900, Peter Ertl wrote:

[#185702] Re: iterator class not working — Ross Bamford <rossrt@...> 2006/03/24

Just a small fix:

[#185698] B & E (#72) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

19 messages 2006/03/24

[#185775] Article: An Exercise in Metaprogramming with Ruby — rubyhacker@...

I failed to post this link before, so here it is now:

17 messages 2006/03/24

[#185780] require a certain version of the ruby interpreter — Shea Martin <null@...0>

I would like to enforce ruby 1.8.4 or higher.

18 messages 2006/03/24
[#185783] Re: require a certain version of the ruby interpreter — Shea Martin <null@...0> 2006/03/24

Shea Martin wrote:

[#185824] installing rails — "julian" <jkbowler@...>

I am completely new to ruby and to rails, but have brought a book Agile

18 messages 2006/03/25

[#185830] Newby Maze solution — "Alex Combas" <alex.combas@...>

Hello folks,Tonight I tried out some of that good old extreme programming TDD stuffwith mixed results.

12 messages 2006/03/25

[#185856] Object methods — Eustaquio Rangel de Oliveira J <eustaquiorangel@...>

Hello there. :-)

14 messages 2006/03/25
[#185911] Re: Object methods — Robert Klemme <bob.news@...> 2006/03/25

Eustaquio Rangel de Oliveira J wrote:

[#185859] Speed issue on Windows — Larry Kelly <ldk2005@...>

What progress is being made to improve Ruby's speed on Windows

21 messages 2006/03/25

[#185896] Help with tkHTML (specifically, require 'tkextlib/tkHTML' fails to find package) — Randy Kramer <rhkramer@...>

(Ruby 1.8.4 on Mandriva2006)

12 messages 2006/03/25

[#185908] Best Database For Ruby — Butternut squash <rrrn@...>

I want to learn DB and SQL using Ruby

20 messages 2006/03/25

[#185947] deciphering poignant guide chapter 4 example — john_sips_tea@...

Hi,

15 messages 2006/03/26

[#186016] Areal noob question — "Ryan and Kate Huff" <ryanandkate@...>

Can Ruby run without rails?

16 messages 2006/03/26
[#186018] Re: Areal noob question — dblack@... 2006/03/26

Hi --

[#186019] Re: Areal noob question — "Ryan and Kate Huff" <ryanandkate@...> 2006/03/26

Thank you very much for your insight. As far as language maturity goes,

[#186068] Data Structure for n-dimension values with defaults — "Phrogz" <gavin@...>

Help! I can't figure out how to store a rather particular set of data.

12 messages 2006/03/26

[#186079] Why do some methods names which replace the content in place doesn't have the "!" sign? — Eric Boucher <devlists-ruby-talk@...>

Hi,

33 messages 2006/03/27
[#186089] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — dblack@... 2006/03/27

Hi --

[#186330] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — "Robert Dober" <robert.dober@...> 2006/03/28

On 3/27/06, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#186346] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — dblack@... 2006/03/28

Hi --

[#186350] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — "Robert Dober" <robert.dober@...> 2006/03/28

On 3/28/06, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#186358] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — Peter Hickman <peter@...> 2006/03/28

Robert Dober wrote:

[#186363] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — Michael Ulm <michael.ulm@...> 2006/03/28

Peter Hickman wrote:

[#186367] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — Peter Hickman <peter@...> 2006/03/28

Michael Ulm wrote:

[#186374] Re: Why do some methods names which replace the content in place doesn't have the "!" sign? — "Robert Dober" <robert.dober@...> 2006/03/28

I am really sorry, this got way out of control.

[#186095] input without blocking — yahn <yahn15@...>

How do you do something like gets but without blocking? All I want to

26 messages 2006/03/27
[#186101] Re: input without blocking — Eustaquio Rangel de Oliveira J <eustaquiorangel@...> 2006/03/27

> How do you do something like gets but without

[#186261] Re: input without blocking — karl_brodowsky@... 2006/03/27

There should be methods on Unix and Linux using select or something

[#186267] Re: input without blocking — ara.t.howard@... 2006/03/27

On Tue, 28 Mar 2006 karl_brodowsky@yahoo.com wrote:

[#186275] Re: input without blocking — gwtmp01@... 2006/03/27

[#186278] Re: input without blocking — ara.t.howard@... 2006/03/27

On Tue, 28 Mar 2006 gwtmp01@mac.com wrote:

[#186305] Re: input without blocking — brian yahn <yahn15@...> 2006/03/28

Wouldn't this:

[#186314] Re: input without blocking — ara.t.howard@... 2006/03/28

On Tue, 28 Mar 2006, brian yahn wrote:

[#186098] Waiter, there's a noob in my soup! — Jeff Pritchard <jp@...>

Another thread here made me realize that I have a perfect use for

15 messages 2006/03/27

[#186336] using mysql client to read a file to create a table in a database in a mysql server — "julian" <jkbowler@...>

I have a little tech problem:

8 messages 2006/03/28

[#186366] Rails 1.1 Released — "David Ishmael" <dishmael@...>

Ran across this article on digg.com about the release of Rails 1.1:

21 messages 2006/03/28
[#186388] Re: Rails 1.1 Released — "John N. Alegre" <info@...> 2006/03/28

David Ishmael wrote:

[#186477] Re: Rails 1.1 Released -SOLVED — "John N. Alegre" <info@...> 2006/03/28

John N. Alegre wrote:

[#186481] Re: Rails 1.1 Released -SOLVED — "David Ishmael" <dishmael@...> 2006/03/28

Whew, I was running out of ideas. ;) Glad it's working now.

[#186381] Regexp gotcha — Pistos Christou <jesusrubsyou.5.pistos@...>

Hi, all. I was fixing a bug last night, and discovered some

19 messages 2006/03/28

[#186422] timeout when listening with TCPServer — Shea Martin <null@...0>

I want to listen for connections for 2 seconds, then timeout. Do I have

14 messages 2006/03/28

[#186426] Regexp to match strings that _don't_ being with a string — Wes Gamble <weyus@...>

I would like to write a regexp that will match a string that does NOT

14 messages 2006/03/28

[#186474] Ruby Black Belt — "Dmitry Buzdin" <buzdin@...>

Hello Ruby community!

71 messages 2006/03/28
[#186484] Ruby Black Belt — "Jeppe Jakobsen" <jeppe88@...> 2006/03/28

Hey if people is against an exam, why not make it more like a test so that

[#186502] Re: Ruby Black Belt — Benjohn Barnes <benjohn@...> 2006/03/28

[#186714] Re: Ruby Black Belt — Christian Neukirchen <chneukirchen@...> 2006/03/29

Benjohn Barnes <benjohn@fysh.org> writes:

[#186514] Re: Ruby Black Belt — James Britt <james_b@...> 2006/03/29

Jeppe Jakobsen wrote:

[#186560] Re: Ruby Black Belt — "Jeppe Jakobsen" <jeppe88@...> 2006/03/29

Yeah I could do that, but this is my first language and I can still only

[#186518] Re: Ruby Black Belt — "Gregory Brown" <gregory.t.brown@...> 2006/03/29

On 3/28/06, Dmitry Buzdin <buzdin@gmail.com> wrote:

[#186522] Re: Ruby Black Belt — Jason Perkins <jperkins@...> 2006/03/29

[#186568] Re: Ruby Black Belt — "Dmitry Buzdin" <buzdin@...> 2006/03/29

First of all want to thank all of You who posted comments here. Special

[#186631] Re: Ruby Black Belt — Peter Szinek <peter@...> 2006/03/29

Dmitry Buzdin wrote:

[#186688] Re: Ruby Black Belt — Pistos Christou <jesusrubsyou.5.pistos@...> 2006/03/29

Peter Szinek wrote:

[#186700] Re: Ruby Black Belt — "Gregory Brown" <gregory.t.brown@...> 2006/03/29

On 3/29/06, Pistos Christou <jesusrubsyou.5.pistos@geoshell.com> wrote:

[#186490] Opposite of ||= pattern? — "Justin Bailey" <jgbailey@...>

A cheap just-in-time initialization trick is the "||=3D" trick:

8 messages 2006/03/28

[#186493] One-Click Ruby Installer 184-16 release candidate 1 is available! — "Curt Hibbs" <ml.chibbs@...>

The release file has been uploaded to RubyForge but may not be

13 messages 2006/03/28

[#186546] strange order of execution — "Dirk Traulsen" <dirk.traulsen@...>

Hi list!

16 messages 2006/03/29
[#186550] Re: strange order of execution — Hal Fulton <hal9000@...> 2006/03/29

Dirk Traulsen wrote:

[#186592] Calling R from Ruby — "AlexG" <alexg@...>

Hi,

35 messages 2006/03/29
[#186811] Re: Calling R from Ruby — ptkwt@... (Phil Tomson) 2006/03/30

In article <442B7BA3.104@cesmail.net>,

[#186824] Re: Calling R from Ruby — Edwin van Leeuwen <edder@...> 2006/03/30

unknown wrote:

[#186826] Re: Calling R from Ruby — Thomas <sanobast-2005a@...> 2006/03/30

> For an R bridge I use a simple class that writes stuff to a script file

[#186944] Re: Calling R from Ruby — "M. Edward (Ed) Borasky" <znmeb@...> 2006/03/31

Yeah ... in fact there is an R DCOM server and client in the CRAN

[#186679] unpack signed short in network (big-endian) byte order — baumanj@...

Is there any particular reason why there is no format specifier in the

10 messages 2006/03/29

[#186732] Learn to Program, by Chris Pine — Jan_K <non@...>

Does anyone know where I can find the solutions to the exercises in

77 messages 2006/03/29
[#187530] Re: Learn to Program, by Chris Pine — Jan_K <non@...> 2006/04/03

Chapter 9, exercise 3 (page 76)

[#186775] Digital signing of Ruby scripts — "John Lam" <drjflam@...>

A primary scenario for my RubyCLR bridge is to enable folks to build rich

11 messages 2006/03/30

[#186850] Unintentional hype of Ruby irb and ri — stephen.tashiro@...

Perhaps an inflamatory title - but it answers some simple questions.

15 messages 2006/03/30

[#186881] TrueClass/FalseClass vs. Boolean — PrimaryKey <pk@...>

Greetings!

23 messages 2006/03/30
[#186888] Re: TrueClass/FalseClass vs. Boolean — "baumanj@..." <baumanj@...> 2006/03/30

Since everything in ruby is an object, there need to be objects for

[#186935] How slow could ruby be compared to Python or Perl? — sullivanz.pku@...

This might be a stupid question, but I really wonder if ruby is much

18 messages 2006/03/31
[#187674] Re: How slow could ruby be compared to Python or Perl? — "Isaac Gouy" <igouy@...> 2006/04/04

Austin Ziegler wrote:

[#187676] Re: How slow could ruby be compared to Python or Perl? — "Austin Ziegler" <halostatue@...> 2006/04/04

On 4/4/06, Isaac Gouy <igouy@yahoo.com> wrote:> Austin Ziegler wrote:> > On 3/31/06, sullivanz.pku@gmail.com <sullivanz.pku@gmail.com> wrote:> > > This might be a stupid question, but I really wonder if ruby is much> > > slower than python and perl.> > Try it. And ignore anyone who tells you to look at the utterly useless> > Alioth shootout. It doesn't model anything real-world and doesn't> > actually tell you anything about performance for your problems.> >> > I haven't checked in a while, but they weren't very honest about their> > aims last time I checked, either. It's simply a matter of> > self-promotion and comparison for Inane Gullibles.> "I haven't checked in a while..."> Then your comments would apply to the Alioth shootout in... 2004?

[#187686] Re: How slow could ruby be compared to Python or Perl? — "Isaac Gouy" <igouy@...> 2006/04/04

[#186982] openGL documention? — bas wilbers <baswilbers@...>

hello,

14 messages 2006/03/31

[#186992] Testing DiGraph (#73) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

21 messages 2006/03/31

[#187020] Ruby/Tk (X,Y) Coordinate Question — David Bailey <david.bailey@...>

14 messages 2006/03/31
[#187024] Re: Ruby/Tk (X,Y) Coordinate Question — David Bailey <david.bailey@...> 2006/03/31

David Bailey wrote:

[#187037] Re: Ruby/Tk (X,Y) Coordinate Question — dperkins@... 2006/03/31

You could try "%X %Y" to get coordinates relative to the top left corner

[#187042] (Static) Constructors/Destructors in Ruby — PrimaryKey <pk@...>

Hello!

25 messages 2006/03/31
[#187056] Re: (Static) Constructors/Destructors in Ruby — Jim Weirich <jim@...> 2006/03/31

PrimaryKey wrote:

[#187059] Re: (Static) Constructors/Destructors in Ruby — PrimaryKey <pk@...> 2006/03/31

> How would you use static constructors/destructors? Perhaps we can show

[ANN] el4r-1.0.3 - EmacsLisp for Ruby

From: rubikitch@...
Date: 2006-03-12 03:15:55 UTC
List: ruby-talk #183735
Hi,

El4r enables you to write Emacs programs in Ruby as well as in EmacsLisp.
I call the Ruby language to manipulate Emacs `EmacsRuby'.

El4r and Test::Unit enables you to unit-test EmacsLisp/EmacsRuby programs automatically.

El4r is available at 
http://www.rubyist.net/~rubikitch/computer/el4r/index.en.html


== What's new

=== [2006/03/12] 1.0.3 released

* Interactive specification by Proc objects
* .xemacs/init.el support.
* manpages.

=== [2005/12/11] 1.0.2 released
* Fixed `el4r-rctool' bug on Windows. No changes except installer.

=== [2005/12/02] 1.0.1 released
* Adjusted to Emacs-snapshot.

=== [2005/12/01] 1.0.0 released

* Installer.
* Packaging policy.
* Fixed fatal error bug.
* Fixed defun-GC problem.
* Renamed: el4r-runtest.rb -> el4r-runtest
* New command: el4r
* New EmacsRuby functions.
  * define_minor_mode
  * define_derived_mode
  * eval_after_load

=== [2005/10/11] 0.9.3 released

* el4r-runtest.rb: Raise when the test-script file is not found.
* Now output builtin functions (p, print, puts ...) are usable in EmacsRuby.
* Fixed an error-handling bug.
* More stable.

=== [2005/10/05] 0.9.2 released

* ~/.el4rrc.rb contains all the el4r setting.
* Automatic configuration.
* Now el4r can be installed in arbitrary directory.
* A block is accepted in El4r::ELMethodsMixin#newbuf .
* New class: ElApp
* Works with Windows(WINE).
* Introduced el4r_load search path.
* New EmacsRuby library in el4r/ directory.


== Download / Install / Setup
Since version 1.0.0, el4r introduced installer.
If you got error when downloading, you must update Ruby.
Here is the shell commands to download, install and setup.
el4r-rctool setups and updates your dotfiles automatically.

To update older el4r (<= 0.9.1), you must remove these lines from ~/.emacs,
  (add-to-list 'load-path "~/src/el4r/elisp/")
  (require 'el4r)
  (el4r-boot)
and this line from ~/.el4r/init.rb by hand.
  el4r_load "el4r-mode.rb"
In newer el4r, el4r-rctool updates your dotfiles automatically.

  ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/el4r-1.0.3.tar.gz").read.display' > el4r-1.0.3.tar.gz
  tar xzf el4r-1.0.3.tar.gz
  cd el4r-1.0.3
  ruby setup.rb

  ruby -S el4r-rctool -p
  ruby -S el4r-rctool -i


The diretory to put EmacsRuby scripts is ~/.el4r by default.
The environment variable EL4R_HOME sets the directory to put EmacsRuby scripts.
  
* ((<el4r-1.0.3.tar.gz|URL:http://www.rubyist.net/~rubikitch/archive/el4r-1.0.3.tar.gz>))

Victor Borja created ((<Gentoo ebuild|URL:http://darcs.thehatcher.com/vic/erebor-ebuilds/app-emacs/>)). Thanks.

Boris Daix created ((<Debian package|URL:http://alysse.dyndns.org/~bdaix/debian/>)). Thanks.
Put the following to your /etc/apt/sources.list:
  deb http://alysse.dyndns.org/~bdaix/debian/packages unstable/
  deb-src http://alysse.dyndns.org/~bdaix/debian/packages unstable/



Here is a test program of el4r.

#    el4r - EmacsLisp for Ruby 
#    Copyright (C) 2005 rubikitch <rubikitch@ruby-lang.org>
#    Version: $Id: test-el4r.rb 1215 2006-02-23 17:40:42Z rubikitch $

#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

require 'test/unit'

require 'tempfile'
require 'tmpdir'
require 'pathname'
require 'fileutils'
class << Tempfile
  def path(content, dir=Dir.tmpdir)
    x = Tempfile.open("content", dir)
    x.write content
    x.close
    x.open
    x.path
  end

  def pathname(content, dir=Dir.tmpdir)
    Pathname.new(path(content, dir=Dir.tmpdir))
  end
end


# El4r self test.
## (eevnow "cat `buffer-file-name` | awk '/  def test_/{print $2}'|result-long")
class TestEl4r < Test::Unit::TestCase
  # ElMixin is already included/extended.
  # So we can write EmacsRuby in this class.

  # Testing ELListCell#to_ary.
  # This method enables us to multiple assignment.
  def test_to_ary
    list = el4r_lisp_eval(%q((list 1 2)))
    one, two = list

    assert_equal(list.to_a, list.to_ary)
    assert_equal(1, one)
    assert_equal(2, two)
  end

  # Testing with and match-string.
  def test_match_string
    lisp = %q((progn
                (switch-to-buffer "a")

              (save-excursion
                (insert "abcdefg\n")
                (goto-char 1)
                (re-search-forward "^\\\\(.+\\\\)$")
                )
              (match-string 1)))

    ruby = lambda{
##### [with]
      with(:save_excursion) do
        goto_char 1
        re_search_forward('^\\(.+\\)$')
      end
      match_string 1
##### [/with]
    }
    assert_equal(el4r_lisp_eval(lisp), ruby[])

  end


  # helper method:
  # execute a block with temporary buffer.
  # and return the contents of buffer.
  def with_temp_buffer_string(&block)
    with(:with_temp_buffer){
      self.instance_eval(&block)
      buffer_string
    }
  end

  # this test was in test.el
  def test_test_el__debug_ruby_eval_report
    actual = with_temp_buffer_string {
      el4r_lisp_eval %q((progn
(el4r-debug-ruby-eval-report "nil")
(el4r-debug-ruby-eval-report "true")
(el4r-debug-ruby-eval-report "false")
(el4r-debug-ruby-eval-report "1 + 6")
(el4r-debug-ruby-eval-report "\"String\"")
))
    }
    expected = <<EOB
nil
  => nil
true
  => t
false
  => nil
1 + 6
  => 7
"String"
  => "String"
EOB
    assert_equal(expected, actual)
  end

  def test_test_el__condition_case

    # (mode-info-describe-function 'signal 'elisp)
    # (mode-info-describe-function 'condition-case 'elisp)
    el4r_lisp_eval %q((progn
(put 'test-error
     'error-conditions                        
     '(error test-error))
(put 'test-error 'error-message "Test Error")
    ))
    #'
    el4r_lisp_eval %q((progn
(setq error-desc nil)
(condition-case err
    (signal 'test-error '(123))
  (test-error (setq error-desc (format "Error is passed: %s" err)))
  )
))
    #'
    assert_equal("Error is passed: (test-error 123)", elvar.error_desc)

    el4r_lisp_eval %q((progn
(setq error-desc nil)
(condition-case err
    (el4r-ruby-eval "el4r_lisp_eval(\"(signal 'test-error '(123))\")")
  (test-error (setq error-desc (format "Error is passed: %s" err)))
  )
))
    #'
    assert_equal("Error is passed: (test-error 123)", elvar.error_desc)
  end

  # eval test
  def test_el4r_eval
    result = with_temp_buffer_string{
      el4r_lisp_eval(<<'EOF')
        (insert-string (el4r-ruby-eval "\"Hello from ruby from emacs from ruby!\n\""))
EOF
    }
    assert_equal("Hello from ruby from emacs from ruby!\n", result)
    assert_equal(true, el4r_lisp_eval('t'))
  end


  # list: cons, car/cdr
  def test_list
    list = el("'(3 2 1)")
    list = cons(4, list)
    assert_equal("(4 3 2 1)", prin1_to_string(list))

    ary = []
    while list
      ary << car(list)
      list = cdr(list)
    end
    assert_equal("[4, 3, 2, 1]", ary.inspect)
  end

  # pass a Ruby object to Emacs
  def test_object
    obj = Object.new
    assert_equal("Is ruby object passed? ... true",
                 "Is ruby object passed? ... #{car(cons(obj, nil)) == obj}")
  end    

  

  # Using defun ( Proc -> Lambda conversion )
  def test_defun_function
    defun(:my_ruby_func) { |a|
      0
    }
    # redefine
    defun(:my_ruby_func) { |a|
      "String from my_ruby_func: '#{a}'"
    }
    assert_equal("String from my_ruby_func: 'Hello!'", my_ruby_func("Hello!"))
  end

  # defun a command
  def test_defun_command_1
    defun(:my_command, :interactive => true) {
      insert_string("My Interactive command from Ruby."); newline
    }

    assert_equal("My Interactive command from Ruby.\n",
                 with_temp_buffer_string{ call_interactively(:my_command) })

  end

  # defun a command with docstring
  def test_defun_command_2
##### [my_command2]
    defun(:my_command2,
          :interactive => "d", :docstring => "description...") { |point|
      insert_string("Current point is #{point}."); newline
    }
##### [/my_command2]
    assert_equal("d", nth(1, commandp(:my_command2)))
    assert_equal("description...", documentation(:my_command2))
    assert_equal("Current point is 1.\n",
                 with_temp_buffer_string{ call_interactively(:my_command2) })
  end

  # defun a command with lambda
  def test_defun_command_3
    sum = nil
##### [my_command3]
    interactive_proc = lambda { [1+1, 1] }
    defun(:my_command3,
          :interactive => interactive_proc) { |a, b|
      sum = a + b
    }
##### [/my_command3]
    assert_equal nil, sum
    call_interactively :my_command3
    assert_equal 3, sum
  end

  # defining odd-named function
  def test_defun_oddname
    # Lisp can define `1+1' function! LOL
    defun("1+1"){2}
    assert_equal(2, funcall("1+1"))
  end

  # Calling lambda
  def test_lambda
    lambda = el4r_lisp_eval("(lambda (i) (+ i 1))")
    assert_equal(2, funcall(lambda, 1))
  end

  # Calling special form like save-excursion
  def test_with
    x = with_temp_buffer_string {
      insert_string("a\n")
      with(:save_excursion) {
        beginning_of_buffer
        insert_string("This is inserted at the beginning of buffer."); newline
      }
    }
    assert_equal("This is inserted at the beginning of buffer.\na\n", x)
  end

  # ELListCell
  def test_ELListCell
    assert_equal([1, 2], cons(1, cons(2, nil)).to_a )
    assert_equal([10,20], el4r_lisp_eval(%((list 1 2))).map{|x| x*10})

    assert_equal({'a'=>1, 'b'=>2}, list(cons("a",1), cons("b", 2)).to_hash)
    assert_raises(TypeError){ list(cons("a",1), "b", "c").to_hash }

    assert_equal("ELListCell[1]", list(1).inspect)
    assert_equal("ELListCell[1, 2]", list(1,2).inspect)
  end
  
  # ELConsCell
  def test_ELConsCell
    assert_equal([1,2], el4r_cons_to_rubyary(cons(1,2)))
    assert_equal("ELConsCell[1, 2]", cons(1,2).inspect)

    assert_equal("ELListCell[1, 2, ELConsCell[3, 4]]", list(1,2,cons(3,4)).inspect)
    assert_equal("ELListCell[1, 2]", cons(1, list(2)).inspect)
  end

  # ELVector
  def test_ELVector
    v = el4r_lisp_eval("[1 2]")
    assert( vectorp(v) )
    assert_equal("ELVector[1, 2]", v.inspect)
    assert_equal(1, v[0])
    assert_equal(1, v[-2])
    assert_raises(ArgumentError) { v[2] } # index is too large
    assert_raises(TypeError) { v["X"] }

    assert_equal([1, 2], v[0,2])
    assert_equal([1, 2], v.to_a)

    # Enumerable
    assert_equal(1, v.find{|x| x==1})

    # to_ary
    one, = v
    assert_equal(1, one)

    # aset
    elvar.v = v
    assert_equal(10, v[0]=10)
    assert_equal(10, v[0])
    assert_equal([10,2], v.to_a)
    assert_equal(10, elvar.v[0])
    assert_equal([10,2], elvar.v.to_a)
    assert_raises(ArgumentError) { v[2]=3 } # index is too large
    assert_raises(TypeError) { v["X"]=1 }

    v[-1]=20
    assert_equal([10,20], elvar.v.to_a)
  end

  # Accessing to lisp variables with elvar
  def test_elvar
    elvar.myvar = 123
    assert_equal(123, elvar.myvar)

    elvar["myvar"] = 456
    assert_equal(456, elvar["myvar"])
    
    assert( elvar.myvar == elvar["myvar"] )
  end

  # get/set an odd-named variable
  def test_elvar__oddname
    elvar["*an/odd+variable!*"] = 10
    assert_equal(10, elvar["*an/odd+variable!*"])
  end

  # Error passing
  def test_error
    assert_raises(RuntimeError) {
      el4r_lisp_eval(<<-'EOF')
        (el4r-ruby-eval "raise \"Is error handled correctly?\""))
      EOF
    }
  end

  # let
  def test_let
    elvar.testval = 12
    testval_in_letblock = nil
    let(:testval, 24) {
      testval_in_letblock = elvar.testval
    }

    assert_equal(24, testval_in_letblock)
    assert_equal(12, elvar.testval)
  end

  # Regexp convert: Convert Ruby regexps to MESSY Emacs regexps.
  def test_regexp
#  (find-node "(emacs-ja)Regexps")
    
    conv = lambda{|from,to| assert_equal(to, el4r_conv_regexp(from)) }
    conv[ //, '' ]
    conv[ /a/, 'a' ]
    conv[ /a./, 'a.' ]
    conv[ /a*/, 'a*' ]
    conv[ /a+/, 'a+' ]
    conv[ /a?/, 'a?' ]
    conv[ /[ab]/, '[ab]' ]
    conv[ /[^ab]/, '[^ab]' ]
    conv[ /^ab/, '^ab' ]
    conv[ /ab$/, 'ab$' ]
    conv[ /a|b/, 'a\|b' ]
    conv[ /(ab)/, '\(ab\)' ]
    conv[ /\As/, '\`s' ]
    conv[ /s\Z/, %q[s\'] ]
    # \=
    conv[ /\bball\B/, '\bball\B']
    # \<
    # \>
    conv[ /\w/, '[0-9A-Za-z_]']
    conv[ /\W/, '[^0-9A-Za-z_]']
    # \sC
    # \SC
    # \D (number)
  end

  # Now you can specify a Ruby regexp to string-match, re-search-forward and so on
  def test_string_match
    s = "a"
    assert_equal(0, string_match("a", s))
    assert_equal(0, string_match(/a/, s))
    assert_equal(0, string_match('\(a\|\b\)', s))
    assert_equal(0, string_match(/a|b/, s))
    assert_equal(0, string_match(/^a/, s))
    assert_equal(0, string_match(/a$/, s))
    assert_equal(0, string_match(/.*/, s))
    assert_equal(nil, string_match(/not-match/, s))
    
  end

  # ElMixin: elisp {}
  def test_elmixin
    eval %{
      class ::Foo
        include ElMixin
        def foo
          elisp {
            [self.class, outer.class]
          }
        end

        def one
          1
        end
      end

    }

    el4r, outer = Foo.new.foo
    assert_equal(El4r::ELInstance, el4r)
    assert_equal(Foo, outer)
  end

  # EL error
  def test_elerror
    errormsg = nil
    begin
      el4r_lisp_eval(%q((defun errorfunc0 ())))
      with(:with_current_buffer, "*scratch*"){
        let(:x, 1) {
          with(:save_excursion){
            errorfunc0 1       # wrong number of argument!!
          }
        }
      }
      flunk
    rescue
      errormsg = $!.to_s
    end

    assert_match(/\n\(errorfunc0.+save-excursion.+let.+with-current-buffer.+$/m, errormsg.to_s) 
  end

  # to_s: Implicitly call prin1_to_string
  def test_to_s
    list = funcall(:list,1)
    assert_equal("(1)", "#{list}")
    assert_equal( prin1_to_string(list), list.to_s)
  end

  # defadvice 1
  def test_defadvice_1
    defun(:adtest1){
      elvar.v = 1
    }
    with(:defadvice, el("adtest1 (after adv activate)")){
      elvar.v = 2
    }
    adtest1

    assert_equal(2, elvar.v)
  end

  # defadvice 2
  def test_defadvice_2
    elvar.w = 0
    elvar.x = 0
    defun(:adtest_2){
      elvar.w += 1
      3
    }
    defadvice(:adtest_2, :around, :adv2, :activate) {
      ad_do_it
      elvar.x = 10
      ad_do_it
    }
    ret = adtest_2()

    assert_equal(2, elvar.w)
    assert_equal(10, elvar.x)
    assert_equal(3, ret)
  end

  # defadvice 3
  def test_defadvice_3
    begin
##### [adtest3]
      # define a function
      defun(:adtest3){ 1 }
##### [/adtest3]
      assert_equal(1, adtest3())
      assert_equal(nil, commandp(:adtest3))

##### [adtest3-advice]
      # now define an advice
      defadvice(:adtest3, :around, :adv3, :activate,
                :docstring=>"test advice", :interactive=>true) {
        ad_do_it
        elvar.ad_return_value = 2
      }
##### [/ad_return_value]
      assert(commandp(:adtest3))
      assert_equal(2, adtest3())
      assert_match(/test advice/, documentation(:adtest3))
    ensure
      ad_deactivate :adtest3
#      fmakunbound :adtest3
    end
  end

  # bufstr
  def test_bufstr
    s = bufstr(newbuf(:name=>"axx", :contents=>"foo!"))
    assert_equal("foo!", s)

    newbuf(:name=>"axxg", :contents=>"bar!", :current=>true)
    s = bufstr 
    assert_equal("bar!", s)
  end

  def xtest_ad_do_it_invalid
    assert_raises(El4r::El4rError){
      ad_do_it
    }
  end

  # el_load
  def test_el_load
    begin
      el = File.expand_path("elloadtest.el")
      open(el, "w"){|w| w.puts(%q((setq elloadtest 100)))}
      el_load(el)
      assert_equal(100, elvar.elloadtest)
    ensure
      File.unlink el
    end
  end

  # equality
  def test_EQUAL
    b1 = current_buffer
    b2 = current_buffer
    assert(b1 == b1)
    assert(b1 == b2)
    assert_equal(b1,b2)
  end

  # test delete-other-windows workaround in xemacs
  def test_delete_other_windows
    w = selected_window
    elvar.window_min_height = 1
    split_window
    split_window 
    delete_other_windows
    assert(one_window_p)
    assert(eq(w, selected_window))
  end

  # Lisp string -> Ruby string  special case
  def test_el4r_lisp2ruby__normal
    cmp = lambda{|str| assert_equal(str, eval(el4r_lisp2ruby(str)))}
# (mode-info-describe-function 'prin1-to-string 'elisp)
# (string= "\021" (el4r-ruby-eval (el4r-lisp2ruby "\021")))

    cmp[ "" ]
    cmp[ "a"*9999 ]
    cmp[ '1' ]
    cmp[ 'a' ]
    cmp[ '\\' ]
    cmp[ '\\\\' ]
    cmp[ '\\\\\\' ]
    cmp[ '""' ]
    cmp[ '"' ]
    cmp[ "''" ]
    cmp[ '#{1}' ]
    cmp[ '\#{1}' ]
    cmp[ '#{\'1\'}' ]
    cmp[ '#@a' ]
    cmp[ "\306\374\313\334\270\354" ]  # NIHONGO in EUC-JP
  end

  def test_el4r_lisp2ruby__treat_ctrl_codes
    cmp = lambda{|str| assert_equal(str, eval(el4r_lisp2ruby(str)))}
    elvar.coding_system_for_write :binary
    elvar.coding_system_for_write :binary
    set_buffer_file_coding_system :binary
    el4r_treat_ctrl_codes { 
      cmp[ "" ]
      cmp[ "a"*9999 ]
      cmp[ '1' ]
      cmp[ 'a' ]
      cmp[ '\\' ]
      cmp[ '\\\\' ]
      cmp[ '\\\\\\' ]
      cmp[ '""' ]
      cmp[ '"' ]
      cmp[ "''" ]
      cmp[ '#{1}' ]
      cmp[ '\#{1}' ]
      cmp[ '#{\'1\'}' ]
      cmp[ '#@a' ]

      cmp[ "\ca" ]
      cmp[ "\cb" ]
      cmp[ "\cc" ]
      cmp[ "\cd" ]
      cmp[ "\ce" ]
      cmp[ "\cf" ]
      cmp[ "\cg" ]
      cmp[ "\ch" ]
      cmp[ "\ci" ]
      cmp[ "\cj" ]
      cmp[ "\ck" ]
      cmp[ "\cl" ]
      # C-m
      # cmp[ "\cn" ]  failed on xemacs
      # cmp[ "\co" ]  failed on xemacs
      cmp[ "\cp" ]
      cmp[ "\cq" ]
      # C-r
      cmp[ "\cs" ]
      cmp[ "\ct" ]
      cmp[ "\cu" ]
      cmp[ "\cv" ]
      cmp[ "\cw" ]
      cmp[ "\cx" ]
      # cmp[ "\cy" ]
      cmp[ "\cz" ]
      cmp[ "\306\374\313\334\270\354" ]  # NIHONGO in EUC-JP
    }
  end

  
  def el4r_load_test_helper(dir)
    begin
      $loaded = nil
      tmpscript = "#{dir}/__testtmp__.rb"
      "$loaded = true".writef(tmpscript)
      el4r_load "__testtmp__.rb"
      assert_equal(true, $loaded)
    ensure
      FileUtils.rm_f tmpscript
    end
  end

  def test_el4r_load__load_path
    begin
      load_path_orig = el4r.conf.el4r_load_path
      tmp = Dir.tmpdir
      load_path = [ tmp, "#{tmp}/a" ]
      el4r.conf.el4r_load_path = load_path
      load_path.each do |dir|
        FileUtils.mkdir_p dir
        el4r_load_test_helper dir
      end
    ensure
      el4r.conf.el4r_load_path = load_path_orig
      FileUtils.rm_rf "#{tmp}/a"
    end
    
  end

  def test_el4r_load__not_exist
    assert_raises(LoadError) { el4r_load "__not_exist.rb" }
    assert_equal(false,  el4r_load("__not_exist.rb", true))
  end

  def test_el4r_load__order
    begin 
      $loaded = nil
      load_path = el4r.conf.el4r_load_path = [ el4r_homedir, el4r.site_dir ]
      FileUtils.mkdir_p load_path
      rb = "__testtmp__.rb"
      home_rb = File.expand_path(rb, el4r_homedir)
      site_rb = File.expand_path(rb, el4r.site_dir)
      "$loaded = :OK".writef(home_rb)
      "$loaded = :NG".writef(site_rb)
      el4r_load rb
      assert_equal(:OK, $loaded)
    ensure
      FileUtils.rm_f [home_rb, site_rb]
    end
  end

  def test_stdlib_loaded
    assert_equal(true, fboundp(:winconf_push))
  end

  def test_winconf
    # make a winconf
    switch_to_buffer "a buffer"
    insert "string"
    pt = point
    # current_window_configuration does not works with xemacs -batch. I do not know why.
    assert( one_window_p )
    buf = current_buffer

    winconf_push

    # alter the winconf
    goto_char 1
    split_window

    winconf_pop

    # revive the winconf
    assert( one_window_p )
    assert_equal(buf, current_buffer)
    assert_equal(pt, point)
  end

  def test_el4r_output
    printf("\t\n\ca!%s!","a")
    print(1)
    assert_equal("\t\n\ca!a!1", bufstr("*el4r:output*"))
  end

  def test_process_autoloads
    begin
      tmp = Dir.tmpdir
      autoload_dir = "#{tmp}/autoload"
      FileUtils.mkdir_p autoload_dir
      $ary = []
      %w[01first.rb 02second.rb 03third.rb].each_with_index do |fn, i|
        open(File.join(autoload_dir, fn), "w"){|f| f.write "$ary << #{i}" }
      end
      el4r_process_autoloads autoload_dir

      assert_equal [0,1,2], $ary
    ensure
      FileUtils.rm_rf autoload_dir
    end
  end

  def test_eval_after_load
    begin
      tmp = Dir.tmpdir
      add_to_list :load_path, tmp
      el = "#{tmp}/hoge.el"
      open(el, "w"){|f| f.write "(setq hoge 100)" }

      elvar.hoge = 1
      eval_after_load("hoge") do
        elvar.hoge = 200
      end
      assert_equal 1, elvar.hoge

      el_load "hoge"
      assert_equal 200, elvar.hoge
    ensure
      FileUtils.rm_f el
    end
  end

  def test_define_derived_mode
    @passed = false
##### [derived]
    define_derived_mode(:foo_mode, :fundamental_mode, "FOO", "doc") do
      @passed = true
    end
##### [/derived]
    assert_equal false, @passed
    foo_mode
    assert_equal true, @passed
    assert_equal "foo-mode", elvar.major_mode.to_s

    @passed = false
    define_derived_mode("bar-mode", el(:foo_mode), "Bar") do
      @passed = true
    end
    assert_equal false, @passed
    bar_mode
    assert_equal true, @passed

    define_derived_mode("baz-mode", el(:bar_mode), "Baz")
    baz_mode
    assert_equal "baz-mode", elvar.major_mode.to_s

  end

  def test_define_minor_mode
    @passed = false
##### [minor-mode]
    define_minor_mode(:a_minor_mode, "test minor mode") do
      @passed = true
    end
##### [/minor-mode]
    assert_equal false, @passed
    a_minor_mode
    assert_equal true, @passed
    assert_equal true, elvar.a_minor_mode
  end

# end of TestEl4r
end

# newbuf examples
class TestNewbuf < Test::Unit::TestCase
  include ElMixin

  def setup
    @bufname = "buffer-does-not-exist!!!"
  end

  def teardown
    kill_buffer(@bufname) if get_buffer(@bufname)
  end

  def setbuf
    set_buffer @x
  end

  def test_create
    @x = newbuf(:name=>@bufname)
    setbuf
    assert_equal(true, bufferp(@x))
    assert_equal(@bufname, buffer_name(@x))
    assert_equal("", buffer_string)

    y = newbuf(:name=>@bufname)
    assert(eq(@x,y))
  end

  def test_contents
    @x = newbuf(:name=>@bufname, :contents=>"foo")
    setbuf
    assert_equal("foo", buffer_string)
    assert_equal(4, "foo".length+1)
    assert_equal(4, point)

    # buffer is erased
    @x = newbuf(:name=>@bufname, :contents=>"bar")
    setbuf
    assert_equal("bar", buffer_string)
  end

  def test_file
    begin
      file = Tempfile.path("abcd")
      @x = newbuf(:file=>file)
      setbuf
      assert_equal(file, buffer_file_name)
      assert_equal("abcd", buffer_string)
    ensure
      kill_buffer nil
      File.unlink file
    end
  end

  def test_name_and_file
    begin
      file1 = Tempfile.path("abcd")
      @x = newbuf(:name=>@bufname, :file=>file1)
      setbuf
      assert_equal(nil, buffer_file_name)
      assert_equal("abcd", buffer_string)

      # buffer is erased
      file2 = Tempfile.path("abcde")
      @x = newbuf(:name=>@bufname, :file=>file2)
      setbuf
      assert_equal("abcde", buffer_string)
 
    ensure
      kill_buffer nil
      File.unlink file1
      File.unlink file2
    end
  end
    

  def test_argerror
    assert_raises(ArgumentError){ newbuf }
    assert_raises(ArgumentError){ newbuf(:name=>nil) }
    assert_raises(ArgumentError){ newbuf(1) }
    assert_raises(ArgumentError){ newbuf("1") } # hmm.
    assert_raises(ArgumentError){ newbuf(:name=>@bufname, :line=>"a") }
    assert_raises(ArgumentError){ newbuf(:name=>@bufname, :point=>"a") }
  end

  def test_current_line
    @x = newbuf(:name=>@bufname, :contents=>"a\nb\nc\nd", :line=>2)
    setbuf
    assert_equal("b", char_to_string(char_after))
  end

  def test_point
    @x = newbuf(:name=>@bufname, :contents=>"abcde", :point=>2)
    setbuf
    assert_equal("b", char_to_string(char_after))
  end

  def test_display
    elvar.pop_up_windows = true
    @x = newbuf(:name=>@bufname, :display=>true)
    assert(get_buffer_window(@x))
    assert_nil(one_window_p)
    assert_nil(eq(selected_window, get_buffer_window(@x)))
  end

  def test_display_pop
    elvar.pop_up_windows = true
    @x = newbuf(:name=>@bufname, :display=>:pop)
    assert(get_buffer_window(@x))
    assert_nil(one_window_p)
    assert(eq(selected_window, get_buffer_window(@x)))
  end

  def test_display_only
    elvar.pop_up_windows = true
    @x = newbuf(:name=>@bufname, :display=>:only)
    assert(get_buffer_window(@x))
    assert(one_window_p)
    assert(eq(selected_window, get_buffer_window(@x)))
  end

  def test_current
    @x = newbuf(:name=>@bufname, :current=>true)
    assert_nil(get_buffer_window(@x))
    assert(eq(current_buffer, @x))
  end

  def test_read_only
    b1 = newbuf(:name=>@bufname, :current=>true, :read_only=>true, :contents=>"a")
    assert(eq(elvar.buffer_read_only, true))
    assert_equal("a", buffer_string)

    b2 = newbuf(:name=>@bufname, :current=>true, :read_only=>true, :contents=>"c")
    assert(eq(b1,b2))
    assert(eq(elvar.buffer_read_only, true))
    assert_equal("c", buffer_string)
  end

  def test_bury
    buf = newbuf(:name=>@bufname, :display=>:pop, :bury=>true)
    assert(eq(buf, (buffer_list nil)[-1]))
  end

  def test_block
    buf = newbuf(:name=>@bufname, :current=>true) {
      text_mode
    }
    mode = with(:with_current_buffer,buf){elvar.major_mode}.to_s
    assert_equal("text-mode", mode)
  end
end

class TestDefunWithinClass < Test::Unit::TestCase

  class Foo
    include ElMixin

    def initialize(x)
      elvar.v = x[:value]
      defun(:twice_v) do
        elvar.v *= 2
      end

      defun(:str0) do
        do_str0 x[:str]
      end
    end

    def do_str0(str)
      (str*2).upcase
    end
  end

  def test0
    Foo.new(:value=>10, :str=>"ab")
    twice_v
    assert_equal(20, elvar.v)
    assert_equal("ABAB", str0)
  end
end

class TestElApp < Test::Unit::TestCase

  class Foo < ElApp
    def initialize(x)
      elvar.v = x[:value]
      defun(:twice_v) do
        elvar.v *= 2
      end

      defun(:str0) do
        do_str0 x[:str]
      end
    end

    def do_str0(str)
      (str*2).capitalize
    end
  end

  def test0
    Foo.run(:value=>10, :str=>"ab")
    twice_v
    assert_equal(20, elvar.v)
    assert_equal("Abab", str0)
  end
end



--
rubikitch
http://www.rubyist.net/~rubikitch/index.en.html

In This Thread

Prev Next