397231-398881

397075-412515 subjects 397425-397805

Can you call private methods with explicit receivers?
397231 [lists@ru y- ] My understanding is the answer is no, you can't call private methods
+ 397235 [matma.rex@gm] Probably because it would be otherwise impossible (except for using
| 397238 [lists@ru y- ] Thanks Bartosz. That makes sense. I guess due to Ruby's rich syntax it
+ 397379 [colinb2r@go ] A.new.m2 rescue puts $!.inspect

Rescue Failing in CGI Script
397236 [lists@ru y- ] I have a Ruby 1.8.7 CGI script.  Practically speaking, the whole thing
+ 397237 [matma.rex@gm] Make sure that the actual work is not done in some threads.
| 397282 [lists@ru y- ] Thanks for the input.  I tried to follow your suggestions; but, it's
+ 397284 [lists@ru y- ] Have you checked if there's a problem within the rescue clause? If
| 397360 [lists@ru y- ] Now that is absolutely an awesome suggestion.  It is exactly the type of
+ 397362 [lists@ru y- ] Well, if you still don't get the custom error, then the exception has to
  397406 [lists@ru y- ] Using the suggested technique, I was finally able to isolate and solve
  397413 [code@ap th o] It happens to the best of us -- and I know this, because I'm acquainted

[ANN] rerun 0.7 - no-frills command-line alternative to Guard and Autotest
397240 [alex@st nk .] I just released rerun 0.7. It now uses the Listen library which uses

ENV variables and tainted input
397246 [lists@ru y- ] Is it advisable to always use ENV['SOME_VALUE'].dup ?
397297 [drbrain@se m] $ ruby -e 'p ENV["PATH"].equal? ENV["PATH"]'

[ANN] Tork 18.2.1
397248 [sunaku@gm il] Tork ----> Test with fork --> https://github.com/sunaku/tork#readme

[ANN] md2man 1.2.1
397250 [sunaku@gm il] md2man - markdown to manpage

Management of words in a string
397255 [lists@ru y- ] I'm trying to make a program in which you must enter a string and
+ 397259 [jgabrielygal] You can use String#split method. You have to define very well what is
| 397296 [lists@ru y- ] and in case you want to count the words that begin with a particular
+ 397262 [lists@ru y- ] For large text you may use String#scan, which has the advantage of not
| 397265 [shortcutter@] word_count = 0
+ 397300 [lists@ru y- ] str.scan(/a\w+/).size
| 397306 [lists@ru y- ] Clearly wrong.
+ 397318 [lists@ru y- ] yeah sorry i was dump.
| 397321 [matma.rex@gm] Still wrong, sorry Hans :(
+ 397325 [lists@ru y- ] str = "a bag of bananas and one apple"
  397326 [lists@ru y- ] Try \ba\w*

Spork doesn't load 'some' models
397266 [lists@ru y- ] I've been using spork+guard+rspec with great happiness in my latest
397292 [alex@st nk .] One thought: sometimes AR model instances (and their classes) are

IEEE extended precision float
397268 [lists@ru y- ] I need to read and write an 80 bit IEEE extended precision float from
+ 397270 [jam@ja an be] Can you show us what you have tried so far?
+ 397302 [lists@ru y- ] Sure.
+ 397303 [lists@ru y- ] here also are example usages of the methods above...
+ 397305 [lists@ru y- ] What do you want to read it into? A ruby Float is just a double, you
| 397319 [lists@ru y- ] See my second post. It's okay to lose precision. In fact, a ruby Integer
| + 397324 [markus@fi ch] Maybe https://github.com/twg/raiff can give you an idea ...?
| + 397330 [lists@ru y- ] "The standard specifies the minimum requirements for an extended format
+ 397338 [lists@ru y- ] And for 44100, my C program gives

Erb templating and output buffer
397275 [lists@ru y- ] Hey guys,

Re: Rails server not starting
397277 [lists@ru y- ] Fetching source index for https://rubygems.org/
397280 [matma.rex@gm] I assume you want explanation what happened?

basic queries
397278 [lists@ru y- ] class Drawing
+ 397279 [lists@ru y- ] Because the method is supposed to be a class method and not an instance
+ 397310 [code@ap th o] As already pointed out, "def Drawing.give_me_a_circle" defines a class
+ 397447 [lists@ru y- ] Dear Ruby programmers,
  + 397448 [lists@ru y- ] There are many reasons to use class methods.
  | 397451 [ryand-ruby@z] % ruby -e 'class X; @@x = 42; def x; p @@x; end; end; X.new.x'
  | 397454 [hmaddocks@me] He probably meant class INSTANCE variables.
  | 397457 [lists@ru y- ] Yes, sorry if I confused anyone.
  + 397449 [zettabyte@gm] The answer to that question depends entirely on your (or your project's)
  + 397479 [code@ap th o] There are generally two reasons to have a class method, I think (though I

Can't access class of a loaded file in the IRB
397283 [lists@ru y- ] I have two Ruby files. I am able to access the class of one of the files
397285 [matma.rex@gm] File name "complex.rb" is used by one of Ruby's library files, and

Parsing a zip file for rows of string data
397286 [lists@ru y- ] I am really new to Ruby and could use some help with a program. I need
+ 397288 [matma.rex@gm] Well, you're almost done?
+ 397291 [lists@ru y- ] Thank you for the reply. When I try running this I get a syntax error.
| 397309 [lists@ru y- ] There are several errors. You have to quote the string with the file
+ 397293 [lists@ru y- ] You Should you move the File.open outside of the
+ 397294 [lists@ru y- ] Thank you for the reply and the help Eduardo. I will give this a test
+ 397299 [lists@ru y- ] I tried that out and it through an ArgumentError: wrong number of

Online Computer Science Courses (Using Ruby)
397287 [lists@ru y- ] offered by the likes of MIT, Stanford etc.
+ 397311 [saji@u- iz .] I have a list of course materials available online, but these are not open
+ 397314 [cczona@gm il] Berkeley's Software as a Service course https://www.coursera.org/course/saas

Re: Ruby Future in coming years
397298 [lists@ru y- ] Posted via http://www.ruby-forum.com/.
397308 [transfire@gm] ...
397312 [echristopher] Yeah. He/she sends similar messages every few weeks or months. I think
+ 397323 [peterhickman] Yeah he has posted this stuff before.
+ 397335 [transfire@gm] ...

Bobble 0.0.5
397315 [lists@ru y- ] ### Bobble 0.0.5 ###

Strange behaviour when selecting range of elements from an array?
397317 [gsinclair@gm] (1)  a = [:x, :y, :z]    => [:x, :y, :z]
+ 397320 [matma.rex@gm] ...
+ 397334 [sto.mar@we .] This behavior is (finally) documented in the development version

how do I call a method with a periodt and pass the object before it ?
397327 [lists@ru y- ] like 1.to_s , except I want 8.bits_to_bytes
397409 [echristopher] 1. define an instance method on the class of whatever goes before the

how do I call a method with a period and pass the object before it ?
397328 [lists@ru y- ] like 1.to_s , except I want 8.bits_to_bytes
+ 397329 [lists@ru y- ] class Integer
+ 397331 [thiagown@gm ] 1.9.2p290 :011 > class Fixnum
  + 397332 [thiagown@gm ] Oh, what i mean by point is the dot or period.
  | 397337 [lists@ru y- ] And that's exactly what you've been shown.
  + 397490 [lists@ru y- ] This is exactly what I was looking for. Thanks !

[ANN] Lone Star Ruby Conference 6 Registration is Now Open
397333 [jimfreeze@gm] Registration for Lone Star Ruby Conference 6 is now open!

i want to intercept DNS queries and use the results for couple tests.
397336 [eliezer@ng e] i am trying to build a RBL\DRBL like server but not for blacklists.

installing ruby-gd on OS X Lion
397339 [lists@ru y- ] I would very much appreciate if someone could spare a few seconds and

Find that number is repeated more and less times in an array
397341 [lists@ru y- ] I'm trying to find a function to find the number that is repeated over
+ 397342 [lists@ru y- ] I don't understand what you're saying.
+ 397344 [botpena@gm i] fire up irb or pry, and play w ruby,
+ 397345 [lists@ru y- ] Hash[a.group_by{|x|a.count(x)-1}.map{|k,v|[k,v.uniq]}]
+ 397355 [lists@ru y- ] a = [1, 2, 2, 3, 5, 4, 6, 2, 6, 5, 4]
  397372 [lists@ru y- ] One last thing, how do I print the results that I stay in order, because
  397389 [jgabrielygal] groups.sort.each do |count,vals|
  397392 [shortcutter@] Alternative solution

Troubled while trying to create list from hash
397343 [ml@co va es ] I have a hash with IP addresses and numbers. Each number represents the =
+ 397346 [sto.mar@we .] You should provide more information about this hash
| 397373 [ml@co va es ] So the ip is referred in the source code as "[entry.split(' ')[3]]" ... which returns the 4th parameter (if you start counting by 1 the 3rd if you count in ruby way).
| 397398 [shortcutter@] split will break if there can be whitespace between [] (where you have
+ 397354 [lists@ru y- ] No, it's not how it's intended to be used.
  + 397374 [ml@co va es ] Thanks for the detailed explanation. I need to get much more accustomed to the enumerable and other elementary ruby methods apparently :-/
  + 397397 [shortcutter@] That statement is true only for 1.8.*.  Brian, your quarrel with

Trouble installing RubyInline
397348 [lists@ru y- ] I am having trouble installing RubyInline on my Mint Linix OS.
+ 397350 [lists@ru y- ] $ gem install RubyInline
| 397353 [hassan.schro] You would be far better off installing rvm to isolate yourself from all
+ 397351 [lists@ru y- ] $ sudo apt-get gem RubyInline
  397352 [jam@ja an be] If you want Debian to manage the package, start with apt-get search rubyinli=

Calling a class method with self. doesn't work?
397356 [lists@ru y- ] Hey guys
+ 397357 [ixti@me be .] `self` always points current scope. so, to call class method from the
+ 397358 [lists@ru y- ] Thanks a lot. :-)

Array#rand vs Array#sample
397359 [lists@ru y- ] I was asking some people "Do you know if a #rand method exists on an
397364 [ymendel@po o] If you're defining a new Array instance method using random numbers and

How to Print on a single line
397367 [lists@ru y- ] How do I get the below script to print the 2nd part on a single line?
+ 397368 [wyhaines@gm ] name = gets.chomp
| 397371 [ixti@me be .] Snap! That's what I forgot about :)) But even strange voice that was
+ 397369 [lists@ru y- ] Wow!
+ 397370 [ixti@me be .] So you can either strip the result (but it will remove any
+ 397375 [ml@co va es ] Your problem is on gets which needs to be turned into gets.chomp (as already addressed earlier).

Rdoc comment block control (annotate_modules)
397376 [lists@ru y- ] My first post here ;)

Re: What's the difference between ARGF.close and ARGF.skip?
397377 [lists@ru y- ] QUOTE  "If you don't understand what closing a file does, then that is a
397378 [lists@ru y- ] wrong QUOTE;
397382 [ryand-ruby@z] File a bug or, better, a patch.

Converting a .rb file to an executable
397380 [lists@ru y- ] I am trying to convert a .rb file into an exe file using Ruby (ruby
+ 397381 [lists@ru y- ] Reattaching...
+ 397383 [echristopher] The screenshot didn't come through. Could you paste it as text?
+ 397384 [lists@ru y- ] Windows can't find 'rubyw'. Make sure you typed the name correctly, and
| 397493 [echristopher] But you are able to run Ruby scripts that haven't been converted to EXEs?
+ 397496 [lists@ru y- ] Yes, I am. I am even able to run exe on my m/c which has ruby. The issue
| 397501 [neotamizhan@] OCRA site has this warning... Maybe this could help.
+ 397504 [lists@ru y- ] oh ok..but I am using .rb file and not .rbw file..so is the warning
  397505 [neotamizhan@] try testing your .rb file with rubyw, instead of ruby. Just a thought.

why no Tk section on www.ruby-forum.com ?
397393 [lists@ru y- ] well, all is in the title; why no specific Tk section on
+ 397773 [lists@ru y- ] I'm building a basic Tk GUI. If you have questions I'll see if I can
+ 397793 [lists@ru y- ] A wiki would be nice for ruby-tk at the official homepage.

Lambdaification of Method Calls
397396 [shortcutter@] does anybody think this is a good idea to have in stdlib or even core?
+ 397410 [ibc@al ax ne] Iaki Baz Castillo
| 397411 [ibc@al ax ne] Ok, sorry, "s" is any object.
+ 397452 [transfire@gm] ...
| 397460 [ryand-ruby@z] Functors (function objects) vs delay/promise are totally different and =
+ 397461 [mikaa123@gm ] Correct me if I'm wrong (I've had a glass too much), but this looks like par=
| 397468 [shortcutter@] There are some similarities but the underlying object is usually not a
+ 397463 [matthew@ke w] My only request would be that you rename the method something like
  397469 [shortcutter@] It's not a "get" since we actually create something.  I prefer
  397474 [matthew@ke w] Rather. However I feel that if it's called #to_lambda it should be a

unable to use gems in simple scripts
397399 [lists@ru y- ] to use some simple gems.
+ 397400 [chris.hulan@] You need to use
+ 397401 [lists@ru y- ] require 'flt'
+ 397403 [quintus@qu n] Why do you use the -T option? This sets Ruby=E2=80=99s $SAFE level, which
+ 397404 [lists@ru y- ] /facepalm
  + 397405 [lists@ru y- ] You need the "include" if you want to call methods without specifying
  + 397412 [quintus@qu n] You=E2=80=99re welcome :-)

sock.setsockopt how?
397402 [eliezer@ng e] i want to use specific tcp\dup socketopts.
397407 [normalperson] Until Ruby exposes the IP_TRANSPARENT constant, you can just use 19
397414 [eliezer@ng e] Thanks Eric,

how to create a CText Tk widget ?
397408 [lists@ru y- ] I know those two nice websites for informations on Ruby/Tk, but they are
+ 397472 [nagai@ai ky ] Probably, you don't have tcllib extension package for your
+ 397484 [lists@ru y- ] thanks a lot for your answer.
| 397488 [nagai@ai ky ] I think that RubyInstaller includes standard Tcl/Tk libraries only.
+ 397489 [lists@ru y- ] I did several test with Ruby/tk samples and only the tk and tk/tile ones

learning by doing part 2 - tc game
397416 [lists@ru y- ] I am trying to learn a bit more and I've decided to make my own little
+ 397417 [lists@ru y- ] Please ignore line 33 in file game.rb.
+ 397418 [lists@ru y- ] You don't create the beast anywhere. Instead, you just get the name from
| 397419 [lists@ru y- ] Yes, that would be ok, but that means that the player has to create all
| 397421 [jgabrielygal] beasts = %w{derimor barador}.map {|name| Blue_Scale_DRAGON.new name}
| + 397422 [lists@ru y- ] thank you both, I'll try these suggestions and post back if I run into problems.
| + 397423 [lists@ru y- ] I would create only the chosen beast and not all possible ones. This seems more elegant to me.
|   397424 [lists@ru y- ] Maybe I need to clarify a bit more.
|   397426 [lists@ru y- ] The player doesn't generate anything, it's all done by the program.
|   397428 [lists@ru y- ] You're right, of course:) I misunderstood you earlier.
|   397429 [lists@ru y- ] Well, even for 1000 objects you probably won't notice an actual
|   397430 [lists@ru y- ] One more thing, are we talking about the same "selection"? I was
|   397435 [jgabrielygal] What Jan is saying is that you should defer the creation of the actual
|   397450 [lists@ru y- ] Thank you for the clarification. I understand the difference and I have
|   + 397453 [wbrisett@at ] When I've seen similar things in my code, I resort to using "#{beast}.to_s to
|   | 397455 [lists@ru y- ] I've tried it and I got #<Blue_Scale_DRAGON:0x90653ac>.to_s
|   + 397456 [lists@ru y- ] How is the object supposed to know that you want the value of @name when
|   | 397458 [lists@ru y- ] Jan thank you again. I should have seen this. I think I best turn in:)
|   + 397459 [sduncan@we a] You could define a #to_s method on your dragon class, in which case you
|     397527 [lists@ru y- ] I've done quite some reprogramming according to the advises above and I
|     397534 [lists@ru y- ] begin
|     397544 [lists@ru y- ] I think random would be better if I add more beasts and spells in the
|     397545 [lists@ru y- ] possible_cards = {
+ 397420 [lists@ru y- ] When you've already got an array with the beasts, you can use the player
+ 397546 [lists@ru y- ] You seem to be coming from a language like Java or so. Note that Ruby
| + 397547 [lists@ru y- ] Actually, I have no programming background. I started with VBA for
| | 397559 [lists@ru y- ] I wanted to say repository AND licences of course:)
| + 397596 [ryand-ruby@z] % ruby -e 'begin puts "bad"; end while false'
+ 397562 [lists@ru y- ] Well, I've never used Bazaar. I think most people use Git together with
| 397564 [lists@ru y- ] now, before the battle, as suggested above, I have list of cards with
+ 397566 [lists@ru y- ] Yes. The problem is that b.attributes *outputs* a string instead of
+ 397599 [lists@ru y- ] Yeah, I actually remembered there was this strange "do-while" loop,
| 397605 [lists@ru y- ] well,  I like to stay away from until/while, however, I am not sure how
| 397606 [lists@ru y- ] No, "until" and "while" are perfectly fine, I was talking about this
| 397637 [lists@ru y- ] I need (hopefully) one final help for this game:)
| 397638 [jgabrielygal] One approach that implies a huge refactor of your datastructures,
| 397647 [lists@ru y- ] I think you are right, this is probably the way to go and much better than branching or making different methods for different combinations of cards (would make game expansions impossible).
| 397648 [jgabrielygal] Yes, this is an example. You might have a GameState class with these
| 397649 [lists@ru y- ] Thank you very much, this is very helpful, I like your solution with the
| 397967 [lists@ru y- ] I am back with another question.
+ 397971 [lists@ru y- ] First of all, don't misuse instance variables to pass values to methods.
| 397973 [lists@ru y- ] Thank you very much for reminding me of the basic rules.
| 397979 [lists@ru y- ] def attack(target)
| 397981 [jgabrielygal] target = target - 200
| 397982 [lists@ru y- ] what is the meaning of the equal sign? #hp=
| 397984 [jgabrielygal] It's part of the method name. Ruby has a bit of sintactic sugar to
+ 398560 [lists@ru y- ] Once again, I turn to you for your wisdom:)
| 398561 [rob@ag le on] if card.respond_to?(:attack)
+ 398562 [lists@ru y- ] The "defined?" operator is simply wrong in this case. It checks *the
| 398585 [lists@ru y- ] Thank you. That helped. I actually was wondering why I didn't have to
+ 398593 [lists@ru y- ] That sounds great. :-)
  + 398598 [lists@ru y- ] I haven't uploaded it anywhere, because I am not sure whether I'll use
  + 398881 [lists@ru y- ] I still have a lot of things planned, but it'll take me some time.
threads.html
top