apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
Jake232 has joined #ruby
hse-hoens has joined #ruby
<bikcmp>
apeiros_: ick
neohunter has joined #ruby
<bikcmp>
apeiros_: didn't get a highlight
<bikcmp>
sorry, thanks much
neohunter has joined #ruby
<Spaceghostc2c>
bikcmp: I didn't know you ruby.
<frishi>
hi guys, sorry to interrupt and be off-topic, but whats the command to get help on nickserv. I cant get into #rubyonrails and need to register
<davidcelis>
lol
<davidcelis>
frishi: /ns help
<frishi>
thanks!
<banisterfiend>
davidcelis: u srs?
<davidcelis>
banisterfiend: hi
<banisterfiend>
davidcelis: that's just an alias on your irc client, surely
<banisterfiend>
'/ns' is not going to be a built-in, esp. when many irc servers dont even have a 'nickserv'
<davidcelis>
banisterfiend: /ns has worked on freenode for every client i've tried
<banisterfiend>
i would have though anyway
<banisterfiend>
thought*
<banisterfiend>
frishi: use /msg nickserv help
<banisterfiend>
if /ns doesnt work for u
<frishi>
/msg nickserv help
<frishi>
uh oh
<banisterfiend>
lol
<zandt>
frishi, to be safe, don't type that in a chat window
<frishi>
thanks much though, I got in
<zandt>
use the status window
<zandt>
ah okay
<zandt>
congrats
<frishi>
got it, apologies.
<zandt>
didn't want you blasting your password :P
phantomfakeBNC has joined #ruby
<bikcmp>
Spaceghostc2c: i ruby?
<bikcmp>
:P
<Spaceghostc2c>
bikcmp: It's a verb. Do you ruby? I just rubied.
<bikcmp>
sounds dirty
<Spaceghostc2c>
It kind of is. Guilty pleasure.
<bikcmp>
Spaceghostc2c: i ruby on occasion, but i prefer to snake a bit :P
<Spaceghostc2c>
bikcmp: At least you use both. Admirable, sir.
<bikcmp>
Spaceghostc2c: i use a ton of stuff
<bikcmp>
most of which i hate
<bikcmp>
but
<bikcmp>
:P
<Spaceghostc2c>
Fear is the path to the dark side. Fear leads to anger. Anger leads to hate. Hate leads to suffering.
<Spaceghostc2c>
Just make sure it's not you who is suffering.
malkomalko has joined #ruby
<bikcmp>
Spaceghostc2c: i actually have a neat project involving a bunch of languages
<bikcmp>
pm?
<Spaceghostc2c>
You're a friend, you're always welcome to query.
slackX has joined #ruby
CheeToS has joined #ruby
Guest23751 has joined #ruby
nikhgupta has joined #ruby
lkba has joined #ruby
jrhorn424 has joined #ruby
shevy has joined #ruby
hse-hoens has joined #ruby
Guest23751 has joined #ruby
KitsuneDrag0n has joined #ruby
hse-hoens has joined #ruby
ringotwo has joined #ruby
Beoran_ has joined #ruby
conor_ireland has joined #ruby
keymone has joined #ruby
jmazzi_ has joined #ruby
Guest23751 has joined #ruby
amesha has joined #ruby
hse-hoens has joined #ruby
Nathandim has joined #ruby
Guest23751 has joined #ruby
robkinyon has joined #ruby
neohunter has joined #ruby
swarley has joined #ruby
robkinyon has joined #ruby
amesha has joined #ruby
hse-hoens has joined #ruby
cobragoat has joined #ruby
cobragoat has joined #ruby
tomzx has joined #ruby
archivebot has joined #ruby
ZachBeta has joined #ruby
cobragoat has joined #ruby
baroquebobcat has joined #ruby
aef has joined #ruby
baroquebobcat has joined #ruby
Guest23751 has joined #ruby
amesha has joined #ruby
hse-hoens has joined #ruby
amesha has joined #ruby
Guest23751 has joined #ruby
<delinquentme_>
if ive got a open source project which I've bundled into a gem
<delinquentme_>
and I want to get system output when I hit a particular line of code
<delinquentme_>
i THINK I want log = Logger.new() log.error 'HITS"
<delinquentme_>
right?
<gogiel>
delinquentme_: wha'ts system output? stderr?
<maahes>
I'm getting a strangeish error, the rvm website says 'add rvm to your path with this: PATH=$PATH:$HOME/.rvm/bin [[ -s "$HOME/.rvm/scripts/rvm]] && . "$HOME/.rvm/scripts/rvm" but I now get this weird error: string not in pwd: ../
eko has joined #ruby
eko has joined #ruby
eko has joined #ruby
<shevy>
swarley what is that?
<swarley>
what i pasted/
<swarley>
oh it was something i made
<swarley>
it was the polyatomic ion sulphate
<swarley>
was the output at least
<shevy>
swarley do you have that on github?
<swarley>
no i dont, would you like me to add it?
<shevy>
yeah
<swarley>
sure thing
<shevy>
cool thanks
<swarley>
right now it only works for formulas
<swarley>
i'll be adding equations
<swarley>
and various calculations etc
<shevy>
I think the only thing similar I did was a while ago calculating total sum of a molecule, in atomic mass units
<swarley>
yeah i made a program to calculate molar mass in TIBasic
<swarley>
lol
<shevy>
what is TIBasic? a variant of Basic?
[[thufir]] has joined #ruby
gabeh has joined #ruby
<swarley>
shevy, its the programming language for the TI calculators
<shevy>
I'll include you specifically next time banister and me go ... uhm... to a lake
<shevy>
:>
<zandt>
ha ha
<zandt>
no thanks!
<shevy>
hehe
<banisterfiend>
shevy: can u yodel
<swarley>
Linux ubuntu 3.0.0-16-generic #29-Ubuntu SMP Tue Feb 14 12:48:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
<shevy>
banisterfiend no :( real yodeling ain't easy at all
<zandt>
swarley, what ver of ruby is in your repo ?
<shevy>
I think you need mountains for that too
<shevy>
JodaZ see JodaZ everything is different in the way debian sets up ruby, if you compare the paths to my paths or to swarley's path
<shevy>
hmm
<shevy>
JodaZ you should however try to update rubygems version
<shevy>
1.3.7 seems very old
<shevy>
when i install a .gem file, a copy will reside in directory: /usr/lib/ruby/gems/1.8/cache/
<shevy>
dunno where that is on debian
<zandt>
shevy, if I install from the repos (ubuntu 10.04) it'll mess up the paths too
<shevy>
yeah well
<zandt>
it's really nasty :>
<zandt>
that's why I was trying to get info outta swarley
<shevy>
my method is to tell people to kill all of debian ruby and compile ruby by yourself
<zandt>
^
<zandt>
that's what I did
superguenter has joined #ruby
<shevy>
but I dont understand it, there must be a way on debian to update to new ruby versions or?
<zandt>
not that I'm aware of
<shevy>
odd
<zandt>
I suppose you could get .deb files
<zandt>
but that's a dependency nightmare
<zandt>
way more complex than just compiling
<shevy>
really?
<shevy>
I want this to work:
<shevy>
apt-get ruby-1.9.3
<shevy>
oh
<shevy>
I forgot "install"
<shevy>
apt-get install ruby-1.9.3
<zandt>
if you have a repo in your list that has it, sure
<shevy>
hmm that reminds me
tk___ has joined #ruby
<shevy>
- INSTALLATION DIRECTORY: /var/lib/gems/1.8 JodaZ in that directory, is there a cache/ directory?
<shevy>
via "gem list" you can list the locally installed gems
<JodaZ>
shevy, yes
<shevy>
and if you downloaded a .gem file you can install via "gem install name-of-it.gem" too, and then "gem list" should show that one
<JodaZ>
yes
<shevy>
that debian uses /var/lib/gems/1.8 as path, perhaps that confuses rubygems. dunno if there is a commandline to specify something else, for me everything works as is when I use the default directory /usr/lib/ruby/gems/1.8/
<JodaZ>
require 'rubygems' works btw
<shevy>
irb works too?
<shevy>
try this, start irb. do 5+5, then press enter. then quit to leave, if that worked.
<shevy>
then "gem install wirble", then "gem list", then if wirble shows up, start irb again and do 5+5 etc...
<shevy>
the different should then be that you see colours
<shevy>
*difference
* zandt
tries that as well
<swarley>
1.9.1 requires rubygems by default and 1.8 does not
<shevy>
wirble is cute
adeponte has joined #ruby
<shevy>
I also use coderay for commandline colourizing ruby code
<swarley>
i just use pry
<swarley>
lol
<swarley>
also
<shevy>
cat tasks.rb | coderay -ruby
<shevy>
we just need something like smalltalk squeak
<swarley>
apt-get install ruby1.9.1-full
<shevy>
why do they omit the - between ruby and 1.9.1 ?
<swarley>
im not sure
noname has joined #ruby
<swarley>
the executable is ruby1.9.1
<shevy>
versioned binaries
<shevy>
\o/
<zandt>
they don't like the way word-word-word looks
<swarley>
what sucks is
<zandt>
I wish it were more complex than that
<swarley>
i have gem
<zandt>
but that's why
<swarley>
and gem1.9.1
<shevy>
lol
<shevy>
yay! \o/
<swarley>
no its awful
<shevy>
I am sorry man but
<swarley>
because if i use
<shevy>
your pain delights me :)))
<swarley>
ruby it uses gem
pgpkeys has joined #ruby
<zandt>
if I didn't laugh I'd throw my computer out the window
<shevy>
aah
<swarley>
but if i specify version it wont work
<swarley>
:[
<JodaZ>
swarley, no colors
<shevy>
but "gem" is just a symlink, right?
<shevy>
pointing to gem1.9.1
<swarley>
JodaZ, really just sudo apt-get install ruby1.9.1-full
<bryricker>
Hello - is `if something == "this" || "that"` actually a problem? I always that that using the double-pipes made that okay.
<bryricker>
It seems to still do it properly, just gives me a warning
<shevy>
careful with warnings :P
elake has joined #ruby
ghvandoorn has joined #ruby
Karmaon has joined #ruby
<shadoi>
bryricker: if something == "this" || something == "that"
<bryricker>
Is there a way to do it shorter?
<Boohbah>
the second is more readable, but is there actually a problem with parsing the first?
<bryricker>
No - it does the logic fine, but of course I want to avoid warnings in the logs
alek_b has joined #ruby
sarmiena_ has joined #ruby
havenn has joined #ruby
x0F__ has joined #ruby
mxweas_ has joined #ruby
kelsier has joined #ruby
baroquebobcat has joined #ruby
robdodson has joined #ruby
baroquebobcat has joined #ruby
hooper has joined #ruby
swarley has joined #ruby
<robdodson>
I'm trying to convert a CSV file to JSON but don't actually know wtf I'm doing :) Any insight into why this approach doesn't work and what I should do? http://pastebin.com/szJTRKPe
<Cache_Money>
is /usr/share/dict/words a folder within Ruby?
<Cache_Money>
I just ran this script (someone else produced) https://gist.github.com/2069501 that opens up a file on LIne 10, and it worked on my computer but I'm not sure why
shruggar has joined #ruby
<davidcelis>
um, wut
<davidcelis>
/usr/share/dict/words is your UNIX dictionary
<shevy>
Cache_Money it is often easier to write your own code, rather than try to understand other people's code
<davidcelis>
Cache_Money: dude stop fucking trying to cheat at Draw Something
<davidcelis>
just play the game
<shevy>
lol
<shevy>
bryricker not sure for shorter ways. I tend to do this often:
<shevy>
_ = something
<shevy>
case _
<shevy>
when 'this','that'
lewix has joined #ruby
lewix has joined #ruby
<shevy>
call_some_method
<shevy>
end
<shevy>
and if you need it with the input you can always change this to:
<shevy>
call_some_method(_)
<bryricker>
shevy: I ended up doing this: %{ this that }.include? something
<bryricker>
%w *
<davidcelis>
bryricker: good for you
<bryricker>
:)
<davidcelis>
+1 to that
<shevy>
yeah that is also short, I do that a lot too
robdodson has joined #ruby
<banisterfiend>
davidcelis: what's up
<davidcelis>
hi
<banisterfiend>
davidcelis: dont u find it offensive when someone uses their real name on irc or a real photo of themselves on github? it provides a glimpse of the decaying bag of flesh behind the code, whereas all we care about is the code itself.
gianlucadv has joined #ruby
<davidcelis>
ಠ_ಠ
<banisterfiend>
davidcelis: especially sickening when you catch a good view of their eyes in their photographs, and you see all their 'hopes and dreams' written so stupidly on their faces
<davidcelis>
you know flesh doesn't decay until it's dead, right
eldariof has joined #ruby
<banisterfiend>
it's always already dying
<shevy>
I think banister likes zombie movies
<davidcelis>
dying != dead
<davidcelis>
bro
<shevy>
yeah the dying are in greater state of misery :(
<banisterfiend>
davidcelis: you focusse on quite a trivial point of my fascinating monologue
<banisterfiend>
:P
<davidcelis>
yeah… fascinating...
tewecske has joined #ruby
<shevy>
I seem to be stuck with my ruby fu
<davidcelis>
shevy: GO ON……..
<shevy>
as in, you know, not really learning anything *really* new anymore
<shevy>
but I dont feel very wise :(
<shevy>
davidcelis should I make a break with ruby for some weeks?
<banisterfiend>
shevy: i can give you a difficult task to do, and if you solve it you'll probably be pretty awesome
<shevy>
I dont think that works
<banisterfiend>
shevy: you' learn a lot about the Method API
<shevy>
I need some new dimension to think in
<banisterfiend>
shevy: Yeah, the Method API opens up a new world
<banisterfiend>
source_location, owner, receiver
ryan0x2 has joined #ruby
<banisterfiend>
shevy: basically, write a show-class analog for pry's show-method ;)
<shevy>
I only have about tricks collected worth only 20 lines of pry :(
<shevy>
I am still very proud of Pry.config.prompt = proc
ap0gee has joined #ruby
<shevy>
there must be some way to think and then become 20% more productive
<shevy>
I need ^^^ that
selvakumaran has joined #ruby
<banisterfiend>
shevy: learn the Ruby C API
<banisterfiend>
that'll boost your ruby fu
<banisterfiend>
well, your understanding of ruby anyway
<selvakumaran>
Hi there, i am using Ruby 1.8 on opensuse, i need a help on this script http://susepaste.org/74636907
nemesit has joined #ruby
Prezioso has joined #ruby
<bryricker>
Hey, I know this isn't a ruby question but I'm already logged in here and figure someone will probably know - I think I accidentally typed in "bash -v" and it seems to have flagged a "verbose" option that I don't know how to turn off - I restarted the shell and it's fine now, but what is it that I did?
cloke has joined #ruby
<davidcelis>
bryricker: man bash
<davidcelis>
read the man page and you will discover that you, apparently, already know exactly what you did
<bryricker>
yeah I read it but I didn't see anything about turning it off
<davidcelis>
you dont
<davidcelis>
`bash -v` opens up a verbose bash shell
<davidcelis>
just close the shell.
<bryricker>
oh - I see
<bryricker>
thank you
<davidcelis>
command line options almost never have the ability to "turn off"
<davidcelis>
you just exit the program and run it again without the option
<banisterfiend>
Boohbah: 3.times is exquisite, i wish i had it in objc
<Boohbah>
wheee everything is an object! :)
<banisterfiend>
Boohbah: oh i just mean it's nicer than: for (int i=0; i < 3; i++) ;)
<Boohbah>
i agree
deadly_hcs has joined #ruby
kesor_ has joined #ruby
noyb has joined #ruby
LMolr has joined #ruby
artm has joined #ruby
shtirlic has joined #ruby
schovi has joined #ruby
Gesh has joined #ruby
dekz has joined #ruby
<dekz>
is there some written/unwritten warning about using for loops to spawn threads and the related shared scope?
<[[thufir]]>
ok, I'm fairly certain that I'm using the correct gem correctly: https://gist.github.com/2192333 yet am getting errors, undefined method, indicating otherwise. I've tried a few variations on what to require, and am currently looking over gem.
bsacke_ has joined #ruby
<[[thufir]]>
do I have the require statement wrong, perhaps?
mdw has joined #ruby
tayy has joined #ruby
Faris has joined #ruby
sepp2k has joined #ruby
<Boohbah>
[[thufir]]: yes, it seems the gem is non-functional. there is no 'server' attribute accessor or method defined in the gem
<Boohbah>
[[thufir]]: s/server/host/ in the example code
<[[thufir]]>
curious. I should've checked the api. thank you.
<banisterfiend>
can i send private tweets?
<[[thufir]]>
I copy/pasted the example code. pardon, I don't follow you. s/server/host/ mean ?
<banisterfiend>
does twtitter support that/
<banisterfiend>
like prvt: @baby @pig yo yo yo sup sup
<Boohbah>
[[thufir]]: substitute host for server
<[[thufir]]>
banisterfiend: wouldn't that defeat the purpose? it would just be SMS
<Boohbah>
[[thufir]]: the example code says server when it means host
<banisterfiend>
[[thufir]]: im not saying it should be the default
<banisterfiend>
[[thufir]]: just from time to time i want to tweet my brother some shit and not have the world see
<banisterfiend>
or my close friends
<Boohbah>
[[thufir]]: look at nntp.rb in the gem
<Boohbah>
[[thufir]]: oh, and get a real editor, nano is not a real editor. :)
<[[thufir]]>
Boohbah: that hurts. I spent hours with disk archiver (DAR), backed up data, formatted and installed to run Netbeans as an editor, only to find out they dropped ruby support.
<bounce>
meh, nano is fine if that's your thing
<[[thufir]]>
eclipse? also, arcadia. or shiftedit?
<Boohbah>
yeah, you can use what you like
<Boohbah>
i use vim
nikhil_ has joined #ruby
<bounce>
took a while before I finally got the hang of vi (nvi). before that got berated for 'not knowing vi' by someone who, er, could really only do things by cookbook and was generally clueless about how the basic services he 'maintained' worked
<banisterfiend>
can someone explain to me the way that categories are used to simulate private methods?
<banisterfiend>
i remember something like: @interface Blah () how does defining prototypes inside an anonymous category make things private?
<bounce>
should you want to learn vi, try "unix text editing"; it contains more than a pretty good intro to (original) vi, and you can skip the parts you're not interested in
<banisterfiend>
Boohbah: can u answer my q
<bounce>
(find the original as scanned pdf from o'reilly, or get the "remade" version that's a lot smaller; both are free)
<bounce>
whoops, "unix text processing"
lewis1711 has joined #ruby
<lewis1711>
I get that ruby isn't compiled, but is there any program that can go through ruby source code and catch *really* stupid errors like a variable not existing, or passing too many arguments?
francisfish has joined #ruby
<[[thufir]]>
there's an awesome xkcd on editor wars. says it all.
<banisterfiend>
lewis1711: look at laser
<lewis1711>
alright, but I am getting distracted by actual ruby lasers in searching for it
<bounce>
not all, but yeah. pick whatever you like.
<bounce>
though as, say, a unix sysadmin it makes more sense to be proficient in vi, even ed, than to insist every server have a full emacs environment installed, for example
<bounce>
oh look, someone ircing as root.
<lewis1711>
does that bother you?
<[[thufir]]>
https://gist.github.com/2192333 means that I need to use logger? or is that a problem in the gem source itself? presumably my setup.
<lewis1711>
also why do people still talk about vi? are they old? do they not use vim yet?
<bounce>
frankly, vim sucks so much I don't ever want to use it.
nikhil___ has joined #ruby
kremiak has joined #ruby
trivol has joined #ruby
jongleur has joined #ruby
<jongleur>
Hi. Anybody who is able to help me reinstalling ruby? in debian 5 I installed ruby 1.9.3 using make/make install from source, but it now complains about missing libyaml. I should install libyaml and reinstall ruby. But how to de/reinstall ruby when it's installed using make?
<jongleur>
there's no uninstall/reinstall target in the make file
<johndouthat>
jongleur: just do make install again after you've installed libyaml
<lewis1711>
or RVM :)
<johndouthat>
or rbenv ;)
<bounce>
no debian packages?
<nerdpowa>
bounce: Tahnks, I didn't know rbenv :D. I have to try it ....
<nerdpowa>
*thanks
<_dark>
this is !ruby, but what is the amount of data received by a system in a network called? bandwidth?? but bandwidth is bits/sec
<bounce>
not me that mentioned that
siefca has joined #ruby
<siefca>
ehlo
LMolr has joined #ruby
nerdpowa has quit [#ruby]
<siefca>
is there any way to modify values of a Hash while iterating? i've got a case where memory consumption is a priority
<johndouthat>
_dark: received data? transfers
<[[thufir]]>
jongleur: rvm
<bounce>
"received data" sounds about right. bandwidth is capacity, not necessarily capacity used
<[[thufir]]>
jongleur: /join #rvm they're really helpful. I'll give youtwo cents there, if you like.
<_dark>
say like people say i exceeded my bandwidth for their internet plan
<_dark>
they meant the amount of allotted transfers, but isn't bandwidth the amount of bits recieved a sec
<jongleur>
[[thufir]]: thanks. give me some minutes, I try johndouthat's tip first
<johndouthat>
_dark: data cap. quota
<[[thufir]]>
jongleur: ok.
<bounce>
(quotum is the singular)
<Boohbah>
(latin is dead)
<_dark>
johndouthat: ok
<bounce>
(says the resident redneck)
<[[thufir]]>
redneck means what? guns?
<bounce>
heh no
<banisterfiend>
Boohbah: woodcutter, cut down my shadow, deliver from the torment of bearing no fruit!
<lewis1711>
redneck means your need a longer mullet because you're getting sunburnt
<banisterfiend>
Boohbah: let me see open in my fingers, the blue rose of your womb
<[[thufir]]>
lol
<lewis1711>
better git growin
* Boohbah
grows
<banisterfiend>
Boohbah: little girls were running, chased by their braids, in a wind exploding with roses of black powder
apeiros_ has joined #ruby
<banisterfiend>
Boohbah: a bolting horse always finds the sea and is swallowed in the waves!
* Boohbah
appreciates literature only sometimes
<siefca>
Boohbah: I'm looking for something like each_value! that would modify the values of a Hash
<bounce>
next you'll be hailing oscar as your inspiration
<Boohbah>
h.each_value {|value| value = new_value }
Morkel has joined #ruby
<siefca>
Boohbah: there might be not enough memory left to create temporary data structure used to build new hash
<banisterfiend>
Boohbah: suns of silver, waves of pearl, skies of red hot coals! hideous wrecks at the bottom of brown gulfs, where the green snakes, eaten by vermin, fall from the twisted trees with black odours!
<siefca>
1.9.3p0 :025 > a => {:a=>10, :b=>20, :c=>30}
<siefca>
banisterfiend: yeah, I tried Hash[] and tried #inject but they're both create temporary data srtucture (a new Hash)
shruggar has joined #ruby
<banisterfiend>
siefca: use each_with_object
visof has joined #ruby
visof has joined #ruby
mdw has joined #ruby
<lewis1711>
I had this exact same problem before
<siefca>
banisterfiend: it would be great to have something to iterate "externally", meaning for each index of a Hash and then modifying it in for example for loop
<lewis1711>
a few weeks ago each_with_object is indeed the solution
<siefca>
but {} in each_with_object creates new hash which is filled up with new data, isn't it?
<Boohbah>
returns the initially given object.
<apeiros_>
a = {:a=>10, :b=>20, :c=>30}; a.each { |k,v| a[k]=v*10 }; a # => {:a=>100, :b=>200, :c=>300}
wilmoore has joined #ruby
<siefca>
apeiros_: it won't work in new ruby (1.9) since it modifies the collection while iterating, it generates Runtime error
<apeiros_>
siefca: I ran that in 1.9
<apeiros_>
you must not delete or add items
<apeiros_>
changing them is fine
<siefca>
i see now
<siefca>
hmm
<siefca>
strange
<apeiros_>
class Hash; def map_values!; each { |k,v| store(k, yield(v)) }; self; end; end # h.map_values! { |v| v*10 }
<lewis1711>
I wish ruby used method_name! consistently for mutating methods, not this hand-wavey "methods that do something unexpected"
<apeiros_>
lewis1711: personally I'd even prefer it'd just use proper language for it
<lewis1711>
huh?
<siefca>
apeiros_: this example of mep_values! should be in standard library
<apeiros_>
i.e. for my language, I have (the equivalent of): ary.mapped { … } and ary.map { … }
<siefca>
s/mep/map/
mcwise has joined #ruby
<apeiros_>
so mapped returns a new mapped array, while map maps the receiver itself
<lewis1711>
wtf is wrong with just map and map!
acekiller has joined #ruby
<apeiros_>
it requires more explanation, is less intuitive
<apeiros_>
anyway, I'm off for lunch, huzza! :D
<lewis1711>
to me it makes perfect sense
<lewis1711>
used in scheme as well
<lewis1711>
laters
<lewis1711>
also, I *sort of* know ruby but I still don't get this dynamic typing unit testing stuff. all I do is write code with lots of run time errors and dream of a statically typed OO language at rubys high level of abstraction. should I read a book or something, since I still don;t "get it"?
<siefca>
apeiros_: TY
dekroning has joined #ruby
<dekroning>
how can I generate the ri documentation for all rspec gems?
jonteru has joined #ruby
Jackneill has joined #ruby
nikhil_ has joined #ruby
archivebot has joined #ruby
emmanuelux has joined #ruby
<Sp4rKy>
/W 6
koud has joined #ruby
<apeiros_>
lewis1711: matter of practice
<apeiros_>
reading & writing code helps
<apeiros_>
discussing code also helps (local usergroups, here, …)
<banisterfiend>
apeiros_: what do u think about mailing lists
burgestrand has joined #ruby
sacarlson has joined #ruby
bonsaiben has joined #ruby
bonsaiben has quit [#ruby]
<apeiros_>
I like the idea, but I don't really use them
ben- has joined #ruby
statarb3 has joined #ruby
nemesit has joined #ruby
chanakya has joined #ruby
chanakya has joined #ruby
bonsaiben has joined #ruby
<bonsaiben>
hello
<bonsaiben>
is there a brave lad here willing to venture a stab at my question?
<bonsaiben>
it's a little hard to google so I'd like to tap a brain directly
<bonsaiben>
is there a method that returns the object calling it if the passed block returns true, otherwise nil? kind of like: [a].select {|a| a==b}.first, or: a if a==b... but i'd like to pass a block
<apeiros_>
wow, he takes so much time to ask, then leaves the channel right after asking…
* sepp2k
hates drive-by askers
<siefca>
apeiros_: btw, I know why interpreter doesn't allow me to update vash value in iteration
<banisterfiend>
sepp2k: wwhat's your opinion of objc
<apeiros_>
sepp2k: yeah, me too, but with this one, I wonder whether leaving was intentional…
<siefca>
apeiros_: simply the key is an array and the array was modified just before updating value
<sepp2k>
banisterfiend: Never used it
<lewis1711>
objective C combines the abstraction of C with the speed of smalltalk
<apeiros_>
siefca: in other words: you have a different key now, which means you'd add a key
<apeiros_>
siefca: don't use mutable objects as keys in hashes
<apeiros_>
if you mutate a key, you must use #rehash, which is inefficient
<siefca>
apeiros_: i'm fixking someone else's code, a bit messy
mdw has joined #ruby
<siefca>
apeiros_: i think i'll subclass array and add some method that is called to create a hashing key
<apeiros_>
those would be #hash and #eql?, and of course, both change when you change the array. subclassing won't help with that.
<siefca>
apeiros_: there was something but I don't remeber now, I mean the method that is called to calculate hash
<siefca>
apeiros_: #hash, yes
<apeiros_>
siefca: you must implement *both*
<apeiros_>
if you only do one, it'll not work correctly
<siefca>
apeiros_: i know, to be comparable
<apeiros_>
depending on your situation, you might consider using Hash#compare_by_identity
<siefca>
that would break the logic
<siefca>
i think i have to refactor the program
John_P has joined #ruby
Maxou56800 has joined #ruby
<apeiros_>
if you're currently having mutating hash keys, then refactoring that sounds like a great idea
adambeynon has joined #ruby
dhruvasagar has joined #ruby
<siefca>
or calculate if creating #hash and #eql would be efficient, e.g. like def hash self.reject{|x|x.nil?}.join.to_sym; end
thecreators has joined #ruby
<apeiros_>
that's not a hash value
<apeiros_>
should be a number
<siefca>
super()
<apeiros_>
you can build up on existing objects' #hash
RyanFreeman has joined #ruby
<apeiros_>
um… I don't see how you combine the code you just pasted with super…
<siefca>
i see
banisterfiend has joined #ruby
<siefca>
refactoring it is
kesor__ has joined #ruby
<apeiros_>
def hash; compact.hash; end; def eql?(other); compact.eql?(other.compact); end
<lewis1711>
huh, rvm cannot find "laser" or "ruby-debug"
ap0gee has joined #ruby
<Mon_Ouie>
Why would RVM know about gems? That's what the gem command-line tool is for.
<lynrix>
Hi guys I would like to upgrade my version of Ruby to 1.9 but I want to know why do I have to install git and rvm in order to upgrade ruby on the mac
<lynrix>
what is rvm> what is git for?
<apeiros_>
lynrix: you do know google, yes?
<apeiros_>
I know, it's a very new invention…
<lynrix>
lol I do but to be honest i wanted bette guidance by the group "pros"
<apeiros_>
how about you do the 5min of mandatory research first, and then ask more specific questions?
<lynrix>
i have already installed git from http://git-scm.com/ then I think I am suppose to install rvm
<lynrix>
but I am still a newbi
<lynrix>
and dont really get what the relation between the 3
<shevy>
rvm manages your ruby
<shevy>
they should sit on #rvm
<shevy>
as for whether you want or should use it, that is only up to you. I dont use it.
<lynrix>
so what step would you take if you use a mac and want to upgrade to a newer version of ruby?
Faris has joined #ruby
<shevy>
that question would be a problem as I dont use a mac. I am on linux and compile everything from source. there are many folks on #machomebrew though who use mac + ruby specifically
<lynrix>
thanks
<lynrix>
thats cool will check it out
dr_bob has joined #ruby
<banisterfiend>
lynrix: use rvm
trivol has joined #ruby
workmad3 has joined #ruby
freeayu has joined #ruby
celebritarian has joined #ruby
<shevy>
or install linux
dql has joined #ruby
Sailias has joined #ruby
greenarrow has joined #ruby
td123 has joined #ruby
iocor has joined #ruby
Russell^^ has joined #ruby
LMolr has joined #ruby
waxjar has joined #ruby
quandrum has joined #ruby
rcearn has joined #ruby
<rcearn>
Is there any way to develop iOS app in Ruby ? MacRuby or mRuby, ... ?
shtirlic has joined #ruby
quandrum has quit [#ruby]
<ukwiz>
what is the latest in the 1.8 line?
<apeiros_>
1.8.7
<shevy>
ukwiz my brother!
<banisterfiend>
rcearn: just learn objc
<rcearn>
banisterfiend: :D
<banisterfiend>
rcearn: it's very rubyish
<shevy>
ewww
<shevy>
you mac dudes really do everything just so you can stand on mac
<shevy>
*stay
lewix has joined #ruby
lewix has joined #ruby
thecreators has joined #ruby
adman65 has joined #ruby
musee has joined #ruby
ranok has joined #ruby
ranok has quit [#ruby]
bayashi__ has joined #ruby
<ukwiz>
how do i get the systemwide default version of ruby to be 1.8.7 using rvm
<apeiros_>
rvm use system
<apeiros_>
also see rvm help
Jake232 has joined #ruby
<ukwiz>
that doesn't set it systemwide though
<apeiros_>
oh, misread you
<apeiros_>
rvm help would have helped you, though. rvm use 1.8.7 --default
<ukwiz>
ah - I had tried rvm default 1.8.7
Squarepy has joined #ruby
Squarepy has joined #ruby
<ukwiz>
if I run rvm use 1.8.7 --default, then open a terminal, ruby -v still shows 1.9.2
<apeiros_>
and what does `which ruby` show?
<apeiros_>
(sounds to me like you haven't installed rvm properly and somehow overwritten the system ruby too… both bad things)
[[thufir]] has joined #ruby
davidpk has joined #ruby
Morpheus95 has joined #ruby
Morpheus95 has quit [#ruby]
nari has joined #ruby
fowl has joined #ruby
eldariof has joined #ruby
<ukwiz>
I was advised on this channel to remove the system ruby altogether
goodieboy has joined #ruby
<fowl>
why are __class__ and __main__ in here, I feel like they're mocking us.
<ukwiz>
which ruby gives /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby
workmad3 has joined #ruby
Dreamer3 has joined #ruby
<apeiros_>
ukwiz: who advised you to remove the system ruby?
<apeiros_>
it's about the worst idea ever… you generally leave system ruby untouched, for apps that depend on system ruby. you override (NB: not overwrite) it by setting PATH properly (which is what rvm does)
<shevy>
__class__ and __main__ never said anything, I think they are bots
<fowl>
silent bots are spy bots
philcrissman has joined #ruby
sdeobald has joined #ruby
<[[thufir]]>
apeiros_: I don't have a system ruby, just rvm
<[[thufir]]>
why is that bad? curious
<apeiros_>
fowl: nope
<apeiros_>
[[thufir]]: did your system ship with a ruby?
<[[thufir]]>
nope
<apeiros_>
then everything's fine
<fowl>
apeiros_, thats cool that means i get to go in #ruby-lang and highlight zenspider a bunch of times :p
<shevy>
egospider will just ban you without a word
<fowl>
nah hes funny when you piss him off
<fowl>
last time i could feel his rage through my screen
<[[thufir]]>
lol
jankud has joined #ruby
<jankud>
Hi, are there lists in Ruby ?
<fowl>
ruby has arrays
<jankud>
I am searching for an efficient data structure, where I can easily add an element inside
<jankud>
but the order matters
<jankud>
would arrays be efficient ?
<fowl>
i guess it depends on how you use them
<waxjar>
what kind of data/elements are we talking about?
<jankud>
I need to have a list of objects, of my own type
<jankud>
normally what I would do in languages like c++, I would have a table of pointers, so I would know where the data resides in the list, so that would allow fast addition
* apeiros_
wonders why the data that is stored would matter in any way…
<apeiros_>
jankud: what type of operations do you perform?
<apeiros_>
i.e., do you want to access the data by index?
<apeiros_>
do you delete items?
trivol has joined #ruby
freeze has joined #ruby
<apeiros_>
do you add at the begin/middle/end of the collection?
<apeiros_>
do you delete from the begin/middle/end of the collection?
<jankud>
I want to : add, delete, qucikly find an element with given "pointer"
<jankud>
from anywhere in the collection
<waxjar>
Hashes seem more appropriate then
<jankud>
What I would normally do I would have a hash that has pointers as values
<apeiros_>
jankud: what's a pointer in this context? usually a pointer would mean you already *have* the object in question… do you mean an index? (as in: a position)
akemrir has joined #ruby
<jankud>
something like position, but more abstrac, like if I insert something I dont want to increment it, right ?
akemrir has joined #ruby
<jankud>
as I said, it's easiest to think of it as a map with some keys, and values as pointers to the list
<banisterfiend>
jankud: that sounds like nerd talk to me
<jankud>
I would like to be able to add a new hash to the map, and insert it wherever I want in the list
<apeiros_>
it sounds confudazzled to me
<apeiros_>
jankud: for key/value store, you use a Hash
<apeiros_>
insert/access/delete is O(1) there.
<jankud>
ok , I know that
<apeiros_>
as of 1.9, insertion order is retained
<jankud>
but now I want those elements
<jankud>
that I insert
<jankud>
to be in certain order
<apeiros_>
access by position is O(n)
<apeiros_>
as said, insertion order is retained
<apeiros_>
(but that requires ruby 1.9+)
<jankud>
but can I put something in the middle ?
<jankud>
ruby 1.9 is fine
kirun has joined #ruby
<apeiros_>
not easily, no
<jankud>
so is there anything that supports insertions in any place?
<burgestrand>
but as far as ready-existing solutions I don’t know
<shevy>
yeah swarley
<shevy>
I'd even join the words
<shevy>
a classic watlol or lolwat
<alem0lars>
I'm trying to spawn an external process using Open3.popen3 but it seems that the wait_thr isn't passed into the block. Here is the code snippet: http://pastebin.com/Uuj1MkGM . Is it a bug on ruby 1.9.3 Open3 class?
<senthil>
swarley: last commit was 2 years ago, you sure you want that?
<banisterfiend>
swarley: good, cos we're almost at 1K :P
goodieboy has joined #ruby
<swarley>
watching
<swarley>
just added
<banisterfiend>
tx
<swarley>
np
<swarley>
its worth following anyway
artm_wasnt_avail has joined #ruby
<senthil>
banisterfiend: 999
<senthil>
now
<swarley>
i think im going to make something like readline
<fowl>
swarley, have you seen coolline?
jankud has quit [#ruby]
<swarley>
yeah
<banisterfiend>
senthil: haha
<swarley>
i was going to aim for something like that
<banisterfiend>
senthil: thanks
<fowl>
swarley, coolline needs a few fixes, you should do it :)
<swarley>
orly
<banisterfiend>
swarley: just fix coolline :)
<banisterfiend>
swarley: it was written by Mon_Ouie
goodieboy has joined #ruby
<banisterfiend>
(another 15 year old)
<swarley>
Mon_Ouie is a better programer than I, not sure how i could fix it
<swarley>
xD
<banisterfiend>
swarley: well he's the same age as you, so you should fight him for supremacy
<swarley>
Lol
<swarley>
will do
<swarley>
i'll fork it
<swarley>
what sort of issues are there?
<banisterfiend>
swarley: uparrow/down arrow dont work properly
<senthil>
banisterfiend: you bet
<swarley>
okie dokie
<swarley>
so history
<banisterfiend>
history is there
<banisterfiend>
it's just the up arrow key doesnt work, you can recover history with emacs bindings though, i.e ^P
<banisterfiend>
and ^N
<swarley>
i see
[[thufir]] has joined #ruby
<fowl>
swarley, the potential is there for doing cooler things like multiline editing and real indention
akemrir has joined #ruby
pyreal has joined #ruby
<swarley>
hm
<swarley>
okay
sdeobald has joined #ruby
<ThiefMaster>
shevy: looks good, how can i make it link the extension against a certain library?
akemrir has joined #ruby
<ThiefMaster>
(i need -lcap)
Drewch has joined #ruby
<ThiefMaster>
nvm
ZachBeta has joined #ruby
akemrir has joined #ruby
<shevy>
ThiefMaster dunno, years ago i decided to use ruby and forget C. I am proud to have done so!
<ThiefMaster>
builder.add_link_flags '-lcap'
<ThiefMaster>
that did the job
<shevy>
I have high hopes that one day you can forget C as well :)
<ThiefMaster>
maybe, but then in favour of python :p
<ThiefMaster>
WARNING: Can't find signature in "<my code>"
<ThiefMaster>
any way to get rid of that?
<swarley>
im not sure where to start lol
akemrir has joined #ruby
workmad3 has joined #ruby
<pyreal>
how do i include a dependency in a gem spec that's only needed for Ruby 1.8.7? (i.e. JSON)
<pyreal>
trying to back port a gem to support 1.8.7. using JSON from std lib for 1.9.2
dbgster has joined #ruby
<ThiefMaster>
nvm, removing the #includes helped
<fowl>
pyreal, stop backporting and move forward
<pyreal>
heh
<fowl>
if this is for some dumb company, tell them to
affix has joined #ruby
dominikh has joined #ruby
<fowl>
4 years is long enough to sit on your ass refusing to upgrade
<pyreal>
no this is to ensure that my gem works for ppl still forced to use 1.8.7 for whatever reasons
tesmar has joined #ruby
<fowl>
pygmael, fuck em
<pyreal>
my code is very simple so this is the only thing preventing it
<senthil>
pyreal: RUBY_VERSION ?
<shevy>
pyreal my brother!
Mchl has joined #ruby
<shevy>
long live 1.8.7, we never die, we multiply!
<pyreal>
so i'd put in an if statement around the spec.add_dependency to detect RUBY_VERSION
<shevy>
in the spec?
<pyreal>
in the .gemspec file i mean
<senthil>
pyreal: that's what I did: if RUBY_PLATFORM == 'java'
<senthil>
pyreal: not sure if that's right or not
<shevy>
my RUBY_VERSION is # => "1.8.7"
<pyreal>
thing is I thought i came across some sample code yesterday that had detection in the add_dependency line itself, but now i can't remember where i saw it
<shevy>
if RUBY_VERSION < "1.9" should work for 1.8
<pyreal>
i'll give that a whirl
<senthil>
pyreal: you mean with no 'if'
<senthil>
?
<pyreal>
shevy: maybe that's what it was
mcwise has joined #ruby
<pyreal>
my first time making a gem for anyone's use but myself, so not much practice in canonical ways to handle ruby versions :D
andrewhl has joined #ruby
<senthil>
where are the String, Hash implementation stored in a ruby installation?
<shevy>
pyreal I still havent made my first public gem :(
<shevy>
I am so lazy
<pyreal>
i made this one with my 11yo son yesterday..
Drewch has joined #ruby
<shevy>
Oh i see your masterplan
<pyreal>
heheh
<shevy>
he becoming better at ruby than you soon eh ;)
<pyreal>
he's gonna be my maintenance coder. bwahahahaha
<pyreal>
plus driveway shoveler
<shevy>
I think chris2 started with ruby when he was 10 (that's the guy who wrote http://rack.rubyforge.org/ dunno how old he is now ... 20 I think)
<pyreal>
nice
ThiefMaster has quit [#ruby]
<pyreal>
This worked: gem.add_runtime_dependency "json" if RUBY_VERSION < "1.9"
<pyreal>
thanks
falena has joined #ruby
<shevy>
cool
punkrawkR has joined #ruby
cha1tanya has joined #ruby
affix has joined #ruby
<Freelancer>
Hello, I'm looking for somebody who could help me using OAuth2 with Facebook... I have got some examples but they don't work for me.
goodieboy has joined #ruby
<swarley>
good news everyone
<swarley>
the down arrow works... in theory
<fowl>
what is it professor
<swarley>
i need to fix the up arrow lol
<pyreal>
i need to fix the backwards in the 4th dimension arrow
Faris has joined #ruby
blacktulip has joined #ruby
radic has joined #ruby
kesor_ has joined #ruby
apeiros has joined #ruby
<swarley>
so i see no logical reason for the up arrow not to work
visof has joined #ruby
visof has joined #ruby
artm_wasnt_avail has joined #ruby
schaerli has joined #ruby
fayimora has joined #ruby
cha1tanya has joined #ruby
csprite has joined #ruby
phaedrix has joined #ruby
gabeh has joined #ruby
Sailias has joined #ruby
baroquebobcat has joined #ruby
rippa has joined #ruby
bsacke has joined #ruby
Guest31588 has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
Molfar has joined #ruby
<Molfar>
I know that self refers to current instance, but what refers to current class (from instance method)?
<any-key>
you people should tell me if I'm doing anything stupid (besides reversing a string to switch endian-ess :| )
<swarley>
lolololol
<swarley>
you're programming a roomba? xD
<swarley>
thats so awesome
<shevy>
man
<shevy>
I have no idea what any-key is doing
<any-key>
kicking ass, taking names
<shevy>
and somehow i feel swarley dragging things down already, so I am not needed anymore
<any-key>
get back here
<swarley>
lawl
<any-key>
that lib only supports some of the actuator commands right now, I'm going to start work on the sensor portion soon :\
<any-key>
also, peanut butter tortillas were a good idea
<swarley>
i've done some work with robotics
havenn has joined #ruby
<swarley>
nothing that cool though
<swarley>
lol
<swarley>
worked with FIRST using labview and i tried out the C++
<any-key>
I need to make a video of what I've got so far...this is a small part of a senior design project ( a very small part )
<any-key>
oh hey, I did FIRST as well!
<swarley>
my team was rookie all star for our devision
<swarley>
but our design team was so stupid
n00b4lyfe has joined #ruby
<any-key>
right now I've been using the accelerometers in this watch TI makes to drive the roomba...it's kinda fun
<swarley>
so our robot was piss poor
<any-key>
heh
<swarley>
we programmed it well
<swarley>
their concepts were just... so dumb
<matti>
LOL
tayy has joined #ruby
goodieboy has joined #ruby
eldariof has joined #ruby
io_syl has joined #ruby
zakwilson has joined #ruby
nemesit has joined #ruby
jgrevich has joined #ruby
waxjar has joined #ruby
Drewch has joined #ruby
gabeh has joined #ruby
sepp2k1 has joined #ruby
mcwise has joined #ruby
leekspin has joined #ruby
<leekspin>
Hey, what are some good ways to parse binary data in Ruby? I stumbled upon bitstruct and bindata is there something better ? I have quite complicated format (with nesting)
Guest31588 has quit ["ERC Version 5.3 (IRC client for Emacs)"]
<heftig>
leekspin: String#unpack
ghvandoorn has joined #ruby
badelat has joined #ruby
bozhidar has joined #ruby
A124 has joined #ruby
fayimora has joined #ruby
A124 has joined #ruby
maletor has joined #ruby
phaedrix has joined #ruby
shtirlic has joined #ruby
schaerli has joined #ruby
CheeToS has joined #ruby
swarley has joined #ruby
burns180_ has joined #ruby
workmad3 has joined #ruby
havenn has joined #ruby
havenn_ has joined #ruby
A124 has quit [#ruby]
nfluxx has joined #ruby
fayimora has joined #ruby
trivol has joined #ruby
ooldirty has joined #ruby
eldariof has joined #ruby
yoklov has joined #ruby
acekiller has joined #ruby
sepp2k has joined #ruby
tatsuya_o has joined #ruby
waxjar has joined #ruby
zetm has joined #ruby
Morkel has joined #ruby
dv_ has joined #ruby
Molfar has joined #ruby
Molfar has quit [#ruby]
Drewch has joined #ruby
havenn has joined #ruby
conor_ireland has joined #ruby
stringoO has joined #ruby
sbanwart has joined #ruby
cha1tanya has joined #ruby
yoklov has joined #ruby
chimkan_ has quit [#ruby]
dbgster has joined #ruby
n1x has joined #ruby
otters has joined #ruby
<jonteru>
hi, how do i properly nest and's and or's in an if statement?
<canton7>
jonteru, 'and' and 'or' are used for flow control. You probably want '&&' and '||'
<jonteru>
i sure do
AxonetBE has joined #ruby
demian`_ has joined #ruby
apok has joined #ruby
<jonteru>
thx
<canton7>
np :)
<jonteru>
but still, how do i nest them?
<jonteru>
x=1 && (z=5 || z=6)
<jonteru>
i want something like that
francisfish has joined #ruby
<jonteru>
and it doesn't seem to work
<canton7>
'=' is assignment. '==' is used for comparison
Ontolog has joined #ruby
<canton7>
that statement above will always be true. 'x=1' assignes 1 to x, and return 1, which evaluates to boolean true. Then you've got the same with 'z=5'
shruggar has joined #ruby
cuci has joined #ruby
Gesh has joined #ruby
<cuci>
hi guys! I've cloned a rails app and I'm running bundle install --verbose but the CPU is at 8% and I get no output from it. It gets stuck at: Installing linecache19 (0.5.12) with native extensions
<cuci>
any ideas why? does linecache take forever to install with no CPU activity or if it's something wrong how can I investigate?
<jonteru>
canton7: sorry, written it in a hurry it's meant to be all ==
maletor has joined #ruby
<canton7>
jonteru, hrm, then it should work. What input are you giving it, and what output are you expecting and getting?
artOfWar has joined #ruby
<davidcelis>
cuci: "with native extensions" means there is some gcc action going on
<davidcelis>
cuci: there is some C compiling so chances are it will take more time than the usual gem
<cuci>
that much I expected I was only puzzeled by no CPU while compiling. It has finished now. Thanks!
t0mmyvyo has joined #ruby
maletor has joined #ruby
pzol has quit ["Sayonara!"]
Drewch has joined #ruby
artOfWar has joined #ruby
<jonteru>
canton7: ok, i think i got it to work, thank you
kW_ has joined #ruby
Indian has joined #ruby
gabeh has joined #ruby
kah_ has joined #ruby
<kah_>
hi, I've been looking at writing your own methods, why does this output say_moo 3 times instead of just defining x as a variable? http://pastie.org/3667319
S2kx has joined #ruby
newchaos has joined #ruby
sacarlson has joined #ruby
gabeh has joined #ruby
<kah_>
anyone?
acekiller has joined #ruby
mxweas_ has joined #ruby
newchaos has joined #ruby
wilmoore has joined #ruby
<davidcelis>
kah_: Because that's what Kernel#puts does
<davidcelis>
puts outputs a string.
<davidcelis>
that method isn't returning anything
<davidcelis>
it's just outputting
absinthe has joined #ruby
trivol has joined #ruby
<kah_>
davidcelis: yeah, so puts is put string... so it would make sense to me if instead of x = say_moo 3 I just had say_moo because then it would output what was in the method... but I don't understand why when you define x = say_moo 3 it still outputs the method
Tomasso has joined #ruby
<davidcelis>
Because that's what puts does.
<davidcelis>
It outputs.
<davidcelis>
It does not return anything
<davidcelis>
x = say_moo 3
<davidcelis>
what this means does not think what you think it means
artm has joined #ruby
<davidcelis>
It means assign the return value of say_moo(3) to x
<davidcelis>
say_moo does not return anything; it just outputs, so x remains nil
<kah_>
im completely mindfocked
<davidcelis>
You might want to read a ruby book
<kah_>
i am
<kah_>
that's what im doing
havenn_ has joined #ruby
<kah_>
im reading learn to program by chris pine
<davidcelis>
In Ruby, a method will return whatever the last statement returns
<davidcelis>
`puts` does not return anything. It just outputs
<davidcelis>
however, if you did...
<davidcelis>
def say_moo(times)
<davidcelis>
'moo' * times
<davidcelis>
end
<kah_>
what is the difference between return and outputs
<davidcelis>
now it will actually return what you want
<davidcelis>
uggghhh
ChampS666 has joined #ruby
crescendo_ has joined #ruby
<shevy>
aggghhh
friskd has joined #ruby
<davidcelis>
shevy: right???
<shevy>
davidcelis: left!!!
<shevy>
hmmm
<shevy>
we could need an extended "learn to program" online book
releod has joined #ruby
statarb3 has joined #ruby
statarb3 has joined #ruby
<canton7>
that was painful to read
sandGorgon has joined #ruby
sandGorgon_ has joined #ruby
neohunter has joined #ruby
Rishi_ has joined #ruby
Rishi_ has quit [#ruby]
Rishi_ has joined #ruby
Maxou56800 has joined #ruby
mdw has joined #ruby
twqla has joined #ruby
tatsuya_o has joined #ruby
groovehunter has joined #ruby
<groovehunter>
tag_types.map(&:to_s).each do |tags_type|
pingfloyd has joined #ruby
<groovehunter>
hi, can u explain to me what the "&" means in this context?
<wroathe>
I'm trying to come up with a clever way of doing this... I have an array of arrays that provide display values and value values for a select tag... It looks something like this
<wroathe>
I'm trying to find a clever way of getting a subset of those arrays without using this type of notation... vals[0]
<yxhuvud>
what kinda of subset?
<wroathe>
Well the actual array of arrays has about 10 arrays in it
<wroathe>
And I need numbers 2, 3, and 6
<apeiros>
.values_at
<wroathe>
Hmm... That would work. The problem is that if the nested array is modified then that code needs to be refactored.
<wroathe>
This is kind of a special data structure being made by a gem we use. I'm considering hacking in a special arr[] method to allow for symbols as selectors...
<wroathe>
like arr[:unscheduled]
<yxhuvud>
are you certain you don't want Array#assoc?
<fowl>
wroathe, your array is in a format that can be hashified
<apeiros>
ary.find { |v,k| k == :unscheduled }
<fowl>
Hash[yourarrayz]
<apeiros>
assoc uses the first element, not the last :-/
<apeiros>
oh, k == 'unscheduled' actually
<wroathe>
Actually assoc might be what I want
<wroathe>
Thanks
acuozzo has joined #ruby
kah_ has joined #ruby
<yxhuvud>
though wroath's variant of making a hash is probably faster if you end up with a lot of values.
<apeiros>
he said 10 k/v pairs, if I understood him correctly
<wroathe>
Yeah. Not sure what I'm going to do. Either way it's ugly. This is for a rails form that has a select tag with two sets of options depending on whether it's in the "New" action or hte "Edit" action
<apeiros>
rails select helpers--
Aristata has joined #ruby
superguenter1 has joined #ruby
<apeiros>
I remember the order of label/value by telling myself "just the opposite of how you'd do it"
t0mmyvyo has joined #ruby
<wroathe>
You're talking about options_for_select?
<acuozzo>
Does anyone know of any Ruby tutorials similar to <http://www.fincher.org/tips/Languages/Ruby/>? I'm a rather experienced programmer and I prefer tutorials that step through the syntax and semantics via example(s).
<acuozzo>
Interesting. Thanks for the suggestion -- I'll look into it further. 900 pages is a lot -- are Ruby's semantics deep enough to make a book of that length necessary?
<wroathe>
500 of those pages is the reference manual. You'll almost never read an entire reference manual from start to finish.
waxjar has joined #ruby
<wroathe>
The first 400 are for people who are new to the language who want some solid foundation building stuff
<Veejay>
http://pastie.org/3668492 <-- The fiber version is killing the other version and I'd like to understand why that is
<Veejay>
If anyone knows about fibers and wants to educate me, that'd be awesome
<Veejay>
(Or tell me if the benchmark is actually bad and provides bogus insight about fibers and their benefits)
<heftig>
Veejay: the fiber is iterative instead of recursive
<heftig>
you save on method calls.
<Veejay>
So maybe pit it against an iterative version of fibonacci?
goodieboy has joined #ruby
<heftig>
Veejay: no, it is already an iterative version
<heftig>
the only difference is that the fiber will produce all fibonacci numbers in sequence and return them (you're skipping n-1 of them in that code)
<Veejay>
Thanks a lot for the explanation
<Veejay>
The iterative version is about 10 times faster than the fiber version it turns out
<burgestrand>
the recursive variant will calculate the same fibonacci numbers several times
<heftig>
right, that too
<Veejay>
Yeah
`gregorg` has joined #ruby
<burgestrand>
it’s probably even slower if you increase n :)
<Veejay>
By the way, I'm not sure I get how Benchmark works
EvanR_ has joined #ruby
<Veejay>
It returns its results after the 1000.times block
<Veejay>
What are the real-world application of fibers by the way. I read a blog about a dude implementing Enumerable using fibers and that was pretty cool but...
<macgregor>
I forked a project that uses validates :title, presence: true
<macgregor>
that type of syntax instead of :presence => true