Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
<ndch>
i think that's why it was familiar, it is weird, but i like the guy's explanation at bottom of that link
<slestak_netbook>
ty, i saw a good diswcussion on google groups about it also
<slestak_netbook>
it looks like it boils down to 4 is not greater than the length of the array, so no out of range error
<slestak_netbook>
ty for the pointer
<ndch>
yw :)
cooper joined #ruby
mikeric joined #ruby
Telling joined #ruby
banister_ joined #ruby
Fezzler joined #ruby
ognevsky joined #ruby
tomzx joined #ruby
vitoravelino joined #ruby
stephenjudkins joined #ruby
jgrimes joined #ruby
stephenjudkins joined #ruby
looopy joined #ruby
SpyvsSpy joined #ruby
ognevsky joined #ruby
<andrewhl>
so I'm trying to use open-uri to grab something called an .sgf file from a url. It's basically a fancy .txt file. I'm saving the url to a variable, which outputs as: #<StringIO:0x00000106654be8>. I'm not sure why it's doing this.
<andrewhl>
how can I get it to download properly?
<GreaseMonkey>
i think you'd do url.read
<andrewhl>
ok
<mxweas>
I've got a string of text that I'm calling scan() on. Scan is returning an array of strings. However, it's actually an array of single member arrays that contain each string
<mxweas>
Any idea why this is the case? When looping through the array that scan() returns, I must call item.first to get the actual string. This feels broken to me
<jay12>
on ruby-lang.org @ ruby in twenty minutes intro, the 2nd page where it goes into def h(name), I can't get puts h("Matz") the spit out anything. using ruby 1.9.1
<jay12>
was googling to see what's going on w/ my system, but can't seem to find anything
<jay12>
has anyone seen this happen before?
stephenjudkins joined #ruby
wyhaines joined #ruby
mikepack joined #ruby
jrbran joined #ruby
sorin joined #ruby
Clooth joined #ruby
sorin joined #ruby
dark3rdre4ms joined #ruby
dark3rdre4ms joined #ruby
roaminghorse joined #ruby
slestak_netbook joined #ruby
katselphrime joined #ruby
Squee-D joined #ruby
cooper joined #ruby
<lobak>
I'm having a problem with ruby regex, does anyone know the working way to grep string within ' and '
<lobak>
the problem is, the string within ' and ' might contain other ' but with this representation, \'
pen joined #ruby
<lobak>
for example, string_lala = " 'my name is li\'am' "
mindCrime joined #ruby
notbrent joined #ruby
beseku joined #ruby
<randym>
lobak - what do you want to extract from that string?
mikeycgto joined #ruby
<GreaseMonkey>
lobak: 'my name is li\\\'am'
<GreaseMonkey>
oh uh
katselphrime joined #ruby
rpowell joined #ruby
banisterfiend joined #ruby
mikepack joined #ruby
katselphrime joined #ruby
yeltzooo joined #ruby
queria joined #ruby
dbgster_ joined #ruby
LittleBill902 joined #ruby
jtdowney joined #ruby
katselphrime joined #ruby
jwmann joined #ruby
dark3rdre4ms joined #ruby
dark3rdre4ms joined #ruby
jimmy1980 joined #ruby
stringoO joined #ruby
suung_ joined #ruby
wyhaines joined #ruby
joaoqalves joined #ruby
flip_digits joined #ruby
awesome joined #ruby
cyri_ joined #ruby
banisterfiend joined #ruby
awesome_ joined #ruby
sbanwart joined #ruby
x0F_ joined #ruby
Behi joined #ruby
kenperkins joined #ruby
slestak_netbook joined #ruby
tianshuo joined #ruby
pen joined #ruby
r0bby joined #ruby
acts_as_david joined #ruby
p1d_ joined #ruby
JumpMast3r joined #ruby
sbanwart_ joined #ruby
mikepack joined #ruby
Ruthenium joined #ruby
BrianJ joined #ruby
CannedCorn joined #ruby
i8igmac joined #ruby
ryanf joined #ruby
<i8igmac>
any one familiar with airodump-ng
sbanwart_ joined #ruby
Pip joined #ruby
Pip joined #ruby
Cerales joined #ruby
banisterfiend joined #ruby
radic joined #ruby
havenn joined #ruby
bob_sage_ joined #ruby
<bob_sage_>
trying to create a rails new project
<bob_sage_>
can I ask rails question here?
<bob_sage_>
creating a new rails project..getting this error
<bob_sage_>
.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
<abstrakt>
say I don't know what the keys of the hash are, can I do something with .each( ?
stephenjudkins joined #ruby
<Ruthenium>
hash.keys
<Quadlex>
abstrakt: Yes
<Quadlex>
You can either get all the keys out
<Quadlex>
Or you can have the keys and the values passed to a block
<Quadlex>
your_hash.keys do |k,v|
<abstrakt>
ah, ok great thanks
<Ruthenium>
your_hash.each do |k,v|
stephenjudkins joined #ruby
cook1es joined #ruby
wyhaines_ joined #ruby
wyhaine__ joined #ruby
jwmann joined #ruby
gentz joined #ruby
Skaag joined #ruby
wookiehangover joined #ruby
yxhuvud joined #ruby
wyhaines joined #ruby
<Harzilein>
hmm
macmartine joined #ruby
<Harzilein>
is it guaranteed that array1 & array2 will return the elements in the order given in array1?
Cerales joined #ruby
<macmartine>
Harzilein: each array will retain the order. not sure what you're asking other than that
<shevy>
what is that & doing there
<Harzilein>
shevy: Array#& intersects two arrays
<Quadlex>
err, yes, .ech, not .keys
<Quadlex>
derp
<shevy>
.ech?
smgt joined #ruby
raz joined #ruby
JohnBat26 joined #ruby
tonini joined #ruby
andrewhl joined #ruby
stephenjudkins joined #ruby
ryanf joined #ruby
looopy joined #ruby
abonec joined #ruby
<luckyruby>
is Ruby#Date an accurate way to describe ruby's date class?
<luckyruby>
nm
cylence joined #ruby
pen joined #ruby
asQuirreL joined #ruby
stephenjudkins joined #ruby
cyri_ joined #ruby
tomzx joined #ruby
<Harzilein>
macmartine: i have seen array1 & array2 used to return elements of array2 in the order they appear in array1. the api docs don't really state if i can rely on that.
katselphrime joined #ruby
<macmartine>
Harzilein: array & other_array
<macmartine>
Returns a new array containing elements common to the two arrays, with no duplicates.
<asQuirreL>
Harzilein: that's the intersection function
<Harzilein>
asQuirreL, macmartine: i stated that earlier.
Bhavesh_A_P joined #ruby
<Harzilein>
asQuirreL, macmartine: i have seen code relying on the _order_ of the returned elements being that of array1. the question is if one's code can rely on that.
<asQuirreL>
Harzilein: sorry, what i'm implying is that you can only rely on it if arr1 contains no duplicates
<Harzilein>
asQuirreL: huh?
<banisterfiend>
Harzilein: display the source for it
<asQuirreL>
I'll make a mental note to wake up and try and explain code xD
<asQuirreL>
Harzilein: if you're trying to get a new array of the elements of array2 in the order they appear in array1, you can do this:
h4mz1d joined #ruby
<asQuirreL>
array1.select { |e| array2.include? e }
<asQuirreL>
that won't remove duplicates like the intersection function does
<asQuirreL>
strictly speaking & and | should only be used when dealing with sets
<amh345>
im having problems with Net::FTP. i can connect to the ftp. it also appears that my login comes back as a success. however my ftp.chdir returns a failure as does ftp.list. this worked on my local dev machine (osx) but not on the ubuntu machine. here is a pastie of the code. http://pastie.org/private/lmml2s2ozawultltat4a does anyone have any idea what's going on?
JumpMast3r joined #ruby
tvw joined #ruby
heftig joined #ruby
andrewhl left #ruby
mafolz joined #ruby
andrewhl joined #ruby
FND joined #ruby
<FND>
hi - can I dynamically add a gem to the bundler gems at runtime? (I don't wanna add Hirb to the project's gemfile)
<amh345>
hmm.. ftp.pwd returns / .. what the heck
wookiehangover joined #ruby
<queria>
amh345: in my test ftp.chdir returns nil even when dir was changed successfully (verified by pwd and list)
stephenjudkins joined #ruby
robbyoconnor joined #ruby
stoffus joined #ruby
<amh345>
queria: i just tried ftp.chdir('/folder_on_ftp') and the ftp.pwd and it returns /folder_on_ftp
gregorg joined #ruby
gregorg joined #ruby
<amh345>
however ftp.putbinaryfile('some_file.txt') still hangs
<amh345>
im totally stumped. there must be some sort of difference in the way this is handled from osx to ubuntu
<queria>
amh345: try setting ftp.debug_mode = true if it will tell you more
<queria>
amh345: and probably, try setting ftp.passive (not sure if Net::FTP will switch to passive mode when needed?)
ph^_ joined #ruby
<amh345>
ah.. debug is showing all sorts of details. it's hanging on get: 150 Opening data channel for directory list.
<queria>
amh345: and of course ... you verified you can put files on this ubuntu machine using this ftp/account/pass combination with another ftp client?
<amh345>
queria: yes, ive verfied that. ive been doing manually all this time by downlaoding from this ubuntu machine and than upping it locally to the ftp.
<amh345>
which is why i want to get it autoamted. heh
<amh345>
oh crap. i didnt do passive = true. let me try
randym joined #ruby
<amh345>
queria: that did it!
<amh345>
thank you.
<queria>
amh345: glad it helped ;)
<amh345>
it was driving me crazy!! thank you very much
ognevsky joined #ruby
Morkel joined #ruby
ognevsky joined #ruby
batlock666 joined #ruby
ikaros joined #ruby
blaenk joined #ruby
badabim joined #ruby
mxweas_ joined #ruby
ph^ joined #ruby
amh345 left #ruby
bosphorus joined #ruby
cyri_ joined #ruby
Seisatsu joined #ruby
Adman65 joined #ruby
pi3r joined #ruby
ognevsky_ joined #ruby
zommi joined #ruby
Pip joined #ruby
Pip joined #ruby
ognevsky joined #ruby
nicoulaj joined #ruby
stephenjudkins joined #ruby
Seisatsu joined #ruby
stephenjudkins joined #ruby
ph^ joined #ruby
tobyo left #ruby
mklappstuhl joined #ruby
stephenjudkins joined #ruby
ph^ joined #ruby
ph^_ joined #ruby
jensn joined #ruby
Zsadan joined #ruby
saikobee joined #ruby
vladyn joined #ruby
lucapette joined #ruby
BiHi joined #ruby
ChampS_ joined #ruby
lucapette joined #ruby
flippingbits joined #ruby
<Harzilein>
hmm
Manhose joined #ruby
Ammar01 joined #ruby
Ruthenium joined #ruby
Clooth joined #ruby
Mon_Ouie joined #ruby
tvw joined #ruby
robbyoconnor joined #ruby
timonv joined #ruby
james_cotterill joined #ruby
krz joined #ruby
Spockz joined #ruby
nari joined #ruby
ephemerian joined #ruby
enikar joined #ruby
Shrink joined #ruby
andreas__ joined #ruby
trivol joined #ruby
pangur joined #ruby
<pangur>
My csv file has rows which look like this.
<pangur>
Walker, Elizabeth,Anderston Kelvingrove,Anderston Kelvingrove,PE,Mrs E Walker,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
<pangur>
How do I get rid of the ,,,, at the end of each row?
Kn|t3_ joined #ruby
<pangur>
There are 6 fields per row. How do I get rid of the excess fields per row?
<Tasser>
pangur, use a csv parser?
<pangur>
OK, I shall try csv again
banisterfiend joined #ruby
sj26 joined #ruby
james_cotterill joined #ruby
<FND>
is there a simple way to emulate `grep -R pattern *.ext` in pure Ruby? (pattern interpretation is irrelevant)
<FND>
or rather, what's an efficient way to do that
hurikhan|Work joined #ruby
<Tasser>
FND, Dir#[] does the '*.ext' part, -R is irrelevant I'd say, you can call File#grep (it's enumerable)
Codif joined #ruby
trivol_ joined #ruby
<pangur>
require 'csv' .........CSV.open('/home/calum/Desktop/list3.csv', 'r') do |row|........... puts row...........end gives me #<CSV:0x96b16d4>
jimmy1980 joined #ruby
danielpunt joined #ruby
<pangur>
What am I doing wrongly?
<shevy>
pangur, upload a sample csv file to pastie?
<pangur>
Do I just need a to_s or something?
<pangur>
The data is in the form:
<pangur>
Walker, Elizabeth,Anderston Kelvingrove,Anderston Kelvingrove,PE,Mrs E Walker,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
<ognevsky>
pangur: inside your block (do |row| end), you should use row[0], row[1], etc
Kn|t3_ joined #ruby
<ognevsky>
puts returns you an object, it's ok
<FND>
Tasser: not sure I understand; my current (naive) approach is `Dir.glob("**/*.ext").each { open and match }` (I can't seem to find File#grep at http://www.ruby-doc.org/core/File.html)
Ch4rAzZz joined #ruby
<Tasser>
FND, it's Enumerable#grep
<Tasser>
FND, and yeah, why not.
<FND>
thanks
hinogi joined #ruby
hinogi joined #ruby
<pangur>
ognevsky: puts row[0] gives me ./ord.rb:4:in `block in <main>': undefined method `[]' for #<CSV:0x9915678> (NoMethodError)
tatsuya_o joined #ruby
<ognevsky>
pangur: what ruby do you use?
<pangur>
1.9.3 via rvm
EddieS joined #ruby
<pangur>
If I use plain Ruby rather than csv, I can get each row to output but with the string of commas for the redundant fields.
<bahamas>
ruby apps don't have requirements files?
ph^_ joined #ruby
_debo joined #ruby
ikaros joined #ruby
tk_ joined #ruby
Nss joined #ruby
oponder joined #ruby
wookiehangover joined #ruby
ognevsky joined #ruby
Squarepy joined #ruby
pen joined #ruby
suung_ joined #ruby
fermo joined #ruby
DMKE joined #ruby
Squarepy joined #ruby
mydoghasworms joined #ruby
<shevy>
bahamas ruby apps require files
suung__ joined #ruby
Manhose_ joined #ruby
<joelio>
Is it possible to build a dynamic UI from a REST WADL file?
<bahamas>
shevy: yes, i found the gem file. do you have any idea where i can find rest_client. i found rest-client, but it's not the same thing
<shevy>
I dont know what that is. I would look at the ruby source file and see how it is used, then I'd google
Asher joined #ruby
<joelio>
shevy: I think they're the same things. rest-client being the newer version.. take a look at http://rubyforge.org/projects/rest-client/ and you'll see the last commit was in 2009
d3c joined #ruby
<shevy>
hey I wouldn't know, it's bahamas who needs that
Telling joined #ruby
<shevy>
poor guy too :)
<joelio>
shevy: oops sorry
<d3c>
how may I run an external script via ruby? the external script has #!/bin/bash etc or #!/usr/bin/php so I'd like a method that works for all kind of scripts.
hikkk joined #ruby
<shevy>
if the last commit was in 2009 it may be dead by now
<shevy>
or, like some other projects, moved to github
<bahamas>
joelio: indeed, it seems to be the same. maybe it's another issue with ruby packaging on ubuntu because i get the same error after installing it
<shevy>
d3c, system("/your/shell/script.sh")
<d3c>
shevy: what if it's php? #!/usr/bin/php
<shevy>
not sure, hopefully it calls the php interpreter
<joelio>
It'll call it via a subshell from what I understand and will read the shebang line and call that interpreter
<joelio>
you could have #!/usr/bin/env php in a .sh and it'd still call env php
<bahamas>
i didn't expect so many problems with heroku (if you're not familiar with the ruby ecosystem that is)
<d3c>
joelio: right now, if I have #!usr/bin/php as the shebang in foo.php and do e.g. puts `foo.php`, it won't work.
<joelio>
d3c: doing a puts with backticks won't work at all
<joelio>
you need to use a system call
<joelio>
or popen or something
<d3c>
joelio: it will actually. I just forgot to make the path absolute :) thanks though, works now
<shevy>
bahamas there are always problems :)
<joelio>
d3c: Do you need to get any return codes / exit status from the script?
adambeynon joined #ruby
<bahamas>
shevy: indeed
FND left #ruby
<d3c>
joelio: well yes, was actually just about to ask for that. I'd need to check if it returns 0 as expected. otherwise, I can't use the output from it
<bahamas>
but since this is a paid services, i expected more things to be ironed out
<d3c>
joelio: but I could probably use $? for that?
<bahamas>
so, even though i installed rest-client, i get an error saying that rest_client could not be loaded. what could be the cause of that?
<shevy>
bahamas that sounds like a lot of hassle. It's as if you have to debug this remotely?
<joelio>
d3c: You could use foo = system('command') then perhaps?
Manhose joined #ruby
<bahamas>
shevy: i'm not debugging remotely. this client is installed on my own machine and it talks to the heroku API
<d3c>
joelio: would still have to check the exit code via $? then?
<shevy>
d3c tried result = `foo.php` yet?
<shevy>
What is annoying me in Ruby is that there are 10000 ways to run external programs
<joelio>
d3c: the object will return 'true' or 'false' depending on ondition
<d3c>
joelio, shevy: `foo.php` works. I get the output and otherwise the error message from the script. then I can check the status via the $? variable
<shevy>
good!
<shevy>
only a solved problem is a good problem
<joelio>
d3c: If you fire off a subshell to try and get ?0, that may not work as it's a new shell, you'd need to do it all in one session, using popen... or just get the object return (easier!)
dazoakley joined #ruby
<bahamas>
so, how does ruby look for files when it encounters a 'require' statement?
<shevy>
bahamas, run irb. bash does not know what ruby uses internally
<joelio>
d3c
<joelio>
irb(main):011:0> bar = %x[cat /etc/issue]
<joelio>
=> "Ubuntu 11.10 \\n \\l\n\n"
demian`_ joined #ruby
<shevy>
but you can use something like ... ruby -p 'puts $LOAD_PATH' or something like that, I dont remembner the syntax offhand
<d3c>
joelio: right. so it's the same as using `` ? :)
<joelio>
potentially, I don't use backticks
<joelio>
if that's not giving you everything you need
<joelio>
I'd take a look at popen
<bahamas>
shevy: that's unfortunate. in irb i get something indeed, but all the paths are in /usr while heroku and the others are installed in /var/lib
<shevy>
bahamas that should not be a problem. $LOAD_PATH is an array. Just append /var/lib to it and see if it works then. $LOAD_PATH << '/var/lib'
CorpusCallosum joined #ruby
<shevy>
however, /var/lib seems like a strange path
<bahamas>
shevy: it's the default in ubuntu 11.04. i didn't specify it. i just installed rubygems with apt-get
<shevy>
cool
<shevy>
ubuntu simplifies life doesn't it
petercoulton joined #ruby
<bahamas>
shevy: not in this case
<shevy>
;D
<bahamas>
(unless you were ironic)
<joelio>
rvm all the way
<bahamas>
sarcastic, i mean
<shevy>
yup, I was ironic. Distributions are a curse.
<shevy>
yeah
tatsuya_o joined #ruby
<bahamas>
shevy: it's my first distro. i haven't been using linux for that long
FND joined #ruby
Manhose joined #ruby
<bahamas>
hmm. i did that, but the file still can't be found
<CorpusCallosum>
hi guys, i have a small problem with ruby. i am nevbie on Ruby and install rvm gem and rails and work fine. now i want to create small script which sends a get request and take the response.
<shevy>
what ruby version are you using by the way?
<FND>
is inline `foo rescue bar` supposed to be equivalent to `begin foo rescue bar end`?
dazoakley joined #ruby
randym joined #ruby
<CorpusCallosum>
i am using typhoeus gem and install it via gem install. but my ide cannot see that gem
Cerales joined #ruby
<CorpusCallosum>
i am coding in rubyMine
jensn joined #ruby
<CorpusCallosum>
and when i check the preferences of ide i can see the topheous in my gem list
<CorpusCallosum>
could you help me please ?
<joelio>
CorpusCallosum: do you have - require 'rubygems' in your header?
<CorpusCallosum>
yes joelio
xhubert joined #ruby
<bahamas>
shevy: ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux], if you asked me
<shevy>
yeah bahamas
nsm_ joined #ruby
<nsm_>
HI all
<nsm_>
i having a problem with rake and rdock
<nsm_>
rdoc
<joelio>
CorpusCallosum: Have you tried to run the script outside of the IDE? What's the error?
<shevy>
bahamas no idea how heroku works or why it does not know about $LOAD_PATH, but $LOAD_PATH is very central to ruby, so somehow there must be a way
<nsm_>
ake aborted!
<nsm_>
no such file to load -- rdoc/task
mklappstuhl joined #ruby
<CorpusCallosum>
joelio the error is "`<main>': undefined local variable or method `arg' for main:Object (NameError)"
<joelio>
CorpusCallosum: pastebin your code?
yfeldblum joined #ruby
<shevy>
bahamas no idea how heroku works or why it does not know about $LOAD_PATH, but $LOAD_PATH is very central to ruby, so somehow there must be a way
<nsm_>
I have rdoc 3.11, rake 1.9.2 and gem 1.7.2 installed
<nsm_>
someone has any clue?
<bahamas>
shevy: ok, i'll keep looking. thanks
<joelio>
CorpusCallosum: syntax error
<joelio>
website = ARGV[0]
<joelio>
not website= arg[0]
perryh joined #ruby
<joelio>
CorpusCallosum: The error message tells you ;)
<CorpusCallosum>
joelio yes i know there is syntax error. the main problem is my ide highlight the typoheous and say no file
<nsm_>
joelio, have you any idea how can i solve my problem?
<CorpusCallosum>
but strange thing is after fixing the syntax error, it works from outside of the ide
<joelio>
It's amazing how fixing syntax errors can make your code work ;)
<joelio>
Can you give ARGV[0] via the ide?
<joelio>
if your just running it without other options, ARGV[0] will be nil
wyhaines joined #ruby
<joelio>
nsm_: can you type - which rdoc from a shell?
<nsm_>
/usr/local/bin/rdoc
wyhaines_ joined #ruby
<joelio>
cool, so it's in the $PATH e
<nsm_>
yes, it is
<joelio>
what's the rake task your trying to run?
<nsm_>
i'm trying to do a rake -T
wyhaine__ joined #ruby
wyhaine__ joined #ruby
<nsm_>
hmmm
<joelio>
nsm_: gem list rdoc
wyhaine__ joined #ruby
Adman65 joined #ruby
<nsm_>
rdoc (3.11, 3.5.3, 3.5.2, 2.5.11)
<nsm_>
It has something to do with bundler
wyhain___ joined #ruby
<nsm_>
in irb
<joelio>
have you ran bundle install int he app dir?
<workmad3>
nsm_: is rdoc in your Gemfile?
<nsm_>
no, that was the problem
<nsm_>
thanks a lot
<nsm_>
is rdoc autoloaded or something like that in ruby 1.9?
Azure joined #ruby
Azure joined #ruby
roaminghorse joined #ruby
p0y joined #ruby
S1kx joined #ruby
S1kx joined #ruby
wyhaines joined #ruby
wyhaines_ joined #ruby
wyhaine__ joined #ruby
wyhaine__ joined #ruby
wyhai____ joined #ruby
wyhain___ joined #ruby
wyhain___ joined #ruby
wyha_____ joined #ruby
wyhaines joined #ruby
nari joined #ruby
wyhaines_ joined #ruby
bjhaid joined #ruby
xissburg joined #ruby
<bjhaid>
I get this error: `initialize': unknown OLE server: `SQLDMO.SQLServer' (WIN32OLERuntimeError) whenever I try to connect to an sql server from a remote machine running cgywin, I have downloaded SQLDMO.dll and placed it in the PATH of cgywin yet I still get the error, any suggestions on what I can do?
wyhaines joined #ruby
hikkk left #ruby
<workmad3>
bjhaid: I have suggestions, but I doubt you'd appreciate them ;)
stephenjudkins joined #ruby
<workmad3>
bjhaid: also, looking at the error, that doesn't look like a missing library... it looks like a missing service. Maybe you need to install some form of SQL server client on your machine?
<workmad3>
bjhaid: or maybe it is just that DLL, but it needs to be registered somehow to enable OLE to fine it?
<workmad3>
*find
ChampS_ joined #ruby
<CorpusCallosum>
joelio yes i solved the problem with adding Gemfile file and add the related gem libs into it then bundle install
<CorpusCallosum>
thanks for your help
_catch joined #ruby
<bjhaid>
workmad3: the issue here I dont even know which sql server client to install, with the full server it works fine, but I would not be allowed to install the full server when deploying
<bjhaid>
workmad3: and its an old version of sql server (sql server 2000)
<workmad3>
bjhaid: I've never used sqlserver I'm afraid so can't help with that side of things... I'm just going by what looks to be the problem (hell, I don't even run windows anymore :) )
<workmad3>
bjhaid: I'd go with trying to install the sqlserver 2000 client though :)
<mklappstuhl>
Are there any Berlin people around?
<workmad3>
bjhaid: or maybe try to connect through ODBC rather than an sqlserver client... that may be more successful
cdepue joined #ruby
jimmy1980 joined #ruby
katselphrime joined #ruby
cdepue joined #ruby
BiHi joined #ruby
cdepue_ joined #ruby
ikaros joined #ruby
Squarepy joined #ruby
tatsuya_o joined #ruby
wyhaines joined #ruby
stephenjudkins joined #ruby
<bjhaid>
workmad3: I am sitting here looking so annoyed @ this box running windows, cause the client wants it, installed cgywin, and trying to make it a *nix box @ all cause but SQL server would not, I have tried the ODBC path and failed, dont want to look that way again, so I am trying to get a way around this SQLDMO thing
_debo joined #ruby
dyer joined #ruby
FND left #ruby
iamjarvo joined #ruby
araujo joined #ruby
araujo joined #ruby
jetblack joined #ruby
shevy joined #ruby
oponder_ joined #ruby
oponder joined #ruby
Kanolesic joined #ruby
jimmy1980 joined #ruby
<joelio>
Has anyone here ever used WADL with Ruby? I'm interested in creating a dynamic client side UI generator based from WADL definitions
ph^ joined #ruby
<Tasser>
joelio, ohhh, lots of buzzwords ^^
<joelio>
WADL, think of XML schemas but for REST
HashNuke joined #ruby
<HashNuke>
hey guys!
iocor joined #ruby
<HashNuke>
how does bundler's "bundle exec" work?
<Tasser>
joelio, what's the connection between XML and REST?
Rentot joined #ruby
<Tasser>
HashNuke, it sets env variables
<Rentot>
ok can i chat now?
<Rentot>
uhm
<Rentot>
hi.. i need some help in TASM. anyone could help me?
<HashNuke>
Tasser: I'm looking to make a gem that reads env vars from a yaml file. So thought I should ask how bundler runs commands in that env.
<joelio>
Tasser: Well, you could get XML returned from a GET request, but that's not what I meant.. I meant a way of defining a REST API programattically (so not just API documentation). I'm thinking it would be possible to use that definition file to automatically generate UI's based on that. There's a simplar app in the java world, wadl2java
xhubert left #ruby
<Tasser>
HashNuke, writing into ENV should do
xhubert joined #ruby
<Tasser>
HashNuke, but remember that only forks inherit the env
<HashNuke>
and then running the command using system() or should I be using the backticks?
<Tasser>
ENV['foo'] = 'bar'
<Tasser>
system('echo $foo')
<Tasser>
bar
<HashNuke>
ah so thats Kernel.fork?
<HashNuke>
Tasser: Thanks. I'll try it out.
<Tasser>
HashNuke, don't forget #shelljoin - and probably check the bundler sources too, as there is likely something I forgot ^^
Squarepy joined #ruby
Silker joined #ruby
tatsuya_o joined #ruby
Squarepy joined #ruby
iocor joined #ruby
tommyvyo joined #ruby
robotmay joined #ruby
Nss joined #ruby
<HashNuke>
Tasser: thanks that ENV[] trick worked!
looopy joined #ruby
nanderoo joined #ruby
RomD joined #ruby
<Rentot>
hi anyone can help me with TASM? (Borland Turbo Assembly Language Program)
frogstarr78 joined #ruby
<workmad3>
Rentot: unlikely :P
<Rentot>
@workmad3 >>> :(
<workmad3>
Rentot: also, why ask in a ruby channel for help with turbo assembler?
<Rentot>
well, isn't this a programmers' chatroom?
<adam701>
what is the easiest way to compare ruby objects ignoring the object id and just checking for equality on all the instance variables?
<Tasser>
adam701, define your own <=> or == depending wherever you've got an order
<adam701>
I was hoping to just use a built in method
stoffus joined #ruby
pencilcheck joined #ruby
<Tasser>
by default, #== falls back to #eql? I think
<adam701>
or combination of, if it exists
<Tasser>
ehh #equal?
<Tasser>
stupid naming
<adam701>
let me try
notbrent joined #ruby
<adam701>
doesn't seem to work
Nss joined #ruby
zommi joined #ruby
<Tasser>
what?
<adam701>
ok so if I make my own method, I can print out the instance variables of the obje
<adam701>
ct by doing .instance_variables, but it seems when I call them by doing object[inst] i get undefined method
HashNuke joined #ruby
davorb joined #ruby
mklappstuhl joined #ruby
<adam701>
how do I access the values of the instance variables of an object?
jwmann joined #ruby
HashNuke_ joined #ruby
<davorb>
adam701 look at attr_accessor or write your own accessor method def myvar @myvar end
Manhose joined #ruby
<theRoUS>
question about mysql in ruby: is there a way to fetch the entire result set in one operation, as opposed to interating over it?
iocor joined #ruby
csavola joined #ruby
<adam701>
so currently I am doing def ==(another); self.instance_variables.each do |inst|; self.inst==another.inst end end, what should I have instead of .inst?
<theRoUS>
any ruby MySQL users lurking round here?
Sailias joined #ruby
<workmad3>
theRoUS: why not return ivars.all?{|o| self.instance_variable_get(o) != other.instance_variable_get(o)}
<theRoUS>
workmad3: basically 'cuz #all? hasn't been internalised into my brain-set :-)
jgarvey joined #ruby
<workmad3>
theRoUS: :)
p0y joined #ruby
<theRoUS>
workmad3: thanks!
axl_ joined #ruby
tomzx joined #ruby
pangur joined #ruby
<workmad3>
adam701: also, you may want to be careful with checking instance variables like that... an instance variable won't appear in .instance_variables until it's been set
<workmad3>
and additionally, instance_variables returns the names with the @ already on them (on 1.8.7 and 1.9.3 anyway)
<workmad3>
so you'll end up checking for @@foo not @foo
<joelio>
theRoUS: Are you pulling in all the rows and then iterating in ruby or pulling a row for each mysql select?
<pangur>
I have the script http://pastie.org/2969768 but I cannot work out how to get attributes out of it. I can get it to yield the number_of_people but not the names of people etc. When I try to use the .to_s, it tells me that I cannot convert nil to string.
<pangur>
joelio: Have succeeded with the help of the tutorial you mentioned. Supplementary question: some of my people do not have a degree. Is it in the class or in a query or how do I obtain the degrees of those who do. ATM, it gives me a nil cannot be converted to string - if I use .to_s, for instance.
notjohn joined #ruby
hechien joined #ruby
<joelio>
you could create another method .has_degree? or something that could contain the logic and return a true/false - if that helps?
<pangur>
aha
<pangur>
thanks.
* joelio
is fairly new to ruby also :)
d3c joined #ruby
<pangur>
Does not sound it to me :)
Skaag joined #ruby
<joelio>
pangur: A couple of intense months playing really helps, but that's about it :D
heftig joined #ruby
<pangur>
I tried RoR2 and learned enough ruby to make it work for me - then for last year tried out python - now that I am back to ruby, want to learn the language itself before trying ror3 to any great extent. I do this as a hobby - more curious than productive, I am afraid.
Helius joined #ruby
hechien joined #ruby
seejohnrun joined #ruby
enikar joined #ruby
jbpros joined #ruby
Manhose_ joined #ruby
cylence joined #ruby
<pangur>
joelio: my solution was .... def inspect if @deg @title +' '+ @fore +' '+ @surn +' '+ @deg else @title +' '+ @fore +' '+ @surn end
ckrailo joined #ruby
<pangur>
That worked!
<Tasser>
pangur, format strings wouldn't be bad either
frem joined #ruby
<pangur>
The %s stuff, Tasser?
<joelio>
pangur: Get into sinatra first, it's the bomb :)
<pangur>
I have sinatra but was not sure how how close to plain ruby it was.
<pangur>
Currently, I am just using redcar and commandline.
<pangur>
sinatra kept moaning about frank not knowing my ditties :)
<Tasser>
pangur, yep
<pangur>
Is sinatra not a light framework, whereas rails is a heavy one?
<pangur>
Someoene else recommended sinatra to me to learn about plain ruby.
cdepue joined #ruby
jbrokc_ joined #ruby
<frem>
pangur: sinatra is light.
<pangur>
I find sinatra documentation a little scary because it is so minimalist.
jensn joined #ruby
shevy joined #ruby
<pangur>
I think it seems aimed at people who know what they are doing :)
<joelio>
The beatuty is in it's simplicity
<pangur>
You are beginning to persuade me, joelio :)
<pangur>
Would it enable me to see my stuff in a browser rather than in terminal box?
<joelio>
Oh yea, that's it's point
* pangur
is persuaded.
<joelio>
you can render HTML like in rails too withj ERB/Haml etc.
mengu_ joined #ruby
<shevy>
is anon... anyone using ruby on a BSD system
* pangur
looks again at :4567
<joelio>
there are asset helpers etc..
<shevy>
BSD confuses me where is my ruby
<joelio>
which ruby ?
<joelio>
not in $PATH?
<pangur>
whereis ruby
<shevy>
oh
iocor joined #ruby
<shevy>
yeah
<shevy>
odd paths but it is there ruby 1.8.7 (2011-06-30 patchlevel 352) [amd64-freebsd9]
DrShoggoth joined #ruby
<shevy>
seems to be all put into /usr/local/bin ... /usr/local/bin/ruby
<joelio>
just like rvm iirc
<shevy>
hmm
<shevy>
people use rvm because they want to switch between different versions )
<shevy>
sorry my question mark is not working right now...
<pangur>
I use rvm because I want to my installation to work smoothly - so far so good. I only have the one version of ruby installed on it: 1.9.3
<DrShoggoth>
i use rvm because it's easy to manage
<pangur>
When I add a gem, I use rvm for that too.
<shevy>
hmm
<shevy>
rvm just for one version _
<shevy>
the _ is supposed to be a question mark hehe
<pangur>
lol
chrxn joined #ruby
macmartine joined #ruby
igors joined #ruby
emmanuelux joined #ruby
<igors>
hello. what do you use to parse command line arguments? optparse?
<pangur>
My ubuntu 11.10 did not like my efforts to install 1.9.2 and ror using sudo apt-get, so I resorted to rvm, shevy - and then all was well.
<shevy>
oh
<joelio>
igors: yes, optparse is your friend
Morkel joined #ruby
abstrusenick joined #ruby
<igors>
joelio: do you know if it provides "sub commands" options? like ./foo.rb --help and also ./foo.rb bar --help ?
<shevy>
Harzilein ... du musst nicht traurig sein ... dein Herz geh�rt nur mir alleeeeeein ... du musst doch nicht traaaaaaurig sein ....
wilmoore joined #ruby
Russell^^ joined #ruby
burgestrand joined #ruby
cbuxton joined #ruby
burgestrand joined #ruby
nelsnelson joined #ruby
fivetwentysix joined #ruby
AutoMan joined #ruby
<fivetwentysix>
Should I sort database collections with sql or ruby?
<fivetwentysix>
For example searching could be like collection.map{|obj| obj if obj.name.match(/string/)}.flatten
<ccooke>
fivetwentysix: if you only need it sorted, the DB will be faster
rbanffy joined #ruby
<ccooke>
fivetwentysix: if you need it sorted but also need to preserve the original order, sort it in ruby
mickn joined #ruby
dekroning joined #ruby
<fivetwentysix>
ccooke, so basically if it gets complex or could get complex, write it in ruby?
<ccooke>
fivetwentysix: not quite.
<fivetwentysix>
well how about the expression above
<dekroning>
Hi, I would like to send some hex values to a ruby udp package, but i'm wondering how I need to do this, I can't send it as a string right? my data content should be hex numbers: 0x33,0x52,0x00,0x00,0x00,0x85
<ccooke>
fivetwentysix: for things like this, the DB is aloways the best place to do work: If you add the sort to your query, the DB will be able to optimise the query based on knowing that it's going to sort the data.
<fivetwentysix>
in rails i would do something like Model.where(name: "%joe%")
<AutoMan>
Hi, I need vary the number of return values that I dynamically bind in this statement: cursor.exec(' '*50,' '*50,' '*50) where here I am saying for 3 return values that they can be up to 50 chars in length. I tried puting them in a string, since it was easiest to try to no avail... got any ideas?
tommylommykins joined #ruby
<ccooke>
fivetwentysix: and it will be faster, becaue that's its *job*.
<ccooke>
fivetwentysix: if you need both sorted *and* unsorted data, then either sort in ruby or get the DB to include some field indicating the original order (and resort by that)
<dekroning>
or can I just send: [0x33,0x52,0x00,0x00,0x00,0x85].to_s ?
<fivetwentysix>
I see.
<ccooke>
fivetwentysix: generally: get the DB to produce the data in the form you're going to use most, if at all possible -)
<fivetwentysix>
ccooke, so if you're a solo wantrepreneur, and you found yourself more productive querying your collections with ruby, what would you do?
<fivetwentysix>
learn sql?
tomb joined #ruby
<ccooke>
fivetwentysix: not a bad idea.
<fivetwentysix>
i learned sql before, and i forgot it :-(
<ccooke>
fivetwentysix: but it depends on the problem. You can get by in ruby (and ruby is easier)
<fivetwentysix>
but i feel like concentrating learn time with vim this week
bjhaid joined #ruby
<ccooke>
fivetwentysix: but sql is the *right* place to do it, if that fits your app structure
<fivetwentysix>
ccooke, well i tested it
Codif joined #ruby
<fivetwentysix>
i did 10000.times { Factory(:model) }
<AutoMan>
A simpler question: How can I vary the parameter in this statement? cursor.exec(' '*50,' '*50,' '*50)
<fivetwentysix>
and my ruby search was like < 1 second return times
<ccooke>
fivetwentysix: did you check with different data sizes? what is the maximum data size you'll deal with?
<fivetwentysix>
ccooke, i dont know, if i had 10000 users i'd shit myself
<fivetwentysix>
in that case i can hire the worlds best sql guy
<ccooke>
fivetwentysix: (remember, algorythms have different start-up costs and complexity orders)
<ccooke>
fivetwentysix: good plan :-)
Manhose joined #ruby
ghanima joined #ruby
<fivetwentysix>
and since i do 100% bdd
<fivetwentysix>
with features, controller, view, model, helpers specs
<fivetwentysix>
these search methods are isolated e
<fivetwentysix>
and should be easy enough to convert to some hardcore sql stuff
clockwize joined #ruby
akem joined #ruby
Manhose__ joined #ruby
<fivetwentysix>
So can that justify me not mastering SQL?
<ccooke>
fivetwentysix: anything can justify it. you're the one making choices here :-)
<ccooke>
fivetwentysix: you asked a question, but issues like this don't really have "right" answers (only wrong ones. Like "Write a custom tcl middleware on it. There's a tcl interpreter on Cisco ASAs!")
looopy joined #ruby
sepp2k joined #ruby
<joelio>
fivetwentysix: Just use an ORM and let that deal with it :)
<fivetwentysix>
yeah, i'll write it in ruby, because i know ruby, and it's cheaper at the moment. database knowledge seems like roulette at the moment with all these vendors competing not to mention no ql and stuff
<fivetwentysix>
*nosql
Zal joined #ruby
<ccooke>
fivetwentysix: the *best* place for this sort of data munging - in a perfet, abstract sense - is to do it in the database, because that is the system most optimised for the problem space.
<burgestrand>
dekroning: no, but you can use Array#pack
<ccooke>
fivetwentysix: that doesn't need to apply in eveery situation :-)
* ccooke
is highly amused at nosql
tomb joined #ruby
<fivetwentysix>
ccooke, like or dislike?
<fivetwentysix>
i've played with mongoid
<dekroning>
burgestrand: right, else it will get the wrong encoding right ?
<ccooke>
(as a concept it's been around for decades, it's getting massively overused in the same way XML was, for wildly innapropriate things... but in five to ten years, it's going to be at the visibility level it "deserves" to be and we'll have some lovely tools)
<fivetwentysix>
I would prefer however to run my site on postgres :-)
<ccooke>
fivetwentysix: oh, neither.
robbyoconnor joined #ruby
<burgestrand>
dekroning: no, Array#to_s is not meant for that use-case, it returns different things in 1.8 vs 1.9 and in 1.9; what’s common is that it returns a string representation of the array, and it is not what you really need
<fivetwentysix>
Well if i'm using postgres I guess I have no excuse not to be querying through the database.
<dekroning>
burgestrand: ok, atm i'm using 1.8.7
<ccooke>
fivetwentysix: it's a great fit for some of the newer language trends. It's *not* a great replacement for an sql database as a database, but it does free everyone from innappropriate use of SQL...
<burgestrand>
dekroning: Array#pack, however, is meant exactly for this thing :)
eignerchris joined #ruby
<joelio>
fivetwentysix: seriously, just use Datamapper, Sequel or ActiveRecord.. abstract away the SQL pain :)
<dekroning>
burgestrand: the hardware spec i'm reading is that I need to send a UDP packet with some hex numbers to a specific ip and port, so looks like that Array#pack is indeed something I need, thanks
<ccooke>
(it's incredibly amusing that several nosql vendors are building a nosql query language that looks a *lot* like SQL, though.)
<fivetwentysix>
joelio, yeah but i don't know how to write things to perform full text search
<fivetwentysix>
joelio, would I replace activerecord with datamapper?
<joelio>
ccooke: Elastic Search is pretty sweet.. I think the advantage you get for use cases that allow for it is sharding and replication. MySQL replication can be a bit sucky. Postgres is a lot better of course
<joelio>
fivetwentysix: Erm, depends on what you're trying to do, was merely presenting options.. :)
quest88 joined #ruby
<ccooke>
joelio: ... heh. I'd say the exact opposite wrt postfix and mysql :-)
<joelio>
postfix? :)
<joelio>
postgres has got some great Write Ahead stuff
<joelio>
WAL and hotcopy etc..
<ccooke>
joelio: but I think we can agree that there are many things that currently use heavyweight DBs that would be better supported by key value stores)
<joelio>
aye, redis is pretty damn good too
<ccooke>
joelio: the postfix replication code is... not something I really trust
<ccooke>
argh, postgres
<joelio>
aye, haha
<ccooke>
can you tell I used to do mail admin?
<ccooke>
my fingers know what they want to type :-)
<ccooke>
mysql replication is very mature and pretty much rock solid
ank joined #ruby
<joelio>
Ahh, just been burnt a couple of times, suppose it's one of those things! :)
<joelio>
I'd trust my data with postgres anyday of the week
<ccooke>
joelio: the problem is that postgres' replication is fundamentally more fragile, but has had a lot of work put into it to make it "better"
lee__ joined #ruby
bjhaid joined #ruby
bafilius joined #ruby
craigglennie joined #ruby
<ccooke>
joelio: ... checking the postgres wiki for replication still gives me the horrors, frankly. I'd never trust production data to it.
<ccooke>
(which is a shame, because postgres is basically a better DB)
ephemerian left #ruby
jbpros joined #ruby
thone joined #ruby
<Harzilein>
okay, kind of the same problem again, now i want to extract the path part out of an uri array
<theRoUS>
csavola: suppose the element being added to the array-or-set is a complex multi-level hash. set probably works by #hash or #object_id; dunno if array works by those or by inspection.
<theRoUS>
whatever. thanks, burgestrand
<apeiros_>
ccooke: almost. Procs can be converted to blocks.
<apeiros_>
(as can Method instances, btw.)
ianbrandt joined #ruby
<theRoUS>
apeiros_: whoa. is that a 1.9ism?
<ccooke>
Harzilein: and if you call &any_object then Ruby will look for a to_proc method on any_object and call it (unless, of course, it's a Proc already)
<workmad3>
apeiros_: really? show me a block object please :P
<csavola>
theRoUS: #include? will use the same logic to check for equality... but it has to iterate the entire list to figure it out... use a Set for a set... Array for a non-unique list
<apeiros_>
theRoUS: no, that existed in 1.8 already. maybe even earlier.
<apeiros_>
workmad3: didn't say anything about a block-*object*
steph021 joined #ruby
steph021 joined #ruby
<ccooke>
apeiros_: ... since that's transparent, how does it differ from what I said? (read: curiosity)
<workmad3>
(incidentally, I prefer the simple mental model that says 'blocks' are really just procs)
<apeiros_>
workmad3: foo(&proc{}) # <-- there, converts the Proc into a block
stringoO joined #ruby
jr00n joined #ruby
<workmad3>
apeiros_: it passes the proc in using the block parameter...
<workmad3>
apeiros_: I'd contend it doesn't do any conversion though
stephenjudkins joined #ruby
<apeiros_>
workmad3: it's fine as a thought model. but it's imprecise.
<workmad3>
apeiros_: it works perfectly, unless you want to quibble about implementation optimisations
<apeiros_>
technically you're indeed converting between proc & block. but that only matters in optimization.
<apeiros_>
so we agree, I guess…
<workmad3>
apeiros_: yeah :)
<ccooke>
Harzilein: The nice thing is you can define to_proc on any object you like.
<workmad3>
apeiros_: and really? do implementations strip off the proc stuff there? seems like an anti-optimisation at that point tbh
<apeiros_>
I do like to distinguish between proc & blocks, simply because it makes it clear how the method accepts something
jamiejackson joined #ruby
<ccooke>
Harzilein: I like to define it on Regexp, for instance: select(&/regex/) is nice.
mickn joined #ruby
mickn joined #ruby
<workmad3>
apeiros_: if you make the block param explicit and ask it for a class, you get a proc ;)
<apeiros_>
workmad3: yes, MRI/KRI have a couple of performance implications as to how you pass stuff.
apok joined #ruby
jbrokc_ joined #ruby
<ccooke>
given that there are multiple ruby implementations all implementing the same language, I'd rather not assume that any one implementation is "correct"...
eywu joined #ruby
<apeiros_>
workmad3: e.g. if you do, A: `foo; yield; end` vs. B: `foo(&b); b.call; end`, then A is more efficient. a block is not an object, it's more lightweight and there's other implications.
<workmad3>
apeiros_: oh, yeah, implementation wise an actual proc object won't be created until you're treating it as an object
<apeiros_>
workmad3: but if you do A: `foo; @x.each do |x| yield x end; end` vs. B: `foo(&b); @x.each(&b); end`, then B is more efficient
<apeiros_>
also in B, less GC happens as far as I heard.
Locke23rus joined #ruby
<ccooke>
this is stuff that no ruby-level developer *should* need to care about, though
eywu joined #ruby
<workmad3>
apeiros_: but that's the same sort of optimisation as with eigenclasses... but you tend to say 'all objects have an eigenclass' rather than 'objects only get an eigenclass when you first access it'...
<ccooke>
(I mean, I'm not saying they don't *need* to know about it. Just that they shouldn't *have* to)
<shevy>
the name Eigenclass is so crappy
<apeiros_>
workmad3: yeah
<apeiros_>
shevy: no
<shevy>
why not Eigenklasse?
<workmad3>
apeiros_: the fact that the moment you look at it you see a proc means (to me) that procs are the idea, even if there are some optimisations that can be applied when you don't look :)
bbttxu joined #ruby
<apeiros_>
workmad3: personally I'd favor a better Proc literal
<workmad3>
hmm... thinking about it... I wonder if we can make some comparisons to quantum mechanics there :)
<apeiros_>
and not have block arguments be special
alfism joined #ruby
Natch| joined #ruby
<apeiros_>
let { |…| … } be a proc literal. why need `proc` part at all?
<workmad3>
apeiros_: ooh, I like that terminology :)
<workmad3>
apeiros_: and you need the proc part because otherwise 0-argument procs get a bit confused with hashes :)
<apeiros_>
they attempted it feebly with the stabby ->(){} syntax. but that's ugly IMO
altivec joined #ruby
<apeiros_>
workmad3: use a different literal for hashes then, I don't care.
<apeiros_>
procs > hashes :) (importance wise)
<ccooke>
apeiros_: using the same literal for hashes across languages > procs ;-)
rbanffy joined #ruby
aLinux joined #ruby
<workmad3>
ccooke: they use the same literal for procs (blocks) across languages too though :P
<ccooke>
hell, just use «». we all talk utf8 now, right? ;-)
<aLinux>
hi, is there any offtopic channel for rails or ruby users ?
<workmad3>
cook1es: for example js: function() {}, java public void method() {}
<workmad3>
ccooke: ^^ that was for you (sorry cook1es)
<ccooke>
workmad3: *grin*
timonv joined #ruby
<ccooke>
workmad3: yes, but they are visually distinct
<workmad3>
ccooke: the utf8 stuff can get 'interesting' too :) utf8 chars are valid variable names
<workmad3>
ccooke: which is awesome... until you encounter the utf8 'non-breaking space' char...
<ccooke>
workmad3: I know. I like this a lot. Not so much for me, but for the way you can implement non-English method names sensibly
<workmad3>
ccooke: yeah, but when a valid variable name is a non-breaking space...
<workmad3>
just screams 'abuse me!!!!'
<ccooke>
workmad3: well, yes. it does. And this is fun :-)
* ccooke
wants to see an iorcc :-)
<workmad3>
ccooke: ooh, just thought... it's probably a valid method name too :D
<apeiros_>
ccooke: how many languages do you know that use {} for hashes?
<ccooke>
workmad3: it is.
<apeiros_>
or rather, tell me which languages…
<workmad3>
apeiros_: javascript?
<apeiros_>
workmad3: meep, wrong. not a hash.
<workmad3>
apeiros_: close enough :P
jbrokc_ joined #ruby
<workmad3>
apeiros_: you can access it with [''] syntax (in addition to . notation)
<ccooke>
apeiros_: JSON/YAML, perl, python, ruby for starters.
<apeiros_>
fine, it's still not a hash workmad3
<ccooke>
or, you know. The dynamic languages and their interchange formats.
<workmad3>
apeiros_: ok, technically it's not a hash :)
<apeiros_>
ccooke: perl has other literals for hashes too
<apeiros_>
ccooke: so should ruby implement those as well?
<workmad3>
apeiros_: however, you can use it perfectly fine as a hash
<workmad3>
(or rather, an associative array)
<ccooke>
apeiros_: rarely and obscurely used.
<apeiros_>
ccooke: also, we're at what, 3 languages now? you're aware that there's a couple of *hundred* languages out there?
<ccooke>
apeiros_: it makes sense to use similar syntax in ruby as other languages, where the cost is low.
<workmad3>
apeiros_: java uses {} for initializer lists, including arrays and maps
JumpMast3r joined #ruby
<ccooke>
apeiros_: no, more like thousands.
<apeiros_>
ccooke: which only makes your point more diminishing
<ccooke>
apeiros_: that's right, because we should base ruby syntax on Befunge.
<workmad3>
I think the better point to make is that there's a limited number of sensible bracket characters
<ccooke>
or malbolge.
<apeiros_>
imitating another language's syntax in and of itself is worthless IMO.
<ccooke>
apeiros_: you are entiteled to your wrong opinion :-)
<apeiros_>
ccooke: way to fail…
<apeiros_>
but yeah, good to know I can stop arguing.
io_syl joined #ruby
io_syl joined #ruby
<workmad3>
and once you've eliminated < > brackets because they're mathematical functions, () for method calls, [] as an array literal... you're pretty much left with {} on a standard kb
<ccooke>
seriously, though... it is a benefit to use familiar syntatical constructs across languages where the cost is low.
Mramaizng joined #ruby
grekko joined #ruby
<apeiros_>
with only a couple of available characters, the cost is high.
PhilK joined #ruby
<shevy>
not many UTF-8 languages out there
wmoxam joined #ruby
<apeiros_>
every literal you use the minimal amount of characters to delimit, is a sacrifice and you'd better be sure it's worth it.
<ccooke>
and just because there are thousands of languages out there... the languages ruby is most compared to will be those it is conceptually closest to
aLinux left #ruby
<apeiros_>
wait, why am I arguing? my opinion is wrong anyway so wtf…
<ccooke>
which would be perl, python, php.
<apeiros_>
ccooke: go, implement a language and come back when you did.
tatsuya_o joined #ruby
<workmad3>
apeiros_: yeah... and I'd say the fact that hashes are given a simple literal character is a good feature of ruby considering just how much they are used :)
<ccooke>
apeiros_: okay. the smiley is supposed to be a clue that it's not a serious comment. Your opinion is perfectly valid, and my considering it a wrong one does not have any effect on that. Hell, you don't have a clue who I am and I don't have a clue who you are. This is not something we need to get angry about :-)
<workmad3>
ccooke: 'rule #1 - given two people, you will have 2 opinions. rule #2
<workmad3>
they're both wrong'
<shevy>
damn noobs
<workmad3>
shevy: yeah, sorry... - is too close to return on my kb :P
<ccooke>
apeiros_: for what it's worth, I've implemented a language or two. I'm not massively experienced in that regard, though. I don't believe that this has any real bearing on the current conversation though.
<ccooke>
workmad3: Agreed :-)
<workmad3>
ccooke: I generalised it from the old joke about philosophers :)
<shevy>
hmm freebsd confuses me even more than linux :( guess I go back to debian ...
<shevy>
bbl, reinstalling
<ccooke>
workmad3: indeed
<pangur>
I cannot really get into sinatra. Is it really supposed to be simple or am I thick?
jbrokc joined #ruby
<workmad3>
ccooke: I'm also reminded of 'what do you call a group of philosophers?'
<ccooke>
workmad3: an argument
<workmad3>
ccooke: exactly :)
<ccooke>
workmad3: or a schism.
<pangur>
It certainly is not as simple as rails.
<workmad3>
right, I'm off home :)
<ccooke>
also, this is a text-only medium. It is dehumanising and very easy to read more.. anger and insult.. into things than are intended, on all sides. Worth remembering :-)
<workmad3>
pangur: it's simple... but I'd say it's not as easy (because you have to do more of the work)
josh___ joined #ruby
sorin left #ruby
<ccooke>
pangur: it's a lower-level framework
<workmad3>
pangur: I like to keep the concepts of simple and easy distinct and separate :)
<pangur>
good policy :)
<workmad3>
(so that I'll say ruby is an easy language, while PHP is a simple one)
<pangur>
I find the raw terminal easier.
<workmad3>
knowledge also plays a lot into easiness :)
<pangur>
I think that it is designed for those who know what they are doing, for sure.
<workmad3>
anyway... I'm off :)
<ccooke>
workmad3: you said that
<pangur>
Good night :)
macmartine joined #ruby
Avi` joined #ruby
adamkittelson joined #ruby
Pip joined #ruby
Pip joined #ruby
Pip joined #ruby
robyurkowski joined #ruby
Morkel joined #ruby
apok joined #ruby
mobile_ joined #ruby
rippa joined #ruby
roadze joined #ruby
tvw joined #ruby
luminare joined #ruby
<Zal>
what is the =begin and =end syntax I see on rubylearning.com?
katselphrime joined #ruby
<apeiros_>
Zal: rarely used multiline-comment syntax
<xissburg>
weird
<seejohnrun>
comments
<Zal>
apeiros_, gotcha, thanks.
<apeiros_>
Zal: google "zenspiders quickref". it shows about all of rubys syntax.
<Zal>
ah, excellent
<Zal>
that's perfect, thanks apeiros_
jbrokc_ joined #ruby
shadoi joined #ruby
dyer joined #ruby
Tuxi joined #ruby
<Zal>
Is there a more common multiline comment syntax?
raythecat joined #ruby
<apeiros_>
no
<Zal>
ok, thanks
DemonWitch joined #ruby
<apeiros_>
yw
mrsolo joined #ruby
glebihan_ joined #ruby
glebihan_ left #ruby
raythecat joined #ruby
Skaag joined #ruby
samuel02 joined #ruby
luis_ joined #ruby
Tuxist joined #ruby
Pip joined #ruby
Pip joined #ruby
Matias_ joined #ruby
cyri_ joined #ruby
<luis_>
first time here, trying to learn ruby... any suggestions appreciated and welcome!
<apeiros_>
pine.fm's learn to program, also ruby koans seem to be wildly popular
ph^ joined #ruby
Nss joined #ruby
jbrokc_ joined #ruby
<apeiros_>
some people also like _why's poignant guide to ruby
<Squarepy>
luis_: get the wpgtr.pdf
Araxia_ joined #ruby
<apeiros_>
(it's weird, but fun)
daniel_hinojosa joined #ruby
<Squarepy>
and it's not that constructive, but who cares?
Matias_ left #ruby
luis__ joined #ruby
<luis__>
Thanks!
btanaka joined #ruby
liliff joined #ruby
closedbook joined #ruby
CannedCorn joined #ruby
<closedbook>
hi, newbie question. in a for loop using a range, why does variable representing an incrementor overwritten by the value in the range?
Helius joined #ruby
<closedbook>
for example, for i in (0..5); puts i; i += 2; #this is overwritten by the next value in (0..5) end
vipaca joined #ruby
vipaca joined #ruby
<apeiros_>
because that's how for … in works
<seejohnrun>
closedbook - don't think of it like a for loop, think of it like an iterator
<apeiros_>
it doesn't matter whether you use a range. for … in will always set the variable on the next iteration.
<seejohnrun>
you can simulate a typical for loop with `i = 0; while i < 20; end` - but that's not typical in ruby code
<seejohnrun>
i += 1 **
<closedbook>
I'm guessing that's an idiosyncrasy of ruby?
<closedbook>
since for loops in java, etc allow you to increment by any number?
<csavola>
closedbook: it isn't a for loop it just looks like one
<seejohnrun>
closedbook: they only allow you to increment because you're managing (i)
<rippa>
for loop isn't used much in ruby
<closedbook>
ah ok, I just have to think differently about iterating in general in ruby
<csavola>
closedbook: it's closer to the iterator for syntax Java 5 brougt in for (Object i : list)
<seejohnrun>
like csavola says its just the word "for" that's getting in the way, like PHP's for ($people as $person)
jbw joined #ruby
sepp2k joined #ruby
<rippa>
(0..5) do |i| #is clearer for me
<rippa>
*#each
kirun joined #ruby
<closedbook>
ok, got it. Thanks everyone for your help!
fridim_ joined #ruby
bdiallo joined #ruby
Skaag joined #ruby
aibo joined #ruby
mrsolo joined #ruby
skinnymuch joined #ruby
stkowski joined #ruby
jgrimes_ joined #ruby
kenichi joined #ruby
looopy joined #ruby
pantsman joined #ruby
pantsman joined #ruby
andrewhl joined #ruby
pootpoot left #ruby
Skaag_ joined #ruby
aika joined #ruby
pantsman joined #ruby
pantsman joined #ruby
<aika>
hey
workmad3 joined #ruby
strife25 joined #ruby
roadze joined #ruby
flip_digits joined #ruby
<aika>
hry
aika left #ruby
Codif joined #ruby
dekroning joined #ruby
hashpuppy joined #ruby
<hashpuppy>
how can i define a custom error exception that takes in a msg and an error number?
<apeiros_>
hashpuppy: exception classes are normal classes.
dv310p3r joined #ruby
<apeiros_>
the only requirement is that they have to inherit from Exception or any of its descendants (preferably StandardError or a descendant thereof)
<hashpuppy>
thanks
roadze joined #ruby
<hashpuppy>
apeiros_: how would i raise that? class MyError < StandardErrror; attr_accessor :error_number, :error_msg; end;
<hashpuppy>
so that i include the error number
<hashpuppy>
i'm new to ruby, obviously
<apeiros_>
raise MyError.new(args, to, initialize)
bwright joined #ruby
andreas__ joined #ruby
rramsden joined #ruby
<hashpuppy>
failing to see why i'm getting a 2 for 0..1 arguments error
<hashpuppy>
class Error < StandardError; attr_accessor :error_number; def initialize(msg, error_number); super; @error_number = error_number; end; end
<hashpuppy>
raise Error.new("hello", 23)
skrewler joined #ruby
voodoofish430 joined #ruby
kevinbond joined #ruby
<hashpuppy>
guess it was my super call
<hashpuppy>
:P
<apeiros_>
`super` will invoke the parent class' method with all arguments as passed to the current method
<apeiros_>
e.g. in your case, as if you'd have written: super(msg, error_number)
<apeiros_>
use `super()`
<apeiros_>
(note: this is the *only* case where it makes a *functional* difference whether you have parens or not)
oneiros_Fade joined #ruby
<ccooke>
apeiros_: I'd almost want the two uses to be different, personally :-/
<oneiros_Fade>
Hey hey. I'm not having any luck finding a site that details using Glade3 .glade files with Ruby (through ruby-gnome2). Can someone point me in the right direction?
<apeiros_>
ccooke: I don't want `super` tbh
<ccooke>
apeiros_: oh? why not?
ChampS_ joined #ruby
<apeiros_>
it's confusing and surprising that super and super() work differently
creativeprodigy joined #ruby
<apeiros_>
it's even more confusing when you learn, that super() still passes on blocks
<apeiros_>
you need super(&nil) if you want to suppress blocks being passed.
<apeiros_>
super is super confusing…
* nelsnelson
nods at apeiros_
<apeiros_>
oh, as for the why: I'm a big fan of "say what you mean". super vs. super() vs. super(&nil) IMO violates that.
* nelsnelson
super agrees
<ccooke>
apeiros_: this is why I'd rather see it with different syntax
thepix joined #ruby
<apeiros_>
ccooke: ah, yes, with distinguishable syntax, I've no problem
<apeiros_>
I meant `super` as it is.
<ccooke>
I mean, I'd *like* the method to have easy access to its own method search path
<ccooke>
and make that do the job of super
<ccooke>
make super an object with methods, basically
<apeiros_>
ok, not sure - you mean you'd like to have introspective tools for the method search path?
<apeiros_>
:)
<apeiros_>
sounds like it…
<apeiros_>
yes, would be nice
<ccooke>
super.next being "what 'super' does now"
<ccooke>
hmm. Could implement that in rubinius (as Super, perhaps :-)
mrsolo joined #ruby
* ccooke
adds another horrible hack to his stack
<ccooke>
(oh, no. it would have to be named 'hyper'. that *does* come after super, right?
<ccooke>
)
QKO__ joined #ruby
<apeiros_>
I think it's the same term but greek instead of latin
<apeiros_>
but school's hundreds of years in my past…
<ccooke>
I was thinking in terms of historical keyboard shifts
<ccooke>
shift, meta, super, hyper...
<ccooke>
(on most linux distros, the windows key is mapped to Super, but hyper isn't defined. IIRC)
<apeiros_>
oh
shevy joined #ruby
<apeiros_>
no super here. but option shifts control to command…
ChampS_ joined #ruby
h4mz1d joined #ruby
spike2251 joined #ruby
Manhose_ joined #ruby
quest88 joined #ruby
LittleBill902 joined #ruby
cyri_ joined #ruby
stephenjudkins joined #ruby
Revernd joined #ruby
wilmoore joined #ruby
AutoMan joined #ruby
berserkr joined #ruby
svetzal joined #ruby
RevDrSpectre7 joined #ruby
cjs226 joined #ruby
jbpros joined #ruby
jaseemabid joined #ruby
Targen joined #ruby
jamiejackson joined #ruby
nelsnelson joined #ruby
<jaseemabid>
Need some clarification on the for in loop of ruby. Will it iterate through object values or object keys ? I come from JS background
<csavola>
jaseemabid: it depends on what you call it on
strife25 joined #ruby
<ccooke>
jaseemabid: it's generally best to use an iterator in ruby. For instance: array.each do |item| # do something to the item; end
<aleszoulek>
Hello there. Sorry for asking maybe a bit stupid question, but is the an easy way for me (ops guy) to see from what path the ruby gem was loaded? I have system wide gems and then some in GEM_HOME - plus multiple versions.. :-/
banisterfiend joined #ruby
<aleszoulek>
So I'd like to run a ruby interpreter and say something like: require compass; compass.where_is_your_sources()
<aleszoulek>
:)
<ged>
aleszoulek: $" is an Array of the paths of all required files.
apok_ joined #ruby
vitoravelino joined #ruby
<shevy>
look at "gem env" aleszoulek ... I think this is the first one returned and found
<ged>
Or you could implement it via a method that returned __FILE__ from your toplevel module (or whatever).
<aleszoulek>
The thing is that I have compass-0.11.1 and compass-0.11.5 both in the same dir and not sure if the newer is used :)
<apeiros_>
aleszoulek: you can also do YourMod.method(:some_method).source_location
fetimo joined #ruby
<apeiros_>
most likely there's Compass::VERSION
flippingbits joined #ruby
stephans joined #ruby
<aleszoulek>
Thanks..
<Zal>
Reading about scope. Do I understand correctly that there is no nested scoping?
<shevy>
Zal what do you mean with nested scoping
<shevy>
Foobar::Bla::Ble.method
<Zal>
shevy, when creating a class within a class, does the interior class inherit the scope of the exterior class?
elliot98 joined #ruby
<shevy>
class Foo; class Bar <-- you can access Bar only via Foo::Bar (or ::Bar not sure about the latter) Foo is the parent namespace
elliot98 joined #ruby
<shevy>
I don't know what you mean with scope of exterior class though. it's like a module
<aleszoulek>
apeiros_: Yes, it has. Thanks again :)
DrShoggoth joined #ruby
<Zal>
ok, thanks, I'll keep reading, and maybe I'll be able to formulate a better question later.
aleszoulek left #ruby
Codif joined #ruby
QKO joined #ruby
Cervajz_ joined #ruby
GoldenPie joined #ruby
closedbook left #ruby
albemuth joined #ruby
DMKE joined #ruby
nanderoo left #ruby
Skaag joined #ruby
zul__ joined #ruby
JuanMiguel2 joined #ruby
mkscrg joined #ruby
<sie>
Does ruby classes have desctructors?
<sie>
Or deinitializators of some kind?
pantsman joined #ruby
pantsman joined #ruby
jimmy1980 joined #ruby
* enikar
thinks, there is no destructors in ruby
gtrduop joined #ruby
<gtrduop>
I`ve forgotten a3li for ban-nazi. sorry!
<udk>
and kinda the wrong way to think of ruby code :P
<shadoi>
yeah, it's very java-ish
Morkel joined #ruby
cableray joined #ruby
ephemerian joined #ruby
Manhose_ joined #ruby
bafilius joined #ruby
flip_digits joined #ruby
ChrisChao joined #ruby
cafesofie joined #ruby
nelsnelson joined #ruby
poga joined #ruby
autojack joined #ruby
<autojack>
we have our own gem server at work. when trying to pull down a gem from it, gem gives a 404 trying to fetch 'prerelease_specs.4.8.gz' that file is indeed not present on the gem server. re-running 'gem generate_index' doesn't seem to create it. what am I missing?
DemonWitch joined #ruby
<rpowell>
I thought Instapaper had something like that
<rpowell>
hmm, seems not
<rpowell>
you know, a good icon can really help
DemonWitch joined #ruby
<autojack>
hmm. possibly a rubygems version mismatch issue?
workmad3 joined #ruby
booginga left #ruby
elijahc joined #ruby
<elijahc>
hey everybody
cableray joined #ruby
Axsuul joined #ruby
yekta left #ruby
havenn joined #ruby
stephenjudkins joined #ruby
<sie>
I want to play raw audio data with ruby in windows, any idea how?
<tightwork>
I am having a install problem I believe. I gem install spice, I have the files in /usr/lib/ruby/gems/1.8/gems/spice-0.7.3 but when I try to run the code as described Spice. Spice.server_url I get:uninitialized constant Spice (NameError) do I have problem with my setup or the gem?
<sie>
shevy - Does that just generate the wave or actually play it as well?
<shevy>
sie I think it generates a .wav file which you can then play
<sie>
That's not what I wanted, I know how to generate a wav(e), I need a way to play a stream.
xpot-mobile joined #ruby
moonunitzappa left #ruby
svetzal_ joined #ruby
fetimo_ joined #ruby
Spockz_ joined #ruby
craigglennie_ joined #ruby
pen_ joined #ruby
dyer__ joined #ruby
mooonunitt joined #ruby
LittleBill902 joined #ruby
skrewler joined #ruby
KitsuneDrag0n joined #ruby
bigkm joined #ruby
perryh_ joined #ruby
flippingbits joined #ruby
KinkyKamikaze joined #ruby
mxweas_ joined #ruby
<Harzilein>
can you name a good replacement for abusing chomp to strip stuff off the end of a string?
eignerchris joined #ruby
<sie>
How can I use method of an object within the class declaration(need to be called exactly once to alter class variable)?
bonhoffer joined #ruby
<mksm>
Harzilein, strip or slice
Helius joined #ruby
<Harzilein>
mmksm: they don't seem to make this particular task very convenient
ndch joined #ruby
<mksm>
Harzilein code would be convenient then
eywu joined #ruby
<Harzilein>
i'm currently converting some shell scripts i have to ruby
<mksm>
sie: wut?
<Harzilein>
so i'm replacing ${string%some_fixed_suffix} with string.chomp("some_fixed_suffix")
<Harzilein>
but shell scripts also allow for glob patterns so i guess i'd like something with regex
<mksm>
Harzilein, there's #sub
DemonWitch joined #ruby
<Harzilein>
hmm
nari joined #ruby
<Harzilein>
yeah, sub fits what i want quite well.
quest88 joined #ruby
<Harzilein>
can i omit the second argument in some way?
davidcelis joined #ruby
<mksm>
nop
<mksm>
Harzilein, you could try #split
<mksm>
also accepts regex
ph^ joined #ruby
cjs226 joined #ruby
defghanistan joined #ruby
jimmy1980 joined #ruby
Sil4nc4_ left #ruby
sythe joined #ruby
<defghanistan>
Hello. I have Ruby 1.8.7 installed in Ubuntu desktop 11.10 right now and am trying to remove it so that I may install 1.9.2. "sudo apt-get purge ruby rubygems" looks like it's doing the job but ruby -v still shows 1.8.7 installed
<defghanistan>
anyone have any tips on removing this? i feel like it's impossible to get this thing removed
Guest64586 joined #ruby
jensn_ joined #ruby
<davidcelis>
defghanistan: Was ruby installed as an aptitude package on your system?
tomzx joined #ruby
bgupta joined #ruby
<defghanistan>
davidcelis: I honestly wish I could remember. I think I have RVM on here but it's non-functional. I am trying to completely wipe every bit of Ruby off of this thing so that I can start clean.
<davidcelis>
rvm implode?
<defghanistan>
davidcelis: is that a command? lol. I will have to try that one.
fritzthecat_ joined #ruby
<davidcelis>
it's to decimate your rvm installation
<davidcelis>
so that nothing remains
<davidcelis>
anybody with RVM installed should do it
<davidcelis>
and use rbenv
root joined #ruby
LiquidInsect joined #ruby
cooper joined #ruby
fetimo joined #ruby
ikaros joined #ruby
cableray joined #ruby
saschaheylik joined #ruby
nari_ joined #ruby
<saschaheylik>
hey ^^ :)
<deryldoucette>
davidcelis: and why should people decimate their rvm install? especially considering that rbenv uses shims rather than correctly setting the environment specific to the loaded and used ruby but instead keeps *all* shims still active even if unused? I'd suggest you read http://niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/
kinofcain joined #ruby
<deryldoucette>
absolutely nothing wrong with rvm (other than the FUD thrown around by sstephenson and regurgitated wholesale by those that don't know any better and don't check for themselves)
dasfugufish joined #ruby
symb0l joined #ruby
jgrimes_ joined #ruby
tonini_ joined #ruby
<tommylommykins>
hmm
jgrimes joined #ruby
* tommylommykins
wants to control an interactive text-based shell program in ruby
<tommylommykins>
any idea what the best way might be?
iocor joined #ruby
<mxweas>
I have a set of strings that follow this pattern 'item1 - item2' or 'item1-item2'. Right now I'm using .split('-', 2) to get the different items. Is it possible to make this remove the spaces around ' - ' when they're in the string?
<mxweas>
ideally, I'd like to use regex to match against ' - ' and '-' when I call split
<tommylommykins>
call String.strip on the split strings?
<mxweas>
oooh, I like that
<mxweas>
thanks!
<davidcelis>
Read that article, as well as the comments; I still prefer the shims approach.
* davidcelis
continues using rbenv
<tommylommykins>
alternatively, a single regex which matches ' - ' or '-' shouldn't be that hard to make?
<davidcelis>
mxweas: / ?- ?/
dasfugufish joined #ruby
<davidcelis>
matches '-', ' -' or ' - '
<davidcelis>
or '- '
<mxweas>
thanks!
fritzthecat_ joined #ruby
<sie>
How could I Array.collect whilist changing the values of array items in the block passed to collect?
jetblack joined #ruby
lkba joined #ruby
<davidcelis>
what?
<davidcelis>
you just described what .collect/.map does
<davidcelis>
changes values of the array items
<sie>
No, it changes the copy of it.
<mxweas>
use .collect!
<davidcelis>
.collect!
<sie>
But I need the values to be something else(sum them afterwards)
<davidcelis>
ask your question better :)
<davidcelis>
What Are You Trying To Do
<sie>
Okay, goes like this. I've got array of stuff. Let's assume it has hashes of :x and :y in it. I need to increment :y and return :x for summing them.
<sie>
Can I do that without new variables?
<Harzilein>
mksm: heh, split is nice, but leaves me with an array instead of a string