[#329967] Ruby beginner Problem — Zayd Connor <devrubygem@...>

I get the following error message when running the code below:

18 messages 2009/03/01
[#329972] Re: Ruby beginner Problem — lasitha <lasitha.ranatunga@...> 2009/03/01

On Sun, Mar 1, 2009 at 10:46 AM, Zayd Connor <devrubygem@gmail.com> wrote:

[#329973] Re: Ruby beginner Problem — Zayd Abdullah <devrubygem@...> 2009/03/01

Thanks Lasitha that worked perfect. I'm slowly getting more comfortable with

[#329975] Re: Ruby beginner Problem — Justin Collins <justincollins@...> 2009/03/01

Zayd Abdullah wrote:

[#330022] Delegating class methods — abc <arcadiorubiogarcia@...>

Hi all,

17 messages 2009/03/01

[#330038] Rub 1.9: "inline rescue" doesn't work? — Iñaki Baz Castillo <ibc@...>

Hi, is there any explanation for the folowing big difference between the sa=

11 messages 2009/03/01

[#330067] passing a method as a paramter — Sarah Allen <sarah@...>

I'm probably missing some basic Ruby syntax, but I'm relatively new to

13 messages 2009/03/02

[#330097] Compiling a Ruby app — Sharagoz -- <blashyrkh1@...>

Hi

22 messages 2009/03/02
[#330193] Re: Compiling a Ruby app — David Masover <ninja@...> 2009/03/03

Sharagoz -- wrote:

[#330209] expanding environment variable — Daniel Schoch <trash@...>

Hi,

13 messages 2009/03/03
[#330212] Re: expanding environment variable — Dominik Honnef <dominikho@...> 2009/03/03

On [Tue, 03.03.2009 23:28], Daniel Schoch wrote:

[#330246] fixnum problem plz help — Guy Dols <guy_dols@...>

hy

14 messages 2009/03/03

[#330287] Any solutions to Ruby's inconsistencies? — "C. Dagnon" <c-soc-rubyforum@...>

Ruby has definite positives over Java and even other scripting

29 messages 2009/03/04
[#330292] Re: Any solutions to Ruby's inconsistencies? — Yossef Mendelssohn <ymendel@...> 2009/03/04

On Mar 4, 10:02=A0am, "C. Dagnon" <c-soc-rubyfo...@dagnon.net> wrote:

[#330322] Re: Any solutions to Ruby's inconsistencies? — "C. Dagnon" <c-soc-rubyforum@...> 2009/03/04

Yossef Mendelssohn wrote:

[#330388] Re: Any solutions to Ruby's inconsistencies? — Yossef Mendelssohn <ymendel@...> 2009/03/05

On Mar 4, 3:32=A0pm, "C. Dagnon" <c-soc-rubyfo...@dagnon.net> wrote:

[#330401] Re: Any solutions to Ruby's inconsistencies? — "C. Dagnon" <c-soc-rubyforum@...> 2009/03/05

Yossef Mendelssohn wrote:

[#330363] Ruby -Question about Framewroks — jazzez ravi <jazzezravi@...>

Hi All,

12 messages 2009/03/05

[#330383] add a new line after, w/txtfile thats comma delimited — Mmcolli00 Mom <mmc_collins@...>

How do you add a new line after you have split a text file with

16 messages 2009/03/05

[#330387] Ruby - Imperative Language Features? — Mike Stephens <rubfor@...>

The Wikipedia entry for Ruby says:

12 messages 2009/03/05

[#330601] how to un-ragged a 2D array? — Phlip <phlip2005@...>

Rubies:

12 messages 2009/03/07

[#330630] Can I access or find a object from it's instance variable? — Aki Wakabayashi <zzyzx2001@...>

Hello.

14 messages 2009/03/08

[#330638] OO style tutorials? — Paul Archer <paul@...>

I'm pretty new to Ruby, and while I've read (and mostly get) several books

20 messages 2009/03/08

[#330665] What are the 5 most innovative ruby projects/libraries? — Camille Roux <roux.camille@...>

Hi,

27 messages 2009/03/08

[#330701] Ruby OpenGL Gears example that uses shiny and velvet GLSL shaders — Michael Brooks <michael.brooks@...>

Hello:

11 messages 2009/03/09
[#330722] Re: Ruby OpenGL Gears example that uses shiny and velvet GLSL shaders — Matthias Reitinger <reitinge@...> 2009/03/09

Michael Brooks wrote:

[#330718] MacRuby 0.4 — Laurent Sansonetti <laurent.sansonetti@...>

Hi,

17 messages 2009/03/09

[#330954] How Many hours in A day — Zayd Connor <devrubygem@...>

I have a very simple ? How many hours in a day should someone who is new

17 messages 2009/03/11

[#330990] How to read a charecters from and image? — rails and rails only <mjayakumar2k6@...>

16 messages 2009/03/12
[#330993] Re: How to read a charecters from and image? — pjb@... (Pascal J. Bourguignon) 2009/03/12

rails and rails only <mjayakumar2k6@yahoo.com> writes:

[#330994] Re: How to read a charecters from and image? — Redd Vinylene <reddvinylene@...> 2009/03/12

Stop that! He's probably looking to crack CAPTCHAs.

[#331216] does IO.read block? — Michael Malone <michael.malone@...>

Hi All,

16 messages 2009/03/15
[#331218] Re: does IO.read block? — Robert Klemme <shortcutter@...> 2009/03/15

On 15.03.2009 23:02, Michael Malone wrote:

[#331307] Trying to install Fox, FXRuby, and IFMapper on Mac OS X — kpkilburn@...

I can't seem to find a specific answer on this...

12 messages 2009/03/16

[#331326] Dynamically extending modules once they have been included — pete@...373.net

It doesn't seem possible to dynamically extend modules once they have

14 messages 2009/03/17

[#331371] free RAM problem — Edouard Dantes <edrd.dantes@...>

Hi,

14 messages 2009/03/17

[#331411] hpricot 0.7 — _why <why@...>

Please enjoy a succulent, new Hpricot. A bit faster, some Ruby 1.9

25 messages 2009/03/17

[#331476] Complex sort of matrix possible, e.g. like Excel? — RichardOnRails <RichardDummyMailbox58407@...>

Hi,

18 messages 2009/03/18

[#331478] REXML get specific element — Pierre Pat <theyojimbo@...>

All,

15 messages 2009/03/18

[#331568] Modulo ? — Zayd Connor <devrubygem@...>

Maybe i need to get some sleep, but can someone explain how modulos

16 messages 2009/03/19

[#331628] Passing a named function instead of a code block? — Paul Jungwirth <once@9stmaryrd.com>

Hello,

13 messages 2009/03/20
[#331630] Re: Passing a named function instead of a code block? — Matthias Reitinger <reitinge@...> 2009/03/20

Paul Jungwirth wrote:

[#331760] Ruby GUI Libs — ntwrkd <ntwrkd@...>

Is there a nicer GUI framework for Ruby other than RubyGoo?

12 messages 2009/03/21

[#331793] Newbie needs help with first project — Daniel Dale <dochappy@...>

I was told about Ruby several weeks ago and started my journey lol. I've

15 messages 2009/03/22
[#331796] Re: Newbie needs help with first project — Stefan Codrescu <fixxie.wits@...> 2009/03/22

On Sun, Mar 22, 2009 at 9:32 AM, Daniel Dale <dochappy@gmail.com> wrote:

[#331803] convert PNG to hex — jeljer te Wies <jeljer@...>

Hey people! ..

20 messages 2009/03/22

[#331899] Test::Unit - same test, different "args" — "Luke St.Clair" <secureboot@...>

I need to run the same unit test case more than 10 times (around 150

14 messages 2009/03/23

[#331924] Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — Felipe Coury <felipe.coury@...>

Hello there!

20 messages 2009/03/24
[#331931] Re: Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — gcristelli <giovanni.cristelli@...> 2009/03/24

On 24 Mar, 04:21, Felipe Coury <felipe.co...@gmail.com> wrote:

[#331938] Re: Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — Felipe Coury <felipe.coury@...> 2009/03/24

Giovanni / Rob,

[#331940] Re: Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — Felipe Coury <felipe.coury@...> 2009/03/24

Some more discoveries...

[#331941] Re: Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — Felipe Coury <felipe.coury@...> 2009/03/24

Just as a FYI, it works!!!

[#331948] Re: Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — Rob Biedenharn <Rob@...> 2009/03/24

On Mar 24, 2009, at 2:35 AM, Felipe Coury wrote:

[#365126] Re: Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby — Joshua Mckinney <joshmckin@...> 2010/07/01

Having no luck with this. Getting the following error when generating

[#331930] tagz-5.0.0 — "ara.t.howard" <ara.t.howard@...>

44 messages 2009/03/24
[#332078] Re: [ANN] tagz-5.0.0 — "Andrew S. Townley" <ast@...> 2009/03/25

Hi Ara,

[#332095] Re: [ANN] tagz-5.0.0 — "ara.t.howard" <ara.t.howard@...> 2009/03/25

[#332141] Re: [ANN] tagz-5.0.0 — "Andrew S. Townley" <ast@...> 2009/03/25

On Wed, 2009-03-25 at 23:23 +0900, ara.t.howard wrote:

[#332160] Re: [ANN] tagz-5.0.0 — "ara.t.howard" <ara.t.howard@...> 2009/03/26

[#331971] : HOWTO start irb on a different object — Jeremy Henty <onepoint@...>

I wanted to have irb start its session on an object other than the

10 messages 2009/03/24

[#332023] ruby and 2D graphics — Philip Müller <me@...>

Hi everybody,

22 messages 2009/03/24
[#332029] Re: ruby and 2D graphics — Philip Müller <me@...> 2009/03/24

On Tue, 24 Mar 2009 21:08:34 +0100, Peter Zotov <whitequark@whitequark.ru>

[#332112] Parsing xml — Arun Kumar <arunkumar@...>

Hi,

24 messages 2009/03/25
[#332115] Re: Parsing xml — "Peter Zotov" <whitequark@...> 2009/03/25

Quoting "Arun Kumar" <arunkumar@innovaturelabs.com>:

[#332116] Re: Parsing xml — Arun Kumar <arunkumar@...> 2009/03/25

Peter Zotov wrote:

[#332118] Re: Parsing xml — "Peter Zotov" <whitequark@...> 2009/03/25

Quoting "Arun Kumar" <arunkumar@innovaturelabs.com>:

[#332206] Update latest Ruby Version 1.9 on Mac OSX — Thomas Khaipi <sayakyi@...>

Dear All,

14 messages 2009/03/26

[#332357] testy.rb - ruby testing that's mad at the world — "ara.t.howard" <ara.t.howard@...>

55 messages 2009/03/28
[#332418] Re: testy.rb - ruby testing that's mad at the world — Brian Candler <b.candler@...> 2009/03/29

Ara Howard wrote:

[#332405] Ruby 1.9, OS X, command line: negative string size (ArgumentError) — Bartlomiej Owczarek <bartlomiej@...>

Hello,

13 messages 2009/03/29

[#332474] Symbols garbage collector in Ruby1.9, fixed? — Iñaki Baz Castillo <ibc@...>

Hi, in Ruby 1.8 there is an issue when adding more and more Symbols

27 messages 2009/03/30

[#332520] When to use instance variables @ — Steve Dogers <stevedogers@...>

Hi, I have a couple questions about instance variables in Ruby.

20 messages 2009/03/30

[#332547] Localmemcache-0.2.0: The beauty of memcached. For local data. Blazingly fast. — "Sven C. Koehler" <schween@...>

Hi,

13 messages 2009/03/30

[#332624] Move over, Phusion, here comes the *real* Enterprise Edition! — Jg W Mittag <JoergWMittag+Usenet@...>

Hi!

20 messages 2009/03/31

Re: testy.rb - ruby testing that's mad at the world

From: Brian Candler <b.candler@...>
Date: 2009-03-30 08:12:54 UTC
List: ruby-talk #332475
Ara Howard wrote:
>>  assert_equal 42, ultimate.answer, "name"
> 
> you can basically do that too, but i continually forget which is
> expected and which is actual and, as you know, that's a slippery error
> to track down at times.

Perhaps - but it's one rule that only needs to be learned once.

I notice that testy supports check <name>, <expected>, <actual> too.

Testy does (intentially) force you to name your tests, whereas 
Test::Unit will happily let you write

  check <expected>, <actual>

I really don't like having to name each assertion, maybe because I'm 
lazy or maybe because it feels like DRY violation. I've already said 
what I want to compare, why say it again?

> because littering the example code with esoteric testing framework
> voodoo turns it into code in the testing language that does not
> resemble how people might actually use the code

I agree with this. This is why I absolutely prefer Test::Unit (and 
Shoulda on top of that) over Rspec.

> i always end up writing
> both samples and tests - one of the goals of testy is that, by having
> a really simple interface and really simple human friendly output we
> can just write examples that double as tests.

Hmm, this is probably an argument *for* having a DSL for assertions - to 
make the assertions read as much like example code ("after running this 
example, you should see that A == B and C < D")

Neither

  result.check "bar attribute", :expected => 123, :actual => res.bar

nor

  assert_equal 123, res.bar, "bar attribute"

reads particularly well here, I think. Ideally it should be as simple as 
possible to write these statements of expectation. How about some eval 
magic?

  expect[
    "res.foo == 456",
    "res.bar == 123",
    "res.baz =~ /wibble/"
  ]

Maybe need to pass a binding here, but you get the idea. (Before someone 
else points it out, this is clearly a case which LISP would be very well 
suited to handling - the same code to execute can also be displayed in 
the results)

The problem here is reporting on expected versus actual, but perhaps you 
could split on space and report the value of the first item.

  expected:
    - res.foo == 456
    - res.bar == 123
  unexpected:
    -
      test: res.baz =~ /wibble/
      term: res.baz
      value: "unexpected result"

Going too far this way down this path ends up with rspec, I think.

In fact, I don't really have a problem with writing

  res.foo.should == 456

The trouble is the hundreds of arcane variations on this.

You solve this problem by only having a single test (Result#check), and 
indeed if rspec only had a single method (should_equal) that would be 
fairly clean too. However this is going to lead to awkwardness when you 
want to test for something other than equality: e.g.

   res = (foo =~ /error/) ? true : false
   result.check "foo should contain 'error'", :expected=>true, 
:actual=>res

Apart from being hard to write and read, that also doesn't show you the 
actual value of 'foo' when the test fails.

Is it worth passing the comparison method?

   result.check "foo should contain 'error'", foo, :=~, /error/

But again this is getting away from real ruby for the assertions, in 
which case it isn't much better than

   assert_match /error/, foo, "foo should contain 'error'"

   assert_match /error/, foo  # lazy/DRY version

> get a listing of which tests/examples i can run

Yes, parseable results and test management are extremely beneficial. 
Those could be retro-fitted to Test::Unit though (or whatever its 
replacement in ruby 1.9 is called)

Getting rid of the at_exit magic is also worth doing.

> you can also do something like this (experimental) to just make a
> simple example
> 
> cfp:~/src/git/testy > cat a.rb
> require 'testy'
> 
> Testy.testing 'my lib' do
> 
>    test 'just an example of summing an array using inject' do
>      a = 1,2
>      a.push 3
>      sum = a.inject(0){|n,i| n += i}
>    end
> 
> end

Nice, could perhaps show the (expected) result inline too?

  test 'an example of summing and array using inject' do
    a = 1,2
    a.push 3
    sum = a.inject(0){|n,i| n += i}
  end.<< 6

A bit magical though. Also, we can only test the result of the entire 
block, whereas a more complex example will want to create multiple 
values and test them all.

> so the goal is making it even easier to have a user play with your
> tests/examples to see how they work, and even to allow simple examples
> to be integrated with your test suite so you make sure you samples
> still run without error too.  of course you can do this with test/unit
> or rspec but the output isnt' friendly in the least - not from the
> perspective of a user trying to learn a library, nor is it useful to
> computers because it cannot be parsed - basically it's just vomiting
> stats and backtraces to the console that are hard for people to read
> and hard for computers to read.  surely i am not the only one that
> sometimes resorts to  factoring out a failing test in a separate
> program because test/unit and rspec output is too messy to play nice
> with instrumenting code?

I agree. Part of the problem is that when one thing is wrong making 20 
tests fail, all with their respective backtraces, it can be very hard to 
see the wood for the trees. What would be nice would be a folding-type 
display with perhaps one line for each failed assertion, and a [+] you 
can click on to get the detail for that particular one.

> yeah that's on deck for sure.  i *do* really like contexts with
> shoulda.  but still
> 
> 
> cfp:/opt/local/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.9.1 > find
> lib/ -type f|xargs -n1 cat|wc -l
>      3910
> 
> 
> if we accept the research and assume that bugs scale linerarly with
> the # of lines of code this is not good for robustness.

I disagree there - not with the research, but the implied conclusion 
that you should never use a large codebase. Shoulda works well, and I've 
not once found a bizarre behaviour in the testing framework itself that 
I've had to debug, so I trust it.

(This is not true of other frameworks though. e.g. I spent a while 
tracking this one down: 
https://rspec.lighthouseapp.com/projects/5645-rspec/tickets/677-rspec-doesnt-play-well-with-delegateclass)

> this is one
> of my main gripes with current ruby testing - my current rails app has
> about 1000 lines of code and 25,000 lines of testing framework!

Yeah, but how many lines of Rails framework? :-)

Cheers,

Brian.
-- 
Posted via http://www.ruby-forum.com/.

In This Thread