<RubyPanther>
thansen: it is mostly a question of which ruby you use, not telling ruby which gems to use. "which ruby" will tell you which ruby the shell finds.
Xeago has quit [Remote host closed the connection]
xsarin has joined #ruby
<thansen>
RubyPanther: I only have 1 installed...1.9
<RubyPanther>
you obviously didn't run the command if you think the answer might be "1.9"
oponder has joined #ruby
<RubyPanther>
try "man which"
<thansen>
I know how to use which
<thansen>
I have /usr/bin/ruby which is a symlink to /usr/bin/ruby19
CalebMingle has quit [Quit: CalebMingle]
fyolnish has joined #ruby
llaskin has joined #ruby
<llaskin>
how would one strip the leading zero off of a float? for example I have a value of 0.05 and I want to get the .05 out?
<RubyPanther>
There are 2 likely possibilities, 1 is that you're not using the system ruby and so it doesn't find those gems. The other is that your gemfile actually asks for certain versions, which are not the system gems. All of these problems would be solved by two steps, 1) use rvm or rbenv 2) don't care where your gems are coming from, care that you're asking for the versions you want in the Gemfile
<llaskin>
is the best way to put it to a string and strip out the "0." part?
<havenn>
thansen: env | grep GEM
<mosesaro>
I was wondering anybody know a good rails book for a nooby
<thansen>
havenn: I'd be happy to hack some env vars to make it work...I'll be in the context of the gentoo build system
Spooner has quit [Remote host closed the connection]
TheFuzzball has quit [Quit: Computer has gone to sleep.]
dr_neek has quit [Ping timeout: 245 seconds]
danneu1 has quit [Client Quit]
<havenn>
thansen: GEM_HOME & GEM_PATH are the big two
<havenn>
thansen: GEM_HOME is the default repository location for gem installation.
<havenn>
thansen: whilst GEM_PATH is a colon-separated list of all the gem repository directories.
<thansen>
havenn: and that would affect where bundler is trying to store crap while running?
<thansen>
*wouldn't
<RubyPanther>
to my it sounds like: I don't want what everybody actually uses I want a Ruby Goldberg
danneu has joined #ruby
ryanjh has quit [Quit: Computer has gone to sleep.]
havenn has quit [Remote host closed the connection]
jblack has joined #ruby
<RubyPanther>
if bundler thinks you don't have the version you asked for and downloads one, it is usually right.
<RubyPanther>
the first thing I would do is ask for exact versions and have those versions
<thansen>
how 'deep' into the directory stucture should GEM_HOME go
mercwithamouth has joined #ruby
<danneu>
What's the community favorite/standard for ruby documentation these days? I've never written a line of doc markup before and want to start right now. seems to be YARD?
<thansen>
/usr/lib64/ruby/gems/ .. or /usr/lib64/ruby/gems/1.9.1
hotovson_ has joined #ruby
rakl has quit [Quit: sleeping]
jblack has quit [Client Quit]
fyolnish has quit [Remote host closed the connection]
x82_nicole has joined #ruby
syamajala has quit [Ping timeout: 246 seconds]
katherinem13 has quit [Quit: leaving]
nari has quit [Ping timeout: 245 seconds]
<mosesaro>
guys/girls?
<mosesaro>
any good ruby book for a noob?
katherinem13 has joined #ruby
<danneu>
mosesaro: bastard book of ruby is nice because it gets you doing practical things asap
<mosesaro>
danneu thanks I will check it out
jacktrick has joined #ruby
mikepack has joined #ruby
yshh has joined #ruby
xsarin has quit [Quit: xsarin]
b1rkh0ff has quit [Ping timeout: 252 seconds]
dr_neek has joined #ruby
yshh has quit [Remote host closed the connection]
punkrawkR^Home has quit [Read error: Connection reset by peer]
<JosephFritzll>
poland is shittest because hitlers ruined this country
<JosephFritzll>
and they killed jews
<JosephFritzll>
germany is responsible for holocaust
<emocakes>
poland was shittiest before hitler
<emocakes>
poland will continue to be shittiest as long as polish people continue to blame their problems on other countries
<emocakes>
it isn't too difficult to understand
<JosephFritzll>
no it wasnt
<emocakes>
you even got let into the EU on a symptahy card and havent been able to make much out of it
<JosephFritzll>
you ruined world
<emocakes>
lol
<emocakes>
:)
jblack has joined #ruby
<JosephFritzll>
GERMANY = HITLERS = kill random people without reason
<jblack>
Hi. I have two models, Filing and Principalforfiling. Filing has a "has n" relationship to principalforfiling, and principalforfiling has a belongs_to to filing. I want all Filings that have a principalforfiling that has a principal_email address of emailvar.
<JosephFritzll>
you are cancer of world
<jblack>
I tried this: Filing.all(Principalforfiling.principal_email => emailvar) { |x|
<jblack>
but I get: /var/lib/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/query.rb:866:in `block in assert_valid_conditions': condition :principal_email does not map to a property in Filing, but belongs to Principalforfiling (ArgumentError). Any suggestions on how to do this?
<emocakes>
JosephFritzll, they had reasons, just like poles killed germans before the war, they probably didnt teach you that in propaganda school though
keanehsiao has quit [Ping timeout: 248 seconds]
<emocakes>
anyway
<JosephFritzll>
no
<JosephFritzll>
emocakes oh really
<emocakes>
trying to compile hping
<JosephFritzll>
what was the reason to kill all jews?
<JosephFritzll>
to perform holocaust
llaskin has quit [Ping timeout: 260 seconds]
<emocakes>
some crazy guy thought it was a good idea?
<emocakes>
nonetheless, a reason
jimmyy has quit [Read error: Connection reset by peer]
<emocakes>
i.e: what was reason to drop a-bomb on japan?
TomyLobo has quit [Quit: Standby mode...]
<emocakes>
what is your reason for attempting to troll on IRC
<JosephFritzll>
ALL GERMAN WAS SUPPORTING HITLER ON THIS
<JosephFritzll>
YOUR PARENTS WERE SUPPORTING HOLOCAUST
<X-Jester>
banisterfiend: er, i thought @@var was the equivalent of a static variable
MattRB has quit [Quit: This computer has gone to sleep]
<X-Jester>
only called a class variable instead of a static one
<banisterfiend>
X-Jester: a bit different, and generally discouraged in ruby
havenn has quit [Remote host closed the connection]
<X-Jester>
doh, my bad
<banisterfiend>
X-Jester: class instance variables (instance variables on the class) are often recommended instead
<X-Jester>
banisterfiend: he doesn't want to instanciate his class
<banisterfiend>
X-Jester: your code would work, it's just a bit weird in ruby
havenn has joined #ruby
jaequery has joined #ruby
Boohbah_ has quit [Changing host]
Boohbah_ has joined #ruby
Boohbah_ has joined #ruby
<banisterfiend>
X-Jester: yeah, that's *class* instance variables (only accessible on the class) not instance variables that will available to an instance
Boohbah_ is now known as Boohbah
<X-Jester>
alright, can you direct him on how to do this ruby style then :)
jaequery has quit [Client Quit]
<X-Jester>
he wanted self.methods that could access variables, and if it were me, i'd make a class accessor as self.getSomething to return @@something
crackfu has quit [Ping timeout: 246 seconds]
<vetsin>
:<
<banisterfiend>
vetsin: 'extend the module's functionality' --> you coudl always just add a method to the module :)
jimmyy has joined #ruby
<vetsin>
banisterfiend: thats what i want to do, but i didn't want to like grab the source and include it
joshcheek has joined #ruby
<banisterfiend>
vetsin: you can re-open a module at any time
<vetsin>
So, OO isn't the way to go here
b1rkh0ff has quit [Ping timeout: 246 seconds]
<banisterfiend>
btw this is a pretty weird thing to do :) Basically all taht you want is a class method on your class, right?
jfl0wers has joined #ruby
<vetsin>
yes
havenn has quit [Ping timeout: 240 seconds]
<X-Jester>
vetsin: i've had good success just extending via <<, like "class MyThread << Thread"
<X-Jester>
but i am not sure if that behavior is functionally any different than the 'extend' keyword you're using
<X-Jester>
does Term::ANSIColor::ATTRIBUTES.each do anything different?
orcris has joined #ruby
<banisterfiend>
joshcheek: he shouldn't get a NoMethodError for Color.escape_to_html afaict
<vetsin>
X-Jester: yeah, it makes it work
fyolnish has joined #ruby
jaequery has joined #ruby
cyong has quit [Quit: Leaving.]
adeponte has quit [Remote host closed the connection]
niklasb has quit [Ping timeout: 244 seconds]
QaDeS has quit [Quit: Ex-Chat]
MattRB has joined #ruby
<X-Jester>
vetsin: then it must have just been a namespacing thing
horofox has joined #ruby
<banisterfiend>
vetsin: are you sure the exception you were getting was a NoMethodError on Color.escape_to_html, and not another kind of exception?
fschuindt has joined #ruby
<X-Jester>
banisterfiend: i think we found the problem
<X-Jester>
banisterfiend: he needed to provide a fully qualified namespace to his ATTRIBUTES.each block
<X-Jester>
i.e. Term::ANSIColor::ATTRIBUTES.each
<vetsin>
banisterfiend: The error in the paste was what was returned, though i didn't look at the full trace
adeponte has joined #ruby
<banisterfiend>
X-Jester: i still dont get why a constant lookup error resulted in a NoMethodError for escape_to_html
<X-Jester>
vetsin: i don't blame you for being confused about ruby's OO, i still wrestle with it
<X-Jester>
vetsin: can you paste the full stacktrace?
<vetsin>
yeah sure, let me re-create the error
<X-Jester>
banisterfiend: maybe the interpreter assumed that he was attempting to invoke a method instead of access a member?
<banisterfiend>
nah..
<vetsin>
ah crud, it turns out i must have had another error as banister said
<vetsin>
because without the extra namespace stuff the error is: uninitialized constant Color::ATTRIBUTES
<X-Jester>
aha
<X-Jester>
well, there ya go
<X-Jester>
;)
<X-Jester>
i am psychic and knew that was the error you were really getting :P
<X-Jester>
*strut*
<vetsin>
lol
<X-Jester>
anyway, once you get the hang of it, ruby is immensely powerful
Paradox has joined #ruby
<vetsin>
testing it out now, started a few days ago, i'm liking a lot of the idioms it seems to use
x0F has quit [Read error: Connection reset by peer]
<CalebMingle>
it gets better as you go.
dmiller has quit [Ping timeout: 248 seconds]
tomzx_ has joined #ruby
CalebMingle has quit [Quit: CalebMingle]
<X-Jester>
my biggest frustration is how antequated my OO thinking is
<X-Jester>
so many things want to be done in blocks and i get frustrated with that
jaequery has quit [Quit: Computer has gone to sleep.]
x0F has joined #ruby
<X-Jester>
(but i also got really frustrated with function pointers in C and C++, so there you go)
phrame has quit [Ping timeout: 248 seconds]
vlad_starkov has quit [Remote host closed the connection]
Kingy has quit [Quit: Leaving]
phrame has joined #ruby
emocakes has joined #ruby
<banisterfiend>
vetsin: this should work in place of Term::ANSIColor::ATTRIBUTES.each too, singleton_class::ATTRIBUTES.each
<vetsin>
My OO is from java, so...
<vetsin>
oh that looks much better
threecreepio has joined #ruby
caleb_io has joined #ruby
<banisterfiend>
wait
<vetsin>
it works
horofox has quit [Quit: horofox]
b1lly has quit [Quit: b1lly]
tomzx_ is now known as tomzx_mac
<banisterfiend>
yeah
RagingDave has quit [Quit: Ex-Chat]
coaster is now known as coastRAVEN
benlieb has joined #ruby
taoru has quit [Remote host closed the connection]
keanehsiao has joined #ruby
toekutr has quit [Remote host closed the connection]
main has joined #ruby
keanehsiao has quit [Ping timeout: 246 seconds]
Dreamer3 has joined #ruby
crackfu has joined #ruby
dwn has quit [Ping timeout: 256 seconds]
jfl0wers has quit [Ping timeout: 245 seconds]
orcris has quit [Ping timeout: 245 seconds]
jackyalcine_ has joined #ruby
benlieb has quit [Quit: benlieb]
digitalcakestudi has joined #ruby
pac1 has joined #ruby
angusiguess has quit [Quit: leaving]
Takehiro has quit [Remote host closed the connection]
jackyalcine has quit [Ping timeout: 248 seconds]
ttt has joined #ruby
krz has joined #ruby
baroquebobcat has joined #ruby
SigmaVirus24 has joined #ruby
pray_4_matt_ryan has quit [Remote host closed the connection]
caleb_io has quit [Quit: caleb_io]
benlieb has joined #ruby
<asgardBSD>
I was wondering if it was clojure or groovy that people said that was bad, because it brought the same bad thing java had...
skaczor has joined #ruby
nfk has quit [Quit: yawn]
<vetsin>
could somone tell me what to look up for why '[\e[0m]' and "[\e[0m]" give me different results?
benlieb has quit [Client Quit]
<asgardBSD>
Im sure it was either on this channel or on Scala that someone said every language that run on JVM language is good except Java, then I asked for clojure and groovy
caleb_io has joined #ruby
vlad_starkov has joined #ruby
arya has joined #ruby
xsarin has joined #ruby
MattRB has quit [Quit: This computer has gone to sleep]
xsarin has quit [Client Quit]
baroquebobcat has quit [Quit: baroquebobcat]
<fschuindt>
How can I generate all possibilities combinations of an determined array in a range of combination length. Eg: ('a'..'f').to_a.all_possibilities(3, 5) Should reproduce another array like this: "abc, abd, abe, abf, ..., abcde, abcdf, abcda, ...". From "abc" (3 characters) up to the last possible combination of ('a'..'f').to_a with 5 characters length. Any help? (Isn't my homework)
io_syl has joined #ruby
autibyte has quit [Remote host closed the connection]
planplotexe is now known as plotplanexe
plotplanexe has quit [Changing host]
plotplanexe has joined #ruby
jenrzzz has joined #ruby
EzeQL_ has joined #ruby
vlad_starkov has quit [Ping timeout: 256 seconds]
EzeQL has quit [Ping timeout: 240 seconds]
samphippen has quit [Quit: Computer has gone to sleep.]
cobragoat has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
diegoviola has quit [Quit: WeeChat 0.3.9.2]
slainer68 has joined #ruby
nari has joined #ruby
pskosinski has quit [Quit: Learn Life's Little Lessons]
toekutr has joined #ruby
sepp2k has quit [Remote host closed the connection]
dmiller has joined #ruby
Cooler_ has joined #ruby
pskosinski has joined #ruby
slainer68 has quit [Ping timeout: 246 seconds]
Axsuul has quit [Ping timeout: 252 seconds]
keanehsiao has joined #ruby
keanehsiao has quit [Client Quit]
CrawfordComeaux has joined #ruby
cjs226 has quit [Ping timeout: 248 seconds]
havenn has joined #ruby
miskander has joined #ruby
mikepack has quit [Remote host closed the connection]
asgardBSD has quit [Ping timeout: 256 seconds]
havenn has quit [Ping timeout: 256 seconds]
JumpMast3r has joined #ruby
<raz>
define_method :foo { self } .. <- self points to the scope surrounding define_method here. how do i, from inside the defined method, get a reference to the instance on which the method is invoked?
pskosinski has quit [Quit: Learn Life's Little Lessons]
Virunga_ has quit [Remote host closed the connection]
digitalcakestudi has quit [Quit: Leaving.]
miskander has quit [Quit: miskander]
jaequery has joined #ruby
<banisterfiend>
raz: self
generalissimo has joined #ruby
<raz>
hm you are right, i seem to have a different issue here
guns has joined #ruby
sailias has joined #ruby
gyre007 has quit [Remote host closed the connection]
hackerdude has joined #ruby
S1kx has joined #ruby
S1kx has quit [Changing host]
S1kx has joined #ruby
banisterfiend has quit [Remote host closed the connection]
_alejandro has quit [Remote host closed the connection]
miskander has joined #ruby
mahmoudimus has joined #ruby
jaequery has quit [Quit: Computer has gone to sleep.]
kpshek has quit [Ping timeout: 256 seconds]
jaequery has joined #ruby
jinzhu has joined #ruby
wallerdev has joined #ruby
cobragoat has quit [Remote host closed the connection]
wargasm has quit [Ping timeout: 248 seconds]
jenrzzz has quit [Ping timeout: 252 seconds]
cobragoat has joined #ruby
aaronmacy has quit [Quit: Leaving.]
jbw has quit [Ping timeout: 245 seconds]
emmanuelux has quit [Remote host closed the connection]
freakazoid0223 has quit [Quit: Leaving]
x82_nicole has quit [Ping timeout: 248 seconds]
vsh_ has joined #ruby
x82_nicole has joined #ruby
yugui_zzz is now known as yugui
cobragoat has quit [Remote host closed the connection]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
coastRAVEN is now known as RAVENSRAVENS
tbrock has joined #ruby
RAVENSRAVENS is now known as coaster
emocakes has quit [Quit: emocakes]
tbrock has quit [Client Quit]
tbrock has joined #ruby
tbrock has quit [Max SendQ exceeded]
gyre008 has quit [Remote host closed the connection]
tbrock has joined #ruby
Hanmac1 has joined #ruby
tbrock has quit [Client Quit]
hackerdude has quit [Remote host closed the connection]
joshcheek has quit [Quit: joshcheek]
joshcheek has joined #ruby
Hanmac has quit [Ping timeout: 252 seconds]
SigmaVirus24 has quit [Quit: leaving]
thomasfedb has joined #ruby
rismoney has joined #ruby
sailias has quit [Quit: Leaving.]
jbw has joined #ruby
orcris has joined #ruby
gyre007 has joined #ruby
Takehiro has joined #ruby
robbyoconnor has quit [Ping timeout: 256 seconds]
pac1 has quit [Quit: I got it one line of code at a time]
santosh has joined #ruby
filemon_CZ has quit [Read error: Connection reset by peer]
robbyoconnor has joined #ruby
santosh has quit [Client Quit]
mahmoudimus has joined #ruby
gyre007 has quit [Ping timeout: 256 seconds]
slainer68 has joined #ruby
dnyy has joined #ruby
slainer68 has quit [Ping timeout: 252 seconds]
arya has quit [Ping timeout: 248 seconds]
GeekSir has joined #ruby
arya has joined #ruby
<joshcheek>
vetsin: There are any number of books that would be good. The Pickaxe (Programming Ruby 1.9) is probably the best, but it's big and that can be overwhelming. Buuuut, it covers a ton of stuff, and you don't need all of that (I consider it the best Ruby book there is, but you don't need all of it). I also cover it a little bit in Ruby Kickstart (in the first video http://ruby-kickstart.com/ at 34 minutes)
Takehiro has quit [Remote host closed the connection]
MattRB has joined #ruby
joofsh has joined #ruby
pootietang has quit [Quit: leaving]
agarie has quit [Remote host closed the connection]
paolooo has joined #ruby
sailias has joined #ruby
jonathanwallace has joined #ruby
jblack has quit [Ping timeout: 244 seconds]
miskander has joined #ruby
guns has quit [Quit: guns]
zehrizzatti has joined #ruby
JumpMast3r has quit [Quit: JumpMast3r]
hotovson_ has quit [Remote host closed the connection]
GeekSir has left #ruby [#ruby]
hotovson has joined #ruby
jimmyy has quit [Read error: Connection reset by peer]
cjs226 has joined #ruby
miskander has quit [Quit: miskander]
Nisstyre-laptop has quit [Quit: Leaving]
hotovson has quit [Ping timeout: 245 seconds]
hemanth has joined #ruby
paolooo has quit [Quit: Page closed]
miskander has joined #ruby
adeponte has quit [Remote host closed the connection]
skaczor has quit [Remote host closed the connection]
skaczor has joined #ruby
elkclone has joined #ruby
sayan has joined #ruby
jduan1981 has quit [Ping timeout: 256 seconds]
skaczor has quit [Remote host closed the connection]
jblack has joined #ruby
skaczor has joined #ruby
miskander has quit [Client Quit]
<shevy>
vetsin well, "" in strings may be different than '', at least when you use #{} within ""
rakl has quit [Quit: sleeping]
<shevy>
I myself tend to prefer '' when there are no interpolations to be done, and "" when they may be done
<shevy>
others prefer "" all the time
jenrzzz has joined #ruby
jackyalcine_ has quit [Ping timeout: 252 seconds]
genjuro has joined #ruby
aaronm_ is now known as aaronm
genjuro has quit [Remote host closed the connection]
vsh_ has quit [Quit: Leaving]
elkclone has quit [Remote host closed the connection]
az7ar has joined #ruby
robbyoconnor has quit [Max SendQ exceeded]
elkclone has joined #ruby
elkclone has quit [Client Quit]
robbyoconnor has joined #ruby
jackyalcine_ has joined #ruby
jackyalcine_ has quit [Changing host]
jackyalcine_ has joined #ruby
skaczor has quit [Remote host closed the connection]
elkclone has joined #ruby
friskd has joined #ruby
skaczor has joined #ruby
skaczor has quit [Remote host closed the connection]
skaczor has joined #ruby
skaczor has quit [Remote host closed the connection]
fschuindt has quit [Remote host closed the connection]
skaczor has joined #ruby
skaczor has quit [Remote host closed the connection]
skaczor has joined #ruby
gyre007 has joined #ruby
miskander has joined #ruby
adeponte has joined #ruby
adeponte has quit [Remote host closed the connection]
sayan has quit [Read error: Connection reset by peer]
karasawa has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
jenrzzz has joined #ruby
thufir_ has joined #ruby
thufir_1 has joined #ruby
az7ar has quit [Ping timeout: 252 seconds]
thufir_1 has quit [Client Quit]
friskd has quit [Quit: friskd]
Umren has joined #ruby
gyre007 has quit [Ping timeout: 246 seconds]
blazes816 has quit [Quit: blazes816]
x82_nicole has quit [Quit: Computer has gone to sleep.]
<unstable>
I am writing a simple chess game in CLI (I'm learning ruby as my first language).
<unstable>
It's coming along, and most of the pieces can move around the board, etc.
<shevy>
unstable good
<unstable>
For the ComputerPlayer class.. I don't want to set it up to randomly move against he HumanPlayer class. Is there a good chess engine in ruby or something else that isn't difficult to use?
<unstable>
I basically want to feed it moves, and get moves back from the ComputerPlayer
browndawg has joined #ruby
<davidcelis>
it's more complicated than that
<davidcelis>
the computer should take the entire board into account, not just the last move
<shevy>
there is a "chess" gem but I dunno if it is finished
<shevy>
chess/gnuchess.rb:53: warning: regexp has invalid interval
Playground has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
<unstable>
So gnuchess is written in c++, does that mean the gem is just a wrapper the executes the linux elf binaries?
miskander has quit [Quit: miskander]
<X-Jester>
unstable: i guess thta depends on how ruby native extensions work
<shevy>
no real idea, usually you have to compile the bindings on your own system
yacks has joined #ruby
az7ar has joined #ruby
<X-Jester>
unstable: i haven't looked closely enough to see if native extensions are just shellouts, or if the ruby interpreter acutally pulls in the shared object
noxgirl has joined #ruby
gokul has joined #ruby
atno has quit [Remote host closed the connection]
arya has quit [Ping timeout: 248 seconds]
noxgirl is now known as autumn
jekotia has quit [Quit: ChatZilla 0.9.89-rdmsoft [XULRunner 1.9.0.17/2009122204]]
JumpMast3r has joined #ruby
radic has joined #ruby
arya has joined #ruby
joeycarmello has quit [Remote host closed the connection]
stnly has joined #ruby
fschuindt has joined #ruby
radic_ has quit [Ping timeout: 260 seconds]
<fschuindt>
I was running a very long code when the terminal outputs: "Killed" and the program has turned off. What may be the cause?
<heftig>
fschuindt: out of memory
<heftig>
check dmesg
caleb_io has joined #ruby
etcetera has joined #ruby
huoxito has quit [Ping timeout: 244 seconds]
hackerdude has joined #ruby
Eol has joined #ruby
etcetera has quit [Client Quit]
browndawg has quit [Ping timeout: 245 seconds]
adeponte has joined #ruby
ananthakumaran has joined #ruby
adeponte has quit [Read error: Connection reset by peer]
hackerdude has quit [Remote host closed the connection]
karasawa has joined #ruby
Quadlex is now known as AwayLex
alexwh has quit [Ping timeout: 252 seconds]
skaczor has quit [Remote host closed the connection]
Playground has joined #ruby
rippa has joined #ruby
Guest42233 has quit [Ping timeout: 252 seconds]
quest88 has joined #ruby
freeayu has quit [Read error: Connection reset by peer]
alexwh has joined #ruby
alexwh_ has joined #ruby
alexwh_ is now known as Guest49725
sayan has joined #ruby
browndawg has joined #ruby
mneorr has joined #ruby
freeayu has joined #ruby
Umren has quit [Read error: Connection reset by peer]
hackerdude has quit [Remote host closed the connection]
baroquebobcat has joined #ruby
eyeR8 has joined #ruby
cantonic has quit [Quit: cantonic]
robbyoconnor has joined #ruby
cha1tanya has joined #ruby
guns has joined #ruby
aedornm has quit [Quit: Leaving]
jonahR has quit [Quit: jonahR]
arya has quit [Ping timeout: 248 seconds]
baroquebobcat has quit [Quit: baroquebobcat]
dnyy has quit [Remote host closed the connection]
dnyy has joined #ruby
nocturne7 has joined #ruby
CrawfordComeaux has quit [Read error: Connection reset by peer]
nocturne7 has left #ruby ["Leaving"]
<shevy>
epochwolf that is already a DSL, is it not?
b1rkh0ff has joined #ruby
<shevy>
on() help() once() and command() methods in use there
alex__c2022 has quit [Read error: Connection reset by peer]
arya has joined #ruby
alex__c2022 has joined #ruby
cableray has joined #ruby
<epochwolf>
shevy: I was actually asking for details on implementing but I'm too tired to think straight.
karasawa has quit [Ping timeout: 248 seconds]
karasawa has joined #ruby
<shevy>
these are just methods. DSL is nothing than a fancy name for specific methods in use. to access the do/end blocks, you can do: yield if block_given?
xnm has joined #ruby
<epochwolf>
shevy: did I mention I'm too tired to think?
mercwithamouth has quit [Ping timeout: 240 seconds]
rippa has quit [Ping timeout: 252 seconds]
stayarrr has joined #ruby
<xybre>
krainboltgreene: rake is being loaded twice
cakehero has joined #ruby
<krainboltgreene>
xybre: That's what I guessed, but is it internal to rake or did I do that accidentally?
mercwithamouth has joined #ruby
osaut has quit [Quit: osaut]
Veejay has joined #ruby
<xybre>
krainboltgreene: you, or one of your gems. Rake doesn't do that on its own.
<krainboltgreene>
When I use bundle exec it's fine. Hmm.
cibs has quit [*.net *.split]
ananthakumaran1 has joined #ruby
Inoperable has quit [Ping timeout: 248 seconds]
ddd has joined #ruby
b1lly has left #ruby [#ruby]
ananthakumaran has quit [Ping timeout: 248 seconds]
<xybre>
Then you might have a plugin in your gems you should uninstall (which isn't part of your bundle)
<xybre>
Also
Inoperable has joined #ruby
Inoperable has quit [Max SendQ exceeded]
<krainboltgreene>
I don't.
<xybre>
If you use rubygems-bundle you shouldn't need exec.
Inoperable has joined #ruby
Inoperable has quit [Max SendQ exceeded]
<xybre>
gem list --loca is identical to bundle exec gem list --local?
<xybre>
s/loca /local /g
Inoperable has joined #ruby
Inoperable has quit [Max SendQ exceeded]
<krainboltgreene>
The rvm gem is the only difference.
Inoperable has joined #ruby
Inoperable has quit [Max SendQ exceeded]
kiyoura has quit [Quit: Leaving]
Inoperable has joined #ruby
Inoperable has quit [Max SendQ exceeded]
<xybre>
Do you have a gemset for your project and a .rvmrc file?
Inoperable has joined #ruby
Inoperable has quit [Max SendQ exceeded]
tommyvyo has joined #ruby
<mdel>
ugh rvm... caused me so much grief
Inoperable has joined #ruby
sayan has quit [Read error: Connection reset by peer]
<mdel>
when I realized it was overriding `cd` I dropped it so fast
<krainboltgreene>
xybre: Yes and yes.
Axsuul has joined #ruby
guns has quit [Quit: guns]
osaut has joined #ruby
jenrzzz has joined #ruby
<xybre>
Huh. Might not be rvm's fault, but pretty weird. I'd check the global gemset, and if all else fails delete all the gems in global, default, and your current gemset and reinstall only in the current gemset and see what happens.
<krainboltgreene>
Fair enough, thanks.
<xybre>
mdel: I've looked at the alternatives, but the functionality is sound, and most of the alternatives don't really offer the same level of features.
<xybre>
Hopefully, version 2 will make mixups like this less likely.
brianpWins has joined #ruby
<mdel>
xybre: rbenv works well
<mdel>
i think it's a better option personally
<mdel>
especially on a server, where you want users to have a shared installation, separate gems, with the ability to override the active ruby if necessary
<xybre>
I understand wanting to avoid overwritting cd, but its nice to automatically switch gemsets for you. How do you do it with rbenv?
<mdel>
xybre: i dont
<mdel>
because bundler
<postmodern>
mdel, RVM is moving away from overriding cd, it uses PROMPT_COMMAND just like chruby
r0bby has joined #ruby
<mdel>
postmodern: good to know, I haven't followed dev at all
<mdel>
but still, unless im missing something, bundler solves the "gemset" problem
* mdel
may very well be missing something
<xybre>
I guess the problems is rubygems itself, without gemsets you end up with crazy conflicts and a load of gems you aren't sure if you need or not. I guess if you only have one or two projects its not a big deal though.
joeycarmello has joined #ruby
<mdel>
well when using bundler, your Gemfile defines the exact gems/versions your project needs
charliesome has joined #ruby
timonv has joined #ruby
<davidcelis>
xybre: bundler
<davidcelis>
gemsets are no longer necessary
<xybre>
Otherise you have to specify the individual versions of each gem in bundler, plus all their dependencies. Which is a serious downer.
<mdel>
and as long as you `bundle exec <something>` you will be fine
cobragoat has joined #ruby
<mdel>
xybre: i mean, isn't this more of a downer than maintaining a simple file of requirements?
<postmodern>
mdel, sort of, except bundler installs gems into your global gem home
etcetera has joined #ruby
<mdel>
i've never had a prblem with bundler at all
<postmodern>
mdel, sometimes i want to isolate gems to a directory (for one off contributions to big projects)
yacks has quit [Read error: Connection reset by peer]
<postmodern>
mdel, so i use chgems + bundler
<mdel>
postmodern: override GEM_HOME in that directory only?
toekutr has quit [Remote host closed the connection]
<mdel>
maybe that's what chgems does, haven't looked at that
<postmodern>
mdel, yep, also sets GEM_PATH and PATH
<mdel>
assuming you only have to use chgems when you want it, that sounds like a good option
<xybre>
I haven't had too many issues, when things look funny I jsut clean out my gems. If I had to specify all the gems we use and pin each version by hand.. I'd like something else to handle that for me. The Gemfile.lock is nice, but bundler will chock if two gems use different versions of a third gem, and then you get to resolve the conflict manaully anyway.
<postmodern>
mdel, yeah, i hate it when projects want to install a bunch of development dependencies that i never use
<postmodern>
mdel, keeps my gem home small
<mdel>
so chgems really isn't an alternative to rvm, but a different thing all togetehr
* mdel
still hasn't looked it up
<mdel>
but it seems like rbenv + chgems = best of all worlds
etcetera has quit [Client Quit]
<mdel>
anyway, bed for me... night folks
nomenkun has joined #ruby
quest88 has quit [Quit: quest88]
<xybre>
Nite mdel
jackyalcine_ has joined #ruby
mercwithamouth has quit [Ping timeout: 248 seconds]
tomzx_mac_ has quit [Ping timeout: 245 seconds]
<postmodern>
mdel, it uses the same PATH/GEM_HOME techniques from chruby, so it should work with rvm/rbenv
<postmodern>
mdel, chruby is an ultra-minimal alternative to rbenv
nomenkun has quit [Ping timeout: 245 seconds]
<postmodern>
mdel, if you just want to switch between Rubies, nothing else
arya has quit [Ping timeout: 248 seconds]
joeycarmello has quit [Remote host closed the connection]
Xeago has joined #ruby
r0bby has quit [Ping timeout: 248 seconds]
sayan has joined #ruby
arya has joined #ruby
Jacky has joined #ruby
Jacky has joined #ruby
Jacky has quit [Changing host]
lolmaus has joined #ruby
Xeago has quit [Remote host closed the connection]
jackyalcine_ has quit [Read error: Operation timed out]
slainer68 has joined #ruby
r0bby has joined #ruby
caleb_io has quit [Quit: caleb_io]
krainboltgreene has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
CrawfordComeaux has joined #ruby
<xybre>
postmodern: what does chgems do? Basically gemsets?
JumpMast3r has quit [Quit: JumpMast3r]
<postmodern>
xybre, basically, but uses $PWD/.gem/$ruby/$version
<postmodern>
xybre, so when your done with the project, just rm -rf it
<postmodern>
xybre, i often forgot about my rvm gemsets
<xybre>
Ahh, nice
<xybre>
Yeah same
robustus has quit [Ping timeout: 276 seconds]
<xybre>
It's sort of hacky but I end up imploding rvm once in a while to clean everything up :/
robustus has joined #ruby
slainer68 has quit [Ping timeout: 260 seconds]
timonv has quit [Remote host closed the connection]
<postmodern>
xybre, i have a very OCD setup
osaut has quit [Quit: osaut]
caleb_io has joined #ruby
timonv has joined #ruby
_adeponte has joined #ruby
<postmodern>
xybre, rubies are installed into /opt/rubies, source is kept in /usr/local/src, and i run gem clean
adeponte has quit [Read error: Connection reset by peer]
dmiller has joined #ruby
<postmodern>
xybre, an rm -rf the old Rubies
MattRB has quit [Quit: This computer has gone to sleep]
<xybre>
I'd rather have to implode rvm or uninstall all gems with a script once in a while than deal with running extra commands every time I want to do something.
<xybre>
chgem sounds kind of nice though. rbenv doesn't.
vlad_starkov has joined #ruby
bel3atar has joined #ruby
zommi has joined #ruby
dmiller has quit [Ping timeout: 252 seconds]
timonv has quit [Ping timeout: 252 seconds]
EPIK has quit [Ping timeout: 252 seconds]
pyro111 has joined #ruby
whowantstolivefo has joined #ruby
<shevy>
hmm I have methods like this:
<shevy>
def foo_do_this()
<shevy>
now I have a string, called "do_this"
<shevy>
what would be an elegant way to call the method "foo" + "do_this" ?
<shevy>
my current solution uses self.send
dnyy has quit [Remote host closed the connection]
<shevy>
but I dont feel too confident with that
bel3atar has quit [Ping timeout: 245 seconds]
Veejay has left #ruby ["WeeChat 0.3.0"]
<cirwin>
where does that string come from?
dnyy has joined #ruby
ChampS666 has joined #ruby
mdel has quit [Remote host closed the connection]
blaxter has joined #ruby
<shevy>
cirwin hmm. I read in those strings from .rb files from a directory, for instance: if I have files like lala.rb and lolo.rb, the strings are collected in array ["lala","lolo"]
jonahR has quit [Quit: jonahR]
<shevy>
those files each have one method only
<cirwin>
I see
<cirwin>
send seems fine to me
<shevy>
so lala.rb has a method called: action_read_file() (the lala.rb file is actually called read_file.rb :)
<shevy>
ok cirwin
dnyy has quit [Read error: No route to host]
<cirwin>
that's very similar to how ruby loads dynamic C libraries
TomyLobo has joined #ruby
jrhorn424 has quit [Quit: jrhorn424]
dnyy has joined #ruby
blacktulip has joined #ruby
mercwithamouth has joined #ruby
zigomir has joined #ruby
jrhorn424 has joined #ruby
jrhorn424 has quit [Client Quit]
cha1tanya has quit [Quit: Leaving]
cobragoat has quit [Remote host closed the connection]
mpfundstein has quit [Quit: Lost terminal]
yugui is now known as yugui_zzz
emergion has joined #ruby
Jacky has quit [Remote host closed the connection]
Jacky has joined #ruby
r0bby has quit [Ping timeout: 248 seconds]
mercwithamouth has quit [Ping timeout: 256 seconds]
mockra has quit [Remote host closed the connection]
r0bby has joined #ruby
mercwithamouth has joined #ruby
MattRB has joined #ruby
az7ar has quit [Quit: Leaving]
bigkevmcd has joined #ruby
Jacky has quit [Read error: Connection reset by peer]
cableray has quit [Ping timeout: 260 seconds]
aganov has joined #ruby
MattRB has quit [Client Quit]
tonini has joined #ruby
Jacky_ has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
mercwithamouth has quit [Ping timeout: 256 seconds]
jds has joined #ruby
chussenot has joined #ruby
dnyy has quit [Remote host closed the connection]
Jacky_ has quit [Ping timeout: 245 seconds]
Hanmac has joined #ruby
caleb_io has quit [Quit: caleb_io]
TheFuzzball has joined #ruby
guns has joined #ruby
clocKwize has joined #ruby
zph has joined #ruby
emergion has joined #ruby
filipe has joined #ruby
razibog has joined #ruby
gregorg has quit [Quit: Quitte]
emergion has quit [Client Quit]
mafolz has joined #ruby
emergion has joined #ruby
andrewhl has quit [Remote host closed the connection]
eldariof has joined #ruby
noyb has quit [Ping timeout: 248 seconds]
joschi has joined #ruby
cibs has joined #ruby
r0bby has quit [Ping timeout: 255 seconds]
osaut has joined #ruby
wallerdev has quit [Quit: wallerdev]
nomenkun has joined #ruby
karasawa has quit [Ping timeout: 240 seconds]
karasawa has joined #ruby
threecreepio has quit [Quit: threecreepio]
slainer68 has joined #ruby
arkiver has quit [Ping timeout: 245 seconds]
mockra has joined #ruby
sayan has quit [Ping timeout: 245 seconds]
hamed_r has joined #ruby
joeycarmello has joined #ruby
lkba has quit [Ping timeout: 255 seconds]
generalissimo has quit [Remote host closed the connection]
Axsuul has quit [Ping timeout: 240 seconds]
slainer68 has quit [Ping timeout: 252 seconds]
fteem has joined #ruby
nari has quit [Ping timeout: 260 seconds]
_adeponte has quit [Remote host closed the connection]
xpen has joined #ruby
timonv has joined #ruby
joeycarmello has quit [Ping timeout: 245 seconds]
agarie has joined #ruby
TomyLobo has quit [Quit: Standby mode...]
jgrevich has quit [Quit: jgrevich]
aloshkarev has joined #ruby
_br_ has quit [Excess Flood]
rakl has joined #ruby
jblack has quit [Ping timeout: 240 seconds]
io_syl has quit [Quit: Computer has gone to sleep.]
aloshkarev has quit [Client Quit]
_br_ has joined #ruby
mahmoudimus has quit [Remote host closed the connection]
main has quit [Ping timeout: 248 seconds]
_br_ has quit [Excess Flood]
mahmoudimus has joined #ruby
banisterfiend has quit [Remote host closed the connection]
banisterfiend has joined #ruby
agarie has quit [Remote host closed the connection]
mockra has quit [Ping timeout: 245 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
_br_ has joined #ruby
banisterfiend has joined #ruby
zph has quit [Quit: Computer has gone to sleep.]
_br_ has quit [Excess Flood]
r0bby has joined #ruby
jduan1981 has quit [Quit: jduan1981]
_br_ has joined #ruby
AwayLex is now known as Quadlex
piotr_ has joined #ruby
dwn has joined #ruby
dwn has quit [Write error: Broken pipe]
_br_ has quit [Excess Flood]
r0bby has quit [Ping timeout: 256 seconds]
sayan has joined #ruby
nomenkun_ has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
dwn has joined #ruby
elaptics`away is now known as elaptics
bel3atar has joined #ruby
_br_ has joined #ruby
cirwin has quit [Quit: Leaving.]
nomenkun has quit [Ping timeout: 252 seconds]
_br_ has quit [Excess Flood]
maxmanders has joined #ruby
cobragoat has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
_br_ has joined #ruby
maxmanders has quit [Client Quit]
hoelzro|away is now known as hoelzro
f03lipe has quit [Quit: Leaving]
_br_ has quit [Excess Flood]
cakehero has quit [Ping timeout: 248 seconds]
cobragoat has quit [Ping timeout: 260 seconds]
aaronmacy has joined #ruby
hoelzro is now known as hoelzro|away
guns has quit [Quit: guns]
_br_ has joined #ruby
a_a_g has quit [Read error: Connection reset by peer]
marr has joined #ruby
a_a_g has joined #ruby
dhruvasagar has joined #ruby
maxmanders has joined #ruby
ChampS666 has quit [Ping timeout: 252 seconds]
_br_ has quit [Excess Flood]
BizarreCake has joined #ruby
_br_ has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
Xeago has joined #ruby
dwu1 has quit [Quit: Leaving.]
RagingDave has joined #ruby
arya has quit [Ping timeout: 248 seconds]
gyre008 has joined #ruby
_br_ has quit [Excess Flood]
sporkbomb has quit [Read error: Connection reset by peer]
sporkbomb has joined #ruby
malte__ has joined #ruby
noyb has joined #ruby
arya has joined #ruby
jimeh has joined #ruby
serhart has quit [Quit: Leaving.]
malte_ has quit [Read error: Operation timed out]
malte__ is now known as malte_
_br_ has joined #ruby
_br_ has quit [Excess Flood]
arya_ has joined #ruby
timonv has quit [Read error: Connection reset by peer]
mikecmpbll has joined #ruby
timonv_ has joined #ruby
arya has quit [Ping timeout: 248 seconds]
love_color_text has quit [Remote host closed the connection]
Dakuan has quit [Remote host closed the connection]
gyre007 has joined #ruby
kinmor06 has joined #ruby
nkr has joined #ruby
timmow has joined #ruby
arya has joined #ruby
emocakes has joined #ruby
jds_ has joined #ruby
kinmor06 has quit [Quit: Leaving]
kinmor06 has joined #ruby
arya has quit [Ping timeout: 256 seconds]
arietis has joined #ruby
jinzhu has quit [Ping timeout: 248 seconds]
CrawfordComeaux has quit [Ping timeout: 256 seconds]
arya has joined #ruby
jds_ has quit [Ping timeout: 240 seconds]
mockra has joined #ruby
fyolnish has quit [Ping timeout: 244 seconds]
plantseeker has joined #ruby
niklasb has joined #ruby
jwang has quit [Quit: Leaving]
Raboo has joined #ruby
nkr has quit [Ping timeout: 248 seconds]
aaronmacy has quit [Quit: Leaving.]
lkba has joined #ruby
Raboo_ has quit [Ping timeout: 256 seconds]
mockra has quit [Ping timeout: 260 seconds]
hotovson_ has joined #ruby
patrikf has joined #ruby
eykosioux_ has joined #ruby
haxrbyte_ has joined #ruby
arietis has quit [Quit: Computer has gone to sleep.]
Raboo has quit [Ping timeout: 252 seconds]
<jokke>
hi! Does Hash have a function to find the biggest/smallest value?
Raboo has joined #ruby
<jokke>
heftig: oh, you're here too? :)
haxrbyt__ has joined #ruby
<patrikf>
I'd like to catch signals in my program and act on them, synchronously. now as far as I can see, I have three options: 1) use trap and throw/catch; 2) use trap and raise/rescue with custom exception classes; 3) use raise/rescue on SignalException and check for the signal name/number. this all seems pretty clumsy, isn't there a more elegant way to do this?
RagingDave has quit [Quit: Ex-Chat]
<heftig>
jokke: min/max by value
noxoc has joined #ruby
<patrikf>
jokke: you can use h.values.max, but that will iterate all the values => O(n), but it would be easy to sublass Hash to do that in O(1)
<heftig>
jokke: ah, no, hang on, it just converts the hash into an array of arrays and gets you the min/max of that
haxrbyte has quit [Ping timeout: 252 seconds]
<JonnieCache>
with a binary search or something?
<patrikf>
binary search somehow contradicts the structure of a hashtable
<heftig>
patrikf: subclass and do what?
haxrbyte_ has quit [Ping timeout: 248 seconds]
<JonnieCache>
patrikf: i meant binary search the list of values
<workmad3>
JonnieCache: you'd need to sort that list first
<patrikf>
JonnieCache: how would binary search work on unsorted lists?
<patrikf>
(besides, once it is sorted, you don't need binary search...)
<workmad3>
heh :)
<patrikf>
heftig: keep track of the current min/max in a variable... but that will only work if you don't ever remove items
<patrikf>
on every insert = assignment, i mean
<jokke>
patrikf: how on earth would it be able to sort anything in O(1)?
<heftig>
jokke: hash.max_by(&:last), hash.min_by(&:last), and hash.minmax_by(&:last)
matthias_ has joined #ruby
stigmux is now known as oles
<workmad3>
jokke: he means an amortised O(1) because the calculation of min/max is done on hash assignment
Azure has quit [Ping timeout: 272 seconds]
<JonnieCache>
youre right of course
<JonnieCache>
its too early on monday for me to be thinking about data structures
haxrbyte has joined #ruby
<jokke>
okay you lost me :)
tonini has quit [Remote host closed the connection]
<jokke>
heftig: so your suggestion works faster than hash.values.max/min?
nkts has joined #ruby
<workmad3>
jokke: on assignment, you track if the new value is > current max or < current min, and keep track of the max/min of the hash
<jokke>
oh okay
<heftig>
jokke: basically the same, but gets you a key-value pair
<jokke>
makes sens
<jokke>
e
<workmad3>
jokke: so hsh.max and hsh.min become O(1) lookups, because the cost of calculating the actual value was amortised into the assignment
<jokke>
i get it now thanks
<workmad3>
:)
<jokke>
hm
karasawa has quit [Ping timeout: 257 seconds]
<jokke>
might be worth it
<workmad3>
it is problematic wrt to deletions, if they occur though
<heftig>
it does a schwartzian transform, which is probably more expensive. it's not a bigger O, though
nomenkun has joined #ruby
nomenkun_ has quit [Read error: Connection reset by peer]
<jokke>
workmad3: no deletions
haxrbyt__ has quit [Ping timeout: 252 seconds]
<workmad3>
it's also only going to give you a min/max within a single (or preset range of) comparators
<workmad3>
if you need to be able to specify an arbitrary comparator, you're going to need to do more work
<jokke>
nah
<jokke>
just integers
Elhu has joined #ruby
<workmad3>
right, nice and easy then :)
<jokke>
i'm starting to love ruby
<workmad3>
hmmm
<patrikf>
the question really is, do you fill the hash map, then need min/max once, or do you need min/max multiple times, possibly with insertions in-between
<jokke>
it's my first "project". I'm writing a cache simulator
* workmad3
wonders if a sort of an array of integers in ruby does a bucket sort, or if you'd need to do that manually
karasawa has joined #ruby
<jokke>
patrikf: i'm filling the hash map gradually and use max multiple times
<jokke>
s/map//
<patrikf>
right. well if you're the one inserting into the hash, then you might just keep track of the max there, without subclassing
<jokke>
mh true
<jokke>
it looks cleaner though if i subclass it
<jokke>
won't have as many variables
<workmad3>
I usually don't suggest subclassing hash or array... I've seen oddities from doing so
<patrikf>
(or just use .values.max if the hash isn't huge and you don't need every millisecond :))
<jokke>
i just realized i just need the max once
<workmad3>
hehe
<jokke>
so i'll stick with hash.values.max
<workmad3>
sounds good :)
pcarrier has quit []
<jokke>
stupid question i know... but how do i add a key value pair to an existing hash?
<kinmor06>
hash.merge!({:k=> v})
<workmad3>
kinmor06: haha
<hoelzro>
or hash[:k] = v
<workmad3>
^^
<jokke>
nice
<jokke>
thaks
<jokke>
*thanks
cha1tanya has quit [Quit: Leaving]
<kinmor06>
@workmad3 : yup haha
iml has quit [Remote host closed the connection]
<kinmor06>
quick question, any good books for advanced ruby topics?
<tobiasvl>
hmm, why doesn't Hash have << ?
<hoelzro>
tobiasvl: because it's not appending?
<hoelzro>
what would h << something mean?
* hoelzro
is biased and hates the << syntax
haxrbyte has quit [Ping timeout: 244 seconds]
<workmad3>
:)
matthias_ has quit [Remote host closed the connection]
Morkel has joined #ruby
<tobiasvl>
it would mean "shovel this into h", like everywhere else ;)
eykosioux_ has quit [Read error: Connection reset by peer]
<tobiasvl>
(it's not really an append operator any longer, is it)
<hoelzro>
tobiasvl: so if I do h << something, does something become a key? a value? both?
<tobiasvl>
ALL OF TIME AND SPACE AND THE SPACE OUTSIDE OF SPACE WHERE DOES IT END
<workmad3>
whowantstolivefo: try reading the description fully ;)
<whowantstolivefo>
workmad3: i didnt figure out this part >>> Here's another handy trick. When you call something like .capitalize on a string, you're not capitalizing that exact string; Ruby makes a copy of the string, capitalizes that, and that's what it returns. If you want to capitalize the string you've already got, though, you can make one small change: add a ! to the end of the method name. .capitalize! capitalizes the string in-place instead of making a copy. The
<whowantstolivefo>
original non-capitalized string is gone forever, but now you have your shiny new capitalized one in its place. <<<<
<jokke>
tobiasvl: it ends with the first gif i pasted.. :)
<workmad3>
whowantstolivefo: well, that pretty much explains what happens
<workmad3>
whowantstolivefo: and I was meaning that you should go back and re-read what you're being asked to do
xpen has quit [Remote host closed the connection]
ExxKA has joined #ruby
arya has quit [Ping timeout: 252 seconds]
rakl has quit [Quit: sleeping]
<whowantstolivefo>
workmad3: ok i will read more and try to understand, if i cant fix, i'll keep disturbing you
<jokke>
um.. array.max gives me the highest value in an array, but how can i determine the index of the highest value?
<jokke>
as in the first index
samuel02 has quit [Remote host closed the connection]
<jokke>
for example: [3, 2, 5, 1].somemaxindexfunction would return 2
<jokke>
and [3, 2, 5, 5, 1] also
<kinmor06>
arr.index(arr.max)
<jokke>
ah ok
<jokke>
thanks
mneorr has quit [Remote host closed the connection]
<jokke>
bear with me, i'm a complete ruby noob. :/
samphippen has joined #ruby
<kinmor06>
bear with me also. i don't read sentences properly now haha
<heftig>
jokke: that does a linear search for the max value
<jokke>
heftig: yeah. but i only do it once
arya has joined #ruby
nkr has joined #ruby
Su-Shee has left #ruby [#ruby]
jinzhu has joined #ruby
mockra has joined #ruby
<kinmor06>
question, suppose i have a paragraph and I want to get the list of words and number times it existed in that paragraph. what's the best way to do it?
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
<kinmor06>
don't want to do multiple loops
<jokke>
hmm.. i get "possibly useless use of + in void context..
<jokke>
s/../"../
<kinmor06>
i got string.split.each{|h| hash[h] = string.split.count(h) }
<jokke>
in this line: hash["age"] = 0
<kinmor06>
but i think there's a cleaner way
mockra has quit [Ping timeout: 260 seconds]
<jokke>
and void value expression in another line
<jokke>
there's only end
<tobiasvl>
jokke: why are you using a string as a key? better to use a symbol
beiter has quit [Quit: beiter]
atno has joined #ruby
<jokke>
tobiasvl: oh, you're right
<jokke>
:age, right?
BulleTime has joined #ruby
<heftig>
kinmor06: "foo bar baz qux bar baz foo".split.group_by { |x| x }.map { |k,v| [k,v.count] }
<Muz>
There's something to be said about readability at this point.
slainer68 has quit [Remote host closed the connection]
<az7ar>
can anyone please suggest how I can do things like this -> 20! and the result would be 40
<tobiasvl>
?
<Spooner>
az7ar, Why would the result be 40?
<az7ar>
no reason just for experiment
<az7ar>
like get factorial 5 using 5!
<tobiasvl>
az7ar: how on earth can we tell you how to make that without you describing what it is
bel3atar has joined #ruby
<tobiasvl>
well the factorial of 20 isn't 40
warb0 has joined #ruby
uris has joined #ruby
mockra has joined #ruby
<Spooner>
az7ar, Simple answer is that you can't in Ruby. You can do 5.factorial, since numbers are objects, but you can't just add syntax willy nilly!
jenrzzz has quit [Ping timeout: 245 seconds]
eka108 has quit [Remote host closed the connection]
<az7ar>
Spooner, thnx, I did 5.factorial and was searching if that could be done
matthias_ has joined #ruby
<az7ar>
or !5 #=> 120 .. no luck with 5!
<az7ar>
I could do !5
pcarrier has joined #ruby
pcarrier has quit [Client Quit]
<Spooner>
Yes, but then you are fundamentally changing expected behaviour, not adding new.
pcarrier has joined #ruby
mockra has quit [Ping timeout: 248 seconds]
<az7ar>
Spooner, yeah I know, just playing around
jeffreybaird has joined #ruby
Azure has joined #ruby
haxrbyte has joined #ruby
<Hanmac>
az7ar do you know the difference between "-5" and "- 5" ?
<az7ar>
yes
<az7ar>
I think I do
<clocKwize>
guys, anyone know how to print messages to the console after my gem has been bundled
pcarrier has quit [Ping timeout: 246 seconds]
<az7ar>
or I guess I dont, because I can change the -5 behavior but I dont know how to change "- 5"
<Hanmac>
otherwise, you can change - 5 but you cant change -5
elkclone has quit [Quit: It's never too late to unplug and run.]
<banisterfiend>
you should just use it for what it evaluates to
<hoelzro>
and if you're using JSON, you should probably just use a JSON serializer
<JonnieCache>
yaaaaaawn
Dakuan has quit [Remote host closed the connection]
Dakuan has joined #ruby
Dakuan has quit [Read error: Connection reset by peer]
atno has quit [Remote host closed the connection]
<jeffsmykil>
I'm creating json
Dakuan has joined #ruby
Criztian has quit [Ping timeout: 240 seconds]
BulleTime has joined #ruby
spacemud has joined #ruby
<jeffsmykil>
hoelzro: if there is a better way to do this I'm all ears, basically I use ruby to create dummy json objects so i can code the front end before the back end is done
Takehiro has quit [Remote host closed the connection]
<hoelzro>
jeffsmykil: well, I would just use the json library
<pyro111>
in general i want to get two pages of site and delete all trash sto extract informative part
<Hanmac>
hoelzro: there is an app i mean a function for that :P Regexp.union(stringa,stringb)
<hoelzro>
Hanmac: ah, neat!
<hoelzro>
Hanmac++
_br_ has joined #ruby
<jokke>
okay.. i'm really having some serious trouble with my script, and i have no idea what the problem might be.. I'd be really happy if someone could help me out:
spider-mario has joined #ruby
<jokke>
I'm trying to write a cache simulator in ruby
<Hanmac>
lupine yeah but it is usefull when you want to asign it to a variable
drago757 has joined #ruby
_br_ has joined #ruby
coder_neo has quit [Quit: Leaving]
ttt has quit [Remote host closed the connection]
ExxKA has joined #ruby
_br_ has quit [Excess Flood]
pkrnj has joined #ruby
ejnahc has quit [Quit: leaving]
_br_ has joined #ruby
ejnahc has joined #ruby
davidcel- has quit [Ping timeout: 276 seconds]
breakingthings has quit []
Playground has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
arya has joined #ruby
miskander has joined #ruby
huoxito has joined #ruby
_br_ has quit [Excess Flood]
rippa has joined #ruby
cjs226 has joined #ruby
philcrissman has joined #ruby
maxmanders has joined #ruby
ViPi has joined #ruby
arkiver has quit [Ping timeout: 256 seconds]
maxmanders has quit [Client Quit]
_br_ has joined #ruby
daniel_- has joined #ruby
daniel_- has quit [Changing host]
daniel_- has joined #ruby
<ohdae>
hey all. I am creating a bigger Ruby project and need some help with the whole Modules vs Classes
Goles has joined #ruby
<ohdae>
my main script is a pseudo-console app, which will be calling all the functions from various scripts inside of project/lib
<ohdae>
like project/lib/core.rb, project/lib/database.rb, etc
MissionCritical has quit [Ping timeout: 276 seconds]
atno has quit [Remote host closed the connection]
<ohdae>
What is the best way to handle that really? for each lib/script. Should I make each file in lib a big class with the functions inside. then require 'core'; Core.do_stuff(blah), etc
<ohdae>
or does that need to be done with Module name; Class namehere
mmitchell has joined #ruby
_br_ has quit [Excess Flood]
_br_ has joined #ruby
<Spooner>
ohdae, Just use a module if you want a namespace for your methods. Class when you want to instantiate something.
<ohdae>
I'm trying to look at some other projects to get an idea of the general layout
<ohdae>
Spooner: okay, that's kind of what I figured
spider-mario has quit [Remote host closed the connection]
freeayu has quit [Remote host closed the connection]
banisterfiend has joined #ruby
jinzhu has quit [Ping timeout: 255 seconds]
wallerdev has joined #ruby
<ohdae>
If I create lib/core.rb and make say Class Core; def status_msg(msg). from my main script in the base dir, I can just do require 'core' then Core.status_msg('output') for example?
<ohdae>
assuming I add something like this require File.expand_path("#{File.dirname __FILE__}/lib/core")
<Spooner>
No, you would need to do Core.new.status_msg since you are adding the method on the instance, not the class.
<ohdae>
ohh okay
joshcheek has joined #ruby
<Spooner>
ohdae, You can use require_relative if you are on Ruby 1.9 (which you should be) to make that easier. Alternatively you would add the root dir to $LOAD_PATH so it could be found with require.
failshell has joined #ruby
<ohdae>
is there a way to import a library like that, where I could just run functions from the lib/script's like Script.function?
<ohdae>
i'm not familair with require_relative, I'll have to check it out
reinaldob has joined #ruby
maxmanders has joined #ruby
<ohdae>
yeah I'm on 1.9 heh I'm more of a Python guy really but started getting into Ruby lately and I just force myself to write bigger projects so I learn :x
Hanmac has quit [Ping timeout: 245 seconds]
spider-mario has joined #ruby
_br_ has quit [Excess Flood]
<Spooner>
ohdae, But as I said, if you just want a namespace for some "functions" then use a module, not a class and do module Foo; def self.status_msg; end; end and then you can just Foo.status_msg
Dakuan has quit []
generalissimo has joined #ruby
<ohdae>
Ahh okay, I get it now I think
Dakuan has joined #ruby
<Spooner>
Not sure what you mean by importing like that. Does that map directly to a Python use of import?
joshcheek has quit [Client Quit]
<ohdae>
I see alot of projects, like the cmd line runner gem 'Cocaine', where the Module name for each script is called 'Cocaine' but it's the class name that differs
<ohdae>
Spooner: yeah that's what i meant. not sure if it's the right term w/ Ruby
maxmanders has quit [Client Quit]
<ohdae>
I consider 'import' in Python and 'require' in Ruby to be the same idea really
<hoelzro>
although they provide similar functionality, they're quite different
baroquebobcat has joined #ruby
<Spooner>
Not really, since require just "pastes the code in", without doign anything with namespacing, unlike Python import. You have to maually add a module around your code in the file to give it a namespace like that.
<ohdae>
hoelzro: really? I wasn't aware. I know that Ruby has 'require' and then 'include' for example but I'm not really sure the big diference
<ohdae>
difference*
interactionjaxsn has joined #ruby
<ohdae>
Spooner: ahhh okay, that makes more sense
<Spooner>
ohdae, Ruby include Core is like Python import Core.* - it adds everything in Core into the global namespace.
<Spooner>
(actually, into the current namespace, such as a class, but in this case it is the global one).
Mission-Critical has joined #ruby
<ohdae>
so say I have console.rb in my apps main path, then lib/database.rb. inside database.rb, I'd make a module called 'Database' with various functions inside. then require that into console.rb and I could call any function from database.rb using Database.function()
_br_ has joined #ruby
<Spooner>
Or rather, require 'core'; include Core is like Python import core.*
<hoelzro>
ohdae: require brings things into the global namespace, import brings things into the module's namespace under a given name
<ohdae>
hrm ruby is confusing heh :p
<ohdae>
okay that makes sense
malcolmva has quit [Read error: Connection reset by peer]
malcolmva has joined #ruby
_br_ has quit [Excess Flood]
<ohdae>
You guys are all alot nicer than the people in #python too, btw heh
Kuifje has joined #ruby
jrist has quit [Ping timeout: 244 seconds]
<Spooner>
ohdae, You don't have a separate namespace for every file like you would in Python. You would generally have a single namespace (module) for the whole application or gem library.
<Spooner>
Where every file would be wrapped in "module MyApp; ...; end".
_br_ has joined #ruby
jaequery has quit [Quit: Computer has gone to sleep.]
<ohdae>
gotcha. and then the various classes inside of the single module within each file
<Spooner>
Yes, usually one class per file, each in the common namespace module.
<ohdae>
database.rb could be say module MyApp; class Database; def functions; end; end; end
<ohdae>
okay cool
<Spooner>
Yep.
<ohdae>
all right awesome. I've been trying to wrap my head around that for a good 24 hours now
<ohdae>
i appreciate the help
bean has joined #ruby
_br_ has quit [Excess Flood]
sailias has joined #ruby
<Spooner>
ohdae, Shame about #python though. I need to learn it myself :D
miskander has quit [Quit: miskander]
<Spooner>
Which is why I semi-understand your confusion about namespace differences because I have had it the other way around!
CrawfordComeaux has joined #ruby
<hoelzro>
python's a pretty nice language
<ohdae>
and one last thing heh calling the functions from within the module MyApp and a class of 'Database' inside of that (in database.rb), i'd require the lib and call 'MyApp.Database.function()' ?
arya has quit [Ping timeout: 245 seconds]
<ohdae>
i hate the whitespace but i do like python alot
<hoelzro>
I definitely like its module system
Goles has quit [Quit: Out.]
fyolnish has quit [Remote host closed the connection]
<Spooner>
No, db = MyApp::Database; db.function
<ohdae>
ruby is nice though,there are so many ways to do the same thing and it's almost like 'guess what you want to do and type it' heh each_do, each_key, blah blah
fyolnish has joined #ruby
<ohdae>
ahhh all right. perfect
eykosioux has joined #ruby
clocKwize has joined #ruby
iamjarvo has quit [Quit: Leaving.]
<Spooner>
Sorry, I mean: db = MyApp::Database.new; db.function
<ohdae>
okay great. now I got it
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<ohdae>
what would you use, include MyApp::Database for? is that the same kind of idea?
<Spooner>
MyApp::Database.new() is like myapp.database()
Mission-Critical is now known as MissionCritical
<Spooner>
You might include MyApp, so you could just do db = Database.new without needing MyApp::
jaequery has joined #ruby
<ohdae>
cool
<Spooner>
You can't include a class. Only a module.
TIBS02 has quit [Ping timeout: 248 seconds]
<ohdae>
ah hrmm
_br_ has joined #ruby
blaxter has joined #ruby
RagingDave has joined #ruby
mdelcx has joined #ruby
_br_ has quit [Excess Flood]
pu22l3r has joined #ruby
<ohdae>
I wrote a decent bit of this article of Ruby http://www.blackhatlibrary.net/Ruby, mostly so I could learn as I went. Writing to explain to other people helps me to learn
mdelcx has quit [Client Quit]
_br_- has joined #ruby
_br_- is now known as _br_
<ohdae>
but some stuff like the whole class vs module, include vs require, I kind of just skipped right over heh
Bry8Star has quit [Ping timeout: 276 seconds]
<ohdae>
article on*
horofox has joined #ruby
jrist has joined #ruby
fyolnish has quit [Ping timeout: 256 seconds]
<Spooner>
ohdae, #puts "Hello world\n" - puts includes a newline+flush. #print doesn't.
a_a_g has joined #ruby
daniel_- has quit [Ping timeout: 260 seconds]
dnyy has joined #ruby
arya has joined #ruby
<Spooner>
ohdae, Class variables are pretty much not used any more, so shouldn't be encouraged.
<tobiasvl>
Spooner: huh, i didn't know that. why aren't they used?
zommi has quit [Quit: Leaving.]
mgrayson has joined #ruby
gyre007 has quit [Ping timeout: 245 seconds]
dnyy has quit [Remote host closed the connection]
mockra has joined #ruby
<Spooner>
tobiasvl, We generally use "class instance variables" now. @@vars are filled with unpleasant magic behaviour ;)
<Spooner>
ohdae, They still exist and probably always will though :D
<ohdae>
heh
tagrudev has quit [Read error: Connection reset by peer]
jaequery has quit [Quit: Computer has gone to sleep.]
<ohdae>
So say you have @foo = 'bar' outside of your class or module, it would be shared through all classes and functions inside that script
<ohdae>
or where does @@foo = 'bar' come in to play? how would that differ really?
<ericwood>
@@foo is shared between all instances of its containing class
<ohdae>
I mean even if you do @foo = 'bar' inside a function, inside a class, it's still available through-out the entire class, right?
<shevy>
awww class vars :(
<ericwood>
similar to "static" if you come from a C/C++ background
<shevy>
ohdae @foo is not @@foo
<Spooner>
@@foo exists on the class, @foo exists on the instance. A class instance variable exists on the class, being treated as an instance of Class ;)
<ohdae>
ericwood: that's a language i can speak heh
mockra has quit [Ping timeout: 256 seconds]
timonv_ has joined #ruby
<shevy>
@@foo is awful, @foo is cool
Criztian has quit [Ping timeout: 252 seconds]
timonv has quit [Read error: Connection reset by peer]
<ericwood>
@@foo is fine when used correctly
<shevy>
@@foo can never be used correctly
<banisterfiend>
ericwood: can u tell me a legitmate use, just curious
<ericwood>
like when you want to pretend you're writing JS and messing with prototypes :D
<banisterfiend>
ohdae: can you gist instead? :)
<banisterfiend>
ohdae: gist.github.com
<Spooner>
There are times when @@ is fine, but using it just encourages other people to use it and get into a mess :D
<ohdae>
sure heh
_br_ has quit [Excess Flood]
Xeago has left #ruby [#ruby]
Xeago has joined #ruby
<ericwood>
the only real legit use is if you wanted to update a parameter for all instances of an object...I could see that being useful, although I've never needed it
<ohdae>
ah github is so slow for me today
maxmanders has joined #ruby
<ohdae>
maybe it's my internet, i'm at a starbucks atm heh
<raz>
google image search gets more horrible every time i use irt
<ohdae>
in that case^, I don't see a difference between @@ and @
<ericwood>
ohdae: the @foo won't be accessible from within the class
<ohdae>
really?
<ohdae>
hrm
<ericwood>
@@bar is only in the context of the class
gyre007 has quit [Ping timeout: 245 seconds]
<ericwood>
scoping
<ohdae>
i was not aware of that. i assumed that @foo would be accessible since it was outside of everything, used @ and acted as a sort of global (not really) just for that script
<ericwood>
no, @ is just an instance variable
<ohdae>
okay hrm. i was way off there heh
<shevy>
ohdae within the class
maxmanders has quit [Client Quit]
Criztian has joined #ruby
<ericwood>
so @ is accessible anywhere within the class
daniel_- has joined #ruby
_br_ has joined #ruby
<shevy>
ohdae if you want to make an @ivar accessible to the outside world, you can write a method that returns it, or use attr_reader :foo which is even shorter
<ohdae>
okay. i always wondered about the attr_*'s
<shevy>
ohdae you should want to put it into a method usually
<shevy>
ah
<shevy>
you don't have a class in your script
<ohdae>
or in that same script, the first function I create @info and use it through-out the functions..
filipe has quit [Ping timeout: 248 seconds]
<ohdae>
shevy: so am i kind of defeating the purpose by *not* using a class when I use @'s?
_br_ has quit [Excess Flood]
<shevy>
you can use them
<Spooner>
ohdae, You are placing the @ivar on an object, but one which is available everywhere. You really should use $global in this case since it is more what you are actually doing.
<shevy>
in a module too, outside class and modules too
<shevy>
ohdae but usually it is better to put it into a class
<banisterfiend>
Spooner: @base is nto available everywhere, it's just available on main ;)
Neomex has joined #ruby
<Spooner>
banisterfiend, Everywhere in that script :D
<banisterfiend>
sure
<ohdae>
heh
<Spooner>
ohdae, And USAGE/DESC should be constants, since they are.
<ohdae>
yeah it's probably very poor code so i apologize in advance :p
<shevy>
ohdae ruby classes have an initializer method, called initialize(), which gets called when one does call .new (indirectly I think... it first calls allocate, or something, then initialize. no idea)
EPIK has joined #ruby
fyolnish has joined #ruby
maxmanders has joined #ruby
<ohdae>
shevy: i noticed that. i see alot of people's code that has def initialize within a given class. i assumed it was just some common naming convention
<shevy>
it is often much easier to follow the logic in a class, as opposed to free-form no-classes-anywhere-code
_nitti has joined #ruby
luisalima has joined #ruby
<shevy>
I am not even sure where your code starts :P
jaequery has joined #ruby
gyre007 has joined #ruby
<ohdae>
hehe
<Spooner>
shevy, MyClass.new(*args) allocates the object then calls initialize(*args) on it
_br_ has joined #ruby
<spider-mario>
regarding style: are brackets in method definitions generally used when there are parameters?
<ohdae>
shevy: if ARGV[0] == nil is really the start of the flow
<spider-mario>
i.e. which is more common between: def initialize(a, b, c) and def initialize a, b, c
<ohdae>
i need to learn proper command line option parsing too :x
<Spooner>
spider-mario, In method defs yes, in calls, generally not.
jimeh has quit [Quit: Computer has gone to sleep.]
baroquebobcat has quit [Quit: baroquebobcat]
a_a_g has quit [Read error: Connection reset by peer]
_br_ has quit [Excess Flood]
skaczor has joined #ruby
timonv has joined #ruby
a_a_g has joined #ruby
timonv_ has quit [Read error: Connection reset by peer]
nkr has joined #ruby
sea_wolf has quit [Quit: leaving]
_br_ has joined #ruby
filipe has joined #ruby
<ohdae>
yeah i was looking at trollop. optparse looks like of messy
filemon_CZ has quit [Remote host closed the connection]
<ohdae>
bah i was trying to get an irb session inside my SublimeText console, tried to use the python interpreter inside ST to spawn a bash pty, then spawn irb
<ohdae>
it didnt like that lol
<Spooner>
ohdae, Try pry instead of irb. Much better.
bdnelson has joined #ruby
recycle has joined #ruby
_br_ has quit [Excess Flood]
eka has joined #ruby
interactionjaxsn has quit [Remote host closed the connection]
osaut has quit [Ping timeout: 240 seconds]
benlieb has joined #ruby
_br_ has joined #ruby
recycle has quit [Read error: Connection reset by peer]
<ohdae>
it auto-suggests almost everything for you as you type. variables, functions, libraries, etc. even documentation for some of the libraries and functions.
<ohdae>
that for ruby would be <33
iamjarvo has quit [Ping timeout: 260 seconds]
_br_ has quit [Excess Flood]
bcx has joined #ruby
Zolo has quit [Remote host closed the connection]
<hoelzro>
pry does support tab completion
ttt has quit [Ping timeout: 276 seconds]
<matti>
Quick question: what would be the best way to interrupt DialTimeout waiting for goroutie to expire its timeout?
<matti>
Ops.
<matti>
Wrong channel.
recycle has joined #ruby
apeiros_ has quit [Remote host closed the connection]
dmiller has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
ddv has joined #ruby
<Spooner>
ohdae, Pry also gives docs with show-doc
Virunga has quit [Remote host closed the connection]
_br_ has joined #ruby
inokenty has joined #ruby
inokenty has quit [Max SendQ exceeded]
mikepack has joined #ruby
inokenty has joined #ruby
<Spooner>
ohdae, It doesn't auto-complete quite like that, but feel free to bug banisterfiend to add that.
dr_neek has quit [Quit: dr_neek]
Zolo_ has joined #ruby
cobragoat has joined #ruby
kiyoura has joined #ruby
_br_ has quit [Excess Flood]
<banisterfiend>
ohdae: that's just front-end stuff
<banisterfiend>
ohdae: it's possible to write a front-end for pry that does that
angusiguess has joined #ruby
<banisterfiend>
ohdae: i liked bpython's front-end, but i was unimpressed by its functionality, it doesn't do a lot ;)
<Spooner>
banisterfiend, Possible and "already done" are two different things.
failshell has quit [Ping timeout: 245 seconds]
<Xeago>
banisterfiend: I also vote for auto complete show-doc
drago757 has quit [Quit: drago757]
<Spooner>
banisterfiend, I vote for free pie for all!
mercwithamouth has joined #ruby
Monie has joined #ruby
main has quit [Ping timeout: 256 seconds]
sclarson_ has joined #ruby
interactionjaxsn has joined #ruby
miskander has joined #ruby
filipe has joined #ruby
_br_ has joined #ruby
jaequery has quit [Quit: Computer has gone to sleep.]
mark_locklear has joined #ruby
DaltonUS has joined #ruby
<banisterfiend>
Xeago: what is "auto complete show-doc" ?
horofox has quit [Remote host closed the connection]
failshell has joined #ruby
interactionjaxsn has quit [Remote host closed the connection]
_br_ has quit [Excess Flood]
<Xeago>
nvm
Umren has joined #ruby
r4um has joined #ruby
<banisterfiend>
Xeago: you mean it shows docs for a method as soon as you type its name?
_br_- has joined #ruby
invisime has left #ruby [#ruby]
horofox has joined #ruby
ananthakumaran has joined #ruby
mercwithamouth has quit [Ping timeout: 256 seconds]
Virunga has joined #ruby
interactionjaxsn has joined #ruby
_br_- has quit [Excess Flood]
_br_ has joined #ruby
Kakera has quit [Ping timeout: 248 seconds]
wchun has quit [Read error: Connection reset by peer]
BizarreCake has quit [Remote host closed the connection]
ner0x has joined #ruby
_br_ has joined #ruby
Kakera has joined #ruby
katherinem13 has quit [Quit: leaving]
blaxter has quit [Ping timeout: 246 seconds]
katherinem13 has joined #ruby
tPl0ch has quit [Quit: Verlassend]
yoshie902a has joined #ruby
telli has joined #ruby
drago757 has joined #ruby
_br_ has quit [Excess Flood]
slainer6_ has joined #ruby
breakingthings has joined #ruby
io_syl has joined #ruby
cr3 has joined #ruby
_br_ has joined #ruby
proj has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
gyre007 has joined #ruby
<GeekOnCoffee>
hoelzro: you doing ruby full time in Milwaukee?
<hoelzro>
GeekOnCoffee: no, I actually live in Amsterdam
dmiller has quit [Ping timeout: 248 seconds]
slainer68 has quit [Ping timeout: 260 seconds]
<hoelzro>
I moved here for work almost a year ago
beneggett has joined #ruby
<GeekOnCoffee>
oh okay :)
<hoelzro>
doing Ruby when I move back would be nice, though!
<GeekOnCoffee>
it's on my list to visit, we have a friend just moved to Utrecht to work for 2 years
maxmanders has quit [Quit: Computer has gone to sleep.]
pyro111 has quit [Quit: Leaving]
_br_ has quit [Excess Flood]
jeffreybaird has joined #ruby
osaut has joined #ruby
horofox has quit [Read error: Connection reset by peer]
dormiens has joined #ruby
darkc0met has joined #ruby
BulleTime has quit [Ping timeout: 252 seconds]
jxf has quit [Ping timeout: 245 seconds]
adeponte has joined #ruby
slainer68 has joined #ruby
horofox has joined #ruby
<hoelzro>
oh man, Utrecht is great
<banisterfiend>
hoelzro: have you been to leiden?
_br_ has joined #ruby
<hoelzro>
banisterfiend: not yet
blazes816 has joined #ruby
slainer6_ has quit [Ping timeout: 245 seconds]
<banisterfiend>
hoelzro: ah, cute little town, really nice
quest88 has joined #ruby
alvaro_o has joined #ruby
<hoelzro>
banisterfiend: there seem to be a lot of those in the Netherlands =)
<banisterfiend>
true
_br_ has quit [Excess Flood]
_br_ has joined #ruby
etcetera has joined #ruby
wchun has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
<JonnieCache>
concurrency what a pain in the arse
banisterfiend has joined #ruby
<JonnieCache>
i should have used eventmachine from the word go. or maybe i should just give up on concurrency
<JonnieCache>
its not like its going to make it actually go any fater
<JonnieCache>
faster
carloslopes has quit [Remote host closed the connection]
horofox has quit [Read error: Connection reset by peer]
horofox has joined #ruby
kenneth has quit [Quit: kenneth]
sayan has joined #ruby
<hoelzro>
concurrency *is* a pain
<hoelzro>
most of the time, you don't even need it
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
clocKwize has quit [Quit: clocKwize]
_br_ has quit [Excess Flood]
sayan has quit [Read error: Connection reset by peer]
<JonnieCache>
yeah ill just do everything in order
matthias_ has joined #ruby
rippa has joined #ruby
pu22l3r has quit [Remote host closed the connection]
nwertman_ has joined #ruby
jonahR has joined #ruby
roflmaus has quit []
Neomex has quit [Quit: Neomex]
generalissimo has joined #ruby
<JonnieCache>
is there a good way to call each on a pair of arrays and yield the element witht the same index of each?
<JonnieCache>
or should i just handroll that
_br_ has joined #ruby
horofox has quit [Read error: Connection reset by peer]
nwertman has quit [Ping timeout: 252 seconds]
<spider-mario>
I might use zip
horofox has joined #ruby
filipe has quit [Remote host closed the connection]
<JonnieCache>
yeah was thinking that
<hoelzro>
JonnieCache: so you want to find an i for a[i] == b[i]?
<JonnieCache>
no
<JonnieCache>
i just want to iterate over two arrays at once
_br_ has quit [Excess Flood]
<banisterfiend>
that's what zip is for
<hoelzro>
ah, then zip sounds good
<JonnieCache>
double_each(a1, a2) do |e1, e2|
<spider-mario>
zip seems perfect then
<spider-mario>
a1.zip(a2) do |e1, e2|
<banisterfiend>
a.zip(b) { |ele1, ele2| }
<JonnieCache>
the only other thing is, one of the arrays isnt an array, its a DB-backed object with 20,000 rows which blocks for 2 minutes+ when you call .all on it :)
etcetera has quit []
yoshie902a has left #ruby [#ruby]
<JonnieCache>
zip goes row by row, right?
zommi has joined #ruby
[AD] has joined #ruby
_br_ has joined #ruby
Goles has joined #ruby
jxf has joined #ruby
[AD] has quit [Client Quit]
<spider-mario>
JonnieCache: call zip on that object so that it’s not converted to an array
<JonnieCache>
good idea
recycle has quit [Read error: Connection reset by peer]
Zolo_ has quit [Remote host closed the connection]
etcetera has joined #ruby
rakl has joined #ruby
mark_locklear has quit [Remote host closed the connection]
matthias_ has quit []
blaxter has joined #ruby
jxf has quit [Client Quit]
horofox has quit [Read error: Connection reset by peer]
_br_ has quit [Excess Flood]
horofox has joined #ruby
<JonnieCache>
then i can use the |(foo, bar)| block argument syntax as well
<JonnieCache>
winning
_nitti has quit [Remote host closed the connection]
_br_ has joined #ruby
<banisterfiend>
JonnieCache: dont need parentheses :)
<JonnieCache>
even to expand an array like that?
<ericwood>
blocks don't work that way :P
<ericwood>
just comma separated
<JonnieCache>
no but if i have just one two element array as an arg I can expand it with the parens cant I?
<JonnieCache>
im sure ive done that before
<banisterfiend>
JonnieCache: yeah, you can destructure it without parentheses
<workmad3>
X-Jester: I also doubt it would differentiate if the user account doesn't exist from them either
rdark has quit [Ping timeout: 252 seconds]
<workmad3>
x
gansam has joined #ruby
<spider-mario>
codezombie: how about that one?
<workmad3>
X-Jester: doing otherwise allows more focussed brute-force attacks
<ericwood>
he's right
Dakuan has quit [Remote host closed the connection]
<codezombie>
ericwood: the join on the end of the block originally came from me trying to do a puts on the block, instead of actually assigning it to a variable. Though, that didn't work at all.
alvaro_o has joined #ruby
maletor has joined #ruby
<ericwood>
ah okau
Neomex has joined #ruby
<codezombie>
spider-mario: the output is wrong.
<codezombie>
needs to be a multiplacation table.
haxrbyte has quit [Read error: Connection reset by peer]
bluenemo has quit [Ping timeout: 246 seconds]
<jblack>
I don't think the ssh protocol provides for anything other than u+p failure.
<ericwood>
spider-mario: are you zenspider?
_br_ has quit [Excess Flood]
<spider-mario>
oops, that’s true, sorry
<X-Jester>
okay, I understand what you're saying.
<spider-mario>
no, I’m not
<ericwood>
hmmmph
<ericwood>
on he's only in #ruby-lang
<X-Jester>
It looks like even with executing ssh <user>@host, if the user is locked out, that information is not returned to the client
<gansam>
Am unable to override the read method in URI::HTTP(OpenURI::OpenRead) to make it read a test file. I keep getting a NoMethodError: undefined method `read' for #<URI::HTTP:0x10ac59918> because the read method is located in OpenURI::OpenRead and not in URI::HTTP. Even though I specify my modules as OpenURI::OpenRead it doesn't work. Any pointers?
<X-Jester>
You only see the account being locked if something prompts for your password *after* you're in a login shell
<X-Jester>
(i.e. you authenticated with a cert)
<spider-mario>
puts (1 .. 12).map {|n| (n .. 12 * n).step(n).entries.join "\t"}.join "\n" works, but I didn’t realize what it was supposed to do, and map is indeed better.
Jamone has joined #ruby
joeycarmello has joined #ruby
<codezombie>
thanks for giving it a shot mario :)
<spider-mario>
so, puts (1 .. 12).map {|n| (1 .. 12).map {|i| n * i}.join "\t"}.join "\n"
Vert has quit [Read error: Connection reset by peer]
<banisterfiend>
davidcelis: what's that twitter scandal u r all up in
<davidcelis>
is that still going on?
megha has joined #ruby
eykosioux has quit [Quit: eykosioux]
<banisterfiend>
davidcelis: no idea, just saw it on my feed this morning
<davidcelis>
from who? i saw ryan bigg tweeting about it and some people responding to him
<banisterfiend>
davidcelis: klabnik and u
<davidcelis>
ah
bean has joined #ruby
<davidcelis>
yeah this guy chris whitman went crazy
<davidcelis>
and flipped out at ryan and myself
<davidcelis>
well he was flipping out at me a few times already and then ryan got involved
<banisterfiend>
davidcelis: why did he flip out
<davidcelis>
basically he runs some no-name startup, i did some contract work for him a while ago, and decided i didn't want to leave portland to go to L.A. and work for him full time
<davidcelis>
so he's been pissy ever since, which was over half a year ago
Elhu has quit [Quit: Computer has gone to sleep.]
mockra has joined #ruby
_br_ has joined #ruby
brianpWins has quit [Quit: brianpWins]
<banisterfiend>
davidcelis: ah ok
jgrevich_ has joined #ruby
urrk has joined #ruby
Hien has joined #ruby
MattRB has joined #ruby
danneu has joined #ruby
squidBits has joined #ruby
miskander has joined #ruby
arya has quit [Ping timeout: 245 seconds]
jgrevich has quit [Ping timeout: 256 seconds]
jgrevich_ is now known as jgrevich
<failshell>
anyone knows why rubgems always reinstall gems even if its installed and has the latest version?
<failshell>
any way to prevent that
wchun has quit [Quit: Leaving]
telli has quit [Ping timeout: 244 seconds]
hoelzro has joined #ruby
adeponte has quit [Remote host closed the connection]
Mission-Critical has joined #ruby
DefV has joined #ruby
kpshek has quit []
karasawa has joined #ruby
awarner has quit [Remote host closed the connection]
slainer68 has quit [Remote host closed the connection]
pettsson has joined #ruby
jrist has quit [Ping timeout: 252 seconds]
<CrawfordComeaux>
Quick poll: Is this something you'd fund to get to play with and if so, how much would you put in? If not, what could be offered to change your mind - I want to setup a crowdfunding campaign for setting up a system that lets devs play with all social media data related to the super bowl or geotagged as coming from New Orleans from 1/26-2/4. Devs would be able to submit their own data processing components (for www.storm-project.org) or dashboard widgets
<CrawfordComeaux>
w/custom queries attached to them.
codezombie is now known as codezombie|away
Mission-Critical is now known as MissionCritical
<bel3atar>
CrawfordComeaux: tl;dr
Hanmac has joined #ruby
<CrawfordComeaux>
bel3atar: So I should repeat one sentence per line?
benlieb has quit [Quit: benlieb]
nik_-_ has joined #ruby
zph has quit [Quit: Computer has gone to sleep.]
pcarrier has quit []
LL_ has joined #ruby
MattRB has quit [Quit: This computer has gone to sleep]
shevy has quit [Ping timeout: 246 seconds]
skaczor has quit [Quit: Leaving]
cirwin has quit [Quit: Leaving.]
adeponte has joined #ruby
angusiguess has joined #ruby
leonardli has joined #ruby
leonardli has left #ruby [#ruby]
Jacky_ has joined #ruby
sepp2k1 has joined #ruby
jaequery has joined #ruby
rezzack has joined #ruby
lenli has joined #ruby
sepp2k has quit [Ping timeout: 248 seconds]
aantix has joined #ruby
LL_ has quit [Quit: Page closed]
generalissimo has quit [Remote host closed the connection]
chussenot has quit [Quit: chussenot]
Kuifje has quit [Read error: Connection reset by peer]
Axsuul has joined #ruby
ExxKA has quit [Quit: This computer has gone to sleep]
<Gate>
CrawfordComeaux: no, but that's because I'm completely disinterested in social networking and the data thereof.
miskander has quit [Quit: miskander]
<CrawfordComeaux>
Gate: are the any kinds of data that do interest you?
eldariof has joined #ruby
* Hanmac
thinks that he makes an asocial network ... where you baned when you add someone as friend :D
<Gate>
CrawfordComeaux: yes. Many. Want examples?
chrismhough has quit [Quit: chrismhough]
<Gate>
Hanmac1: Not too far off :)
jaequery has quit [Quit: Computer has gone to sleep.]
<CrawfordComeaux>
Gate: yes, please :)
Jamone has quit [Quit: Quit]
Kuifje has joined #ruby
marr has quit [Ping timeout: 260 seconds]
<Gate>
CrawfordComeaux: Astronomical Data comes to mind
<Gate>
Chemistry and Physics data, or other hard science information
<CrawfordComeaux>
we're not so much interested in the social media aspect of the data...that's just a means to an end, which is play with things we normally don't get to
dr_neek has left #ruby [#ruby]
shevy has joined #ruby
<Gate>
CrawfordComeaux: I'd probably kill to get to play with the data from the Large Hadron Collider
arturaz has quit [Ping timeout: 244 seconds]
<Gate>
I'd do nothing productive without it without another 5 years of education, but It would be fun to put about with
banisterfiend has quit [Remote host closed the connection]
<Gate>
Or the data runs from the Italian group that claimed FTL neutrinos
banisterfiend has joined #ruby
kennyvb has quit [Read error: Operation timed out]
n1x has quit [Ping timeout: 245 seconds]
<CrawfordComeaux>
lol
etcetera has quit []
<Gate>
My eyes are bigger than my stomach, I know :)
Jacky_ has quit [Ping timeout: 245 seconds]
<CrawfordComeaux>
Gate: what about this - the datasift package is good for a month
<CrawfordComeaux>
so maybe the project runs for a month, with week 1 = super bowl data & weeks 2-4 to be determined
adeponte has quit [Remote host closed the connection]
miskander has joined #ruby
zph has joined #ruby
awarner has joined #ruby
<CrawfordComeaux>
could be week 2 = astro, week 3 = health, week 4 = finance (those are just examples)
albakry has joined #ruby
albakry has quit [Changing host]
albakry has joined #ruby
ebraminio has joined #ruby
ffranz has quit [Ping timeout: 246 seconds]
<CrawfordComeaux>
do you know of any sources of astro data like LHC that we could potentially tap into?
maz-dev has joined #ruby
<Gate>
Unfortunately even if the LHC was data was open and available, its ungodly huge
<Hanmac>
i am still disappointed about the LHC ... i wanted something more collosal :P
brianpWins has joined #ruby
jrist has joined #ruby
<CrawfordComeaux>
What about astro projects that use LambdaRail or Internet2?
etcetera has joined #ruby
<CrawfordComeaux>
Because I've got contacts that can potentially help get access to things on there
adeponte has joined #ruby
<Quadlex>
Hanmac: It was a little too small?
Norrin has joined #ruby
* Quadlex
wonders what Hanmac is compensating for
<Quadlex>
;P
chrismhough has joined #ruby
noyb has joined #ruby
Norrin has left #ruby [#ruby]
etcetera has quit [Client Quit]
yoshie902a has joined #ruby
kennyvb has joined #ruby
timmow has quit [Ping timeout: 252 seconds]
thomasfedb has quit [Ping timeout: 244 seconds]
<Gate>
Hanmac: hoping for some "earth shattering" discoveries, were you?
<Hanmac>
like a gash where we could see the other side of the mirror :P
autumn has quit [Ping timeout: 276 seconds]
stnly has quit [Ping timeout: 248 seconds]
rdark has joined #ruby
codezombie|away is now known as codezombie
Neomex has quit [Quit: Neomex]
adeponte has quit [Ping timeout: 260 seconds]
warb0 has quit [Ping timeout: 244 seconds]
<Hanmac>
i hope the data of the HLC helps us to get Fussion better working and maybe some day some kind of zero-point energy :D
cirwin has joined #ruby
pu22l3r has joined #ruby
bondar has quit [Quit: Leaving]
samphippen has joined #ruby
n1x has joined #ruby
icole has joined #ruby
cableray has joined #ruby
pkrnj has quit [Quit: Computer has gone to sleep.]
jrist is now known as jrist-gym
epylinkn has joined #ruby
timonv has quit [Ping timeout: 260 seconds]
ffranz has joined #ruby
otters has quit [Ping timeout: 252 seconds]
ffranz has quit [Client Quit]
llaskin1 has joined #ruby
ossareh has joined #ruby
<llaskin1>
is there a concept of retry-once in a begin/rescue/end block?
ffranz has joined #ruby
ffranz has quit [Client Quit]
<llaskin1>
or do I just have to put it in a counter or some such?
hybris has quit [Read error: Connection reset by peer]
<banisterfiend>
it's clearly a conversation, yet you only see one guy's side, so it looks (perhaps) a lot more hysterical/crazy than it actually may have been
<Nowaker>
Hi guys, is there a way to run ruby script directly from shell script? I am trying with ruby < <<EOF (multiline heredoc here) EOF and similar variations without any success. The problem is: I have got a bash script, this has to be a script, and I can't create any other file nowhere. So I have to put Ruby script somehow into this shell script. Any ideas?
sayan has quit [Quit: Leaving]
<havenn>
Nowaker: From inside your bash script call out to ruby: ruby -e "puts hi"
MattRB has joined #ruby
<havenn>
**"puts 'hi'"
sambio has quit [Ping timeout: 245 seconds]
<Nowaker>
okay, -e may be better than passing via stdin... let's see if I can do heredoc easily
<cool>
if yes, then you should add a README ASAP. projects specially open source are dead without it
<Hanmac>
Iszak_ yeah i am currently to less time ... you can look at the other repositories what i have done :P
<Gate>
Anyone suggest a way to do JS enabled request specs on a site which uses capybara as part of its primary functionality?
<Iszak_>
I really wish there were more mature, maintained GUI libraries for Ruby.
<Hanmac>
besides some minimal changes my rwx is similar to wxRuby ... (there should be some test folder ?)
orcris has joined #ruby
<cool>
Iszak_: +1
<Iszak_>
cool the reason I suggested JRuby is because it's maintained, you have access to Java's extensive API so no need to hunt for 3rd party libraries and it's cross platform.
solitude88 has quit [Quit: Leaving...]
Will_Pierce has left #ruby [#ruby]
mneorr has quit [Remote host closed the connection]
<Hanmac>
Isazak_ my would be more maintrained when i have more developers ... just image what i alone have done, in less the time entire wxRuby takes ...
moshee has quit [Ping timeout: 256 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
<cool>
Iszak_: its sad to use java but you are right. the JAVA is pretty extensive. so makes sense to use it
<Iszak_>
Hanmac oh I applaud you for what you're doing and I would like to see a maintained version of wxWidgets for Ruby as a strong alternative to JRuby/Swing/SWT
<Iszak_>
cool if you can, maybe a web app that can be bundled up and distributed?
berkes_ has quit [Quit: Ex-Chat]
fermion has joined #ruby
aantix has quit [Quit: aantix]
tndrbt has joined #ruby
MattRB has quit [Quit: This computer has gone to sleep]
<cool>
Iszak_: good point
yfeldblum has joined #ruby
jblack has quit [Read error: Operation timed out]
statarb3 has quit [Read error: Connection reset by peer]
etcetera has joined #ruby
jrist-gym is now known as jrist
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
* Hanmac
try to capure more developers in this channel for his evil projects :P
zph has quit [Quit: Computer has gone to sleep.]
karasawa has joined #ruby
slainer68 has joined #ruby
Takehiro has quit [Read error: Connection reset by peer]
angusiguess has quit [Ping timeout: 255 seconds]
Monie has joined #ruby
jaequery has joined #ruby
eka has quit [Ping timeout: 252 seconds]
<Spooner>
Hanmac, Ah, I was looking at wxruby recently. Yours is magically better, eh?
Takehiro has joined #ruby
<Amnesia>
hm question
n1x has quit [Ping timeout: 240 seconds]
<Amnesia>
what's the difference between being undefined and being nil?
eka has joined #ruby
karasawa has quit [Ping timeout: 252 seconds]
mneorr has joined #ruby
grzywacz has joined #ruby
kpshek has joined #ruby
danneu has joined #ruby
nomenkun has quit [Remote host closed the connection]
pu22l3r has quit [Remote host closed the connection]
<Hanmac>
Spooner: yes, in my gem you dont need this ugly ID_NEW constants, just use :new or any other symbol and my gem matchs them to the currect value ...
<Hanmac>
Amnesia they are a bit different in the deep of ruby .. (i also have seen an zombie type :D )
<Amnesia>
o0
<Spooner>
Hanmac, I was quite happy using @button - no idea why GUI toolkits dislike using Ruby variables :D
<Spooner>
But then, I suppose in your example you are reading from XML nonsense, so names make more sense there.
mockra has quit [Remote host closed the connection]
mercwithamouth has quit [Ping timeout: 248 seconds]
<Amnesia>
Hanmac: zombie type, wtf?
codezombie|away is now known as codezombie
jaequery has quit [Quit: Computer has gone to sleep.]
headius has quit [Quit: headius]
<Spooner>
Amnesia, An undefined variable/constant has never been defined. nil is a value like any other, but represents the lack of a value.
<Amnesia>
hm ok
<Amnesia>
ty
<Hanmac>
yeah i need more samples ... (the xml is one of the formats, so you could make your guis with an editor and then load the maked layout with my gem)
<Spooner>
frog = nil # is defining frog
timonv has joined #ruby
caleb_io has quit [Quit: caleb_io]
<Spooner>
Hanmac, I prefer to dynamically generate GUI. However, although I had a momentary need for a Ruby GUI the other week, I might not need one again, so ignore me.
dr_neek has joined #ruby
mantas322 has joined #ruby
<mantas322>
hey guys I know this is super easy to do, probably like one line of code
<Amnesia>
Spooner: that clears stuff up
<Amnesia>
ty
<mantas322>
I have an array ofnumbers and i want to iterate through it subtracting 1 from each number
timonv_ has quit [Read error: Connection reset by peer]
<codezombie>
davidcelis: So, you obviously like portland? I'm actually moving to the area this year.
<Spooner>
Hanmac, Having less segfaults when you don't give the right params would be a boon over wxruby :D
* Xeago
hates the moments when your laptop is too cold to use..
<mantas322>
Thanks spooner
<nazty>
anyone use netbeans and ruby
<Spooner>
mantas322, To change the original array, just use map! instead.
<Hanmac>
Spooner, i need to investigate more, but my gem should be more segfaultsafe ... (your windows get not undefined when you forgot to asign them to an variable)
cobragoa_ has joined #ruby
<mantas322>
wierd.
gutsiest60 has quit [Ping timeout: 248 seconds]
<Spooner>
Hanmac, Yeah, hand-made bindings should be more solid than presumably auto-generated ones.
MattRB has joined #ruby
phinfonet has joined #ruby
MattRB has quit [Client Quit]
<Hanmac>
Spooner with a bit black magic, i tamed the GC and the C++ objects keep the Ruby Objects alive ... so as long the C++ lives the ruby object lives too
<Spooner>
Goodo!
toekutr has joined #ruby
<Hanmac>
it may not 100% safe yet, but better then using swig
haxrbyte has joined #ruby
sclarson_ has quit [Quit: sclarson_]
<mantas322>
follow up question, it works by the way spooner, I have ARRAY = ARRAY.map {|i| (i - 4.00).round(2) } <--- can i put in a round 2 decimal places?
haxrbyte_ has joined #ruby
<Spooner>
Hanmac, Aye.
elico has quit [Quit: elico]
snearch has joined #ruby
n1x has joined #ruby
<Spooner>
mantas322, ARRAY.map! not ARRAY = ARRAY.map
<mantas322>
I did that and it didnt work
<canton7>
and you're changing constants, which is a bit ick
aarkerio has joined #ruby
<danneu>
why is a constant-looking variable being mutated
solitude88 has joined #ruby
<mantas322>
ARRAY.map {|i| (i - 4.00).round(2) } doesnt change my ARRAY's values
<danneu>
mantas322: map! vs map
<Spooner>
ARRAY.map! Look at the !!!!!!!
<mantas322>
oh
<Hanmac>
danneu, because it can :D
reset has joined #ruby
<mantas322>
oh that works
<mantas322>
thanks
<Hanmac>
you can forbit it with increasing the $SAFE variable
haxrbyte has quit [Ping timeout: 248 seconds]
* mantas322
wants an appropriate IDE for this...
<danneu>
for what
<mantas322>
typing ruby
<danneu>
evaluating ruby and seeing output?
jaequery has joined #ruby
<blazes816>
where you're going, you don't need IDEs
<Spooner>
danneu, No, fixing logical errors and cut-and-paste failures :D
<RubyPanther>
mach1ne: if you're saying Array.new then I already know you didn't even read a basic beginners book
jaequery has quit [Quit: Computer has gone to sleep.]
benlieb has quit [Quit: benlieb]
heftig has joined #ruby
<Amnesia>
berkes: may I pm you with some questions?
<mach1ne>
ah
<mach1ne>
theres that wonderful ruby community
<mach1ne>
ive heard so much about
<RubyPanther>
start from saved files, ask for live tutoring after you have some real questions
<berkes>
Amnesia, allows % to move between do/end and `var`, `vir` to select outer/inner blocks and all the verbs (like dar, dir, yar, yir etc)
mach1ne has quit [Quit: leaving]
<canton7>
RubyPanther, he's using the block initialisers... Is there a way to do that without Array.new ?
<Spooner>
mach1ne, Saying "doesn't work" is terribly unhelpful.
havenn has joined #ruby
mneorr has joined #ruby
gyre007 has joined #ruby
<Amnesia>
berkes: pm ?
ryanf has quit [Ping timeout: 240 seconds]
horofox has quit [Quit: horofox]
pkrnj has joined #ruby
<ericwood>
am
hotovson has quit [Read error: No route to host]
<RubyPanther>
canton7: { [MAP_HEIGHT,0] } at least but the whole construct isn't even used normally.
RagingDave has quit [Quit: Ex-Chat]
benlieb has joined #ruby
timonv has quit [Remote host closed the connection]
JumpMast3r has joined #ruby
<codezombie>
Does anyone have any interesting links on best practices for subclassing? I've got a friend here who's subclasses array just to make his object "prettier", and I'm completely oppsed to this, but he keeps throwing up reasoning like "Rails does it".
<RubyPanther>
codezombie: subclassing is normally only done when it is a base class that isn't used directly, for example Numeric where you need to implement the Numeric interface
<workmad3>
codezombie: flip-side, not everything in rails is a good coding principle
<RubyPanther>
for arrays and other end-user types that is not normally done, you would want mixins
<codezombie>
RubyPanther: so something more like include Enumerable
<RubyPanther>
yeah, exactly
<workmad3>
arrays are a particularly bad idea for subclassing, because it's *really* easy to suddenly end up with a normal array again
mengu has quit [Quit: Konversation terminated!]
<codezombie>
glad to know I wasn't just blowing hot air :)
bluenemo has joined #ruby
<RubyPanther>
we don't do multiple inheritance so subclassing often can't do what you need, but mixins always work. So that is usually right.
<RubyPanther>
something like ActiveRecord subclassing is done as a convenience and... you're intentionally being subservient to AR. You're saying, okay, AR is the important thing, I'm just adding my methods. On your own class Array is not likely to be a valid master to bow to.
timonv has quit [Ping timeout: 245 seconds]
mockra has quit [Ping timeout: 240 seconds]
<workmad3>
codezombie: if proxy objects and delegators weren't so easy to do in ruby, it would be a bit of hot air :)
<codezombie>
Much thanks for the info. This is pretty much what I was telling him. He just got done reading the ruby metaprogramming and object oriented design book I linked him, and he's doing a lot of experimenting.
<workmad3>
oh dear
zph has quit [Quit: Computer has gone to sleep.]
chussenot has quit [Quit: chussenot]
<RubyPanther>
I'd hide from him for 3 months, let some meta-chickens come home
grzywacz has quit [Ping timeout: 245 seconds]
* workmad3
forsees many classes crammed full of metaprogramming in codezombie's future
w|t has joined #ruby
w|t has quit [Changing host]
w|t has joined #ruby
<codezombie>
nah, I try to be more direct, but still keep metaprogramming as an option.
<codezombie>
clear code is pretty important in my book.
<workmad3>
codezombie: if you really want to make it complete, give him a design patterns book, and wait to see how many patterns he tries to meta-program into a single object ;)
rdg has joined #ruby
whowantstolivef1 has quit [Quit: quit]
miskander has quit [Client Quit]
<codezombie>
haha
zommi has quit [Quit: Leaving.]
<workmad3>
codezombie: I've heard of someone managing to get about 16 patterns from the original GoF book into a class before someone noticed and took away his keyboard privileges
<workmad3>
>> def method_missing(*foo); foo.map(&:to_s).join(" "); end; p what do you want?
<eval-in>
workmad3: Output: "/tmp/execpad-df7194b6b180/source-df7194b6b180:1: syntax error, unexpected $end, expecting keyword_end\n...(\" \"); end; p what do you want?\n... ^\n" (http://eval.in/7341)
<ericwood>
workmad3: heh
<codezombie>
RubyPanther: brilliant.
<workmad3>
bah
<codezombie>
whoops
<codezombie>
ericwood
jds_ has joined #ruby
jpfuentes2 has joined #ruby
ryanf has joined #ruby
<ericwood>
workmad3: I remember seeing something like that in a ruby conference presentation...the guy was like, BAM! Literate programming!
generalissimo has quit [Remote host closed the connection]
<workmad3>
>> def method_missing(*foo); foo.map(&:to_s).join(" "); end; p do stuff;
<eval-in>
workmad3: Output: "/tmp/execpad-0504d59d2679/source-0504d59d2679:1: syntax error, unexpected $end, expecting keyword_end\ndef method_missing(*foo); foo.map(&:to_s).join(\" \"); end; p do stuff;\n ^\n" (http://eval.in/7342)
jaequery has quit [Client Quit]
<workmad3>
nope, can't figure it atm
<RubyPanther>
I love programming-mf it is awesome like Zed especially the learn code the hard way stuff. If that is the right way, we were doing it right in the 80s lololol
<codezombie>
I have to say I love ruby... However, I've never seen so much drama in a community, like I do in ruby. (mostly rails, but still quite a bit of ruby based drama.)
samphippen has joined #ruby
bcx has left #ruby [#ruby]
<codezombie>
I like to think that this is due to ruby being such an easy language to really enjoy.
generalissimo has joined #ruby
<ericwood>
if you ignore a handful of people there's no drama
<ericwood>
just keep up with what tenderlove does, he's mostly just happy
<RubyPanther>
Zed is drama in the sense of, drama class
<ericwood>
RubyPanther: Zed enjoys getting angry for the sake of getting angry
<ericwood>
it's like a hobby
<codezombie>
ericwood: yeah, I've seen a few videos from confrences he's spoken at, and I enjoyed them.
<RubyPanther>
I value programming-mf and Rails is a Ghetto more than I value mongrel, so I'm glad he has that hobby :)
<blazes816>
tenderlove the will smith of rails core; rapping happy
Guest83897 has quit [Quit: Leaving]
jaygen has joined #ruby
<RubyPanther>
I've watched his presentation on Journey like 50 times since there is no documentation
cableray has joined #ruby
<RubyPanther>
That is Ruby, they make a movie and forget to write the book
timonv has joined #ruby
<ericwood>
idk, the situation is much better than it is with many open-source communities
<yoshie902a>
How do I get an index position of an array for example. ary = [ [1,2], [2,2], [3,2], [4,2], [5,2], [6,2] ], and I use ary.first.index, I would expect the number 0, but I get #<Enumerator: [1, 2]:index>, what am I doing wrong?
gutsiest60 has joined #ruby
pcarrier has joined #ruby
<Spooner>
yoshie902a, You want: ary.index [1, 2]
theRoUS has quit [Ping timeout: 248 seconds]
codezombie|away is now known as codezombie
carloslopes has quit [Remote host closed the connection]
elkclone has joined #ruby
<yoshie902a>
Spooner: you misunderstand. for example, I want the index number not value. ary.first, gives me the first position, I want to do something like ary.whatposition and have it tell me position 0
emergion has joined #ruby
<havenn>
yoshie902a: ary[0] #=> [1, 2]
<yoshie902a>
ary.first.whatposition
<Spooner>
ary.index [1, 2] #=> 0
jaequery has joined #ruby
<havenn>
yoshie902a: ary[ary.index(ary.first)]
interactionjaxsn has quit [Remote host closed the connection]
thufir_ has quit [Ping timeout: 256 seconds]
<Spooner>
yoshie902a, Once you take it out of the array, it doesn't have a position. ary.first isn't in the array!
<havenn>
yoshie902a: ary.index(ary.first) #=> 0
<yoshie902a>
I'm looping through an array and want to get the index number, what is the best way to do that?
<yoshie902a>
got, it you confused me for a second. I thought map_with_index was something else. but it does not exist, right?
<Eiam>
righto
<yoshie902a>
ok, thanks!
<Eiam>
my point was that when you see with_index works on enumerators you can 'enumerate' a lot of things to get the index if it wasn't readily available
<yoshie902a>
I understand, thank you!
love_color_text has quit [Remote host closed the connection]
<Eiam>
holay shit I just explained something to someone.
* Eiam
removes 1 from vampire score
Innocentus has joined #ruby
<banisterfiend>
hehe
<Innocentus>
what is a rake script?
jaequery has quit [Quit: Computer has gone to sleep.]
<Innocentus>
I mean rake is for cgi abstraction / simplification - so why is it also a build tool?
<Eiam>
no, its for managing tasks =0
<yoshie902a>
if I have a .rb file, called myfile.rb and it contains require files. Can I require myfile.rb in another file, maybe called, mysecondfile.rb?
jlast has quit [Remote host closed the connection]
cakehero has joined #ruby
tommyvyo_ has joined #ruby
<Innocentus>
ah
elaptics is now known as elaptics`away
ViPi has joined #ruby
<Innocentus>
and how is that framework called which unifies cgi calls?
ViPi has quit [Max SendQ exceeded]
dougireton has quit [Quit: Leaving.]
tekacs has joined #ruby
ViPi has joined #ruby
cakehero has quit [Client Quit]
havenn has quit [Remote host closed the connection]
jackyalcine has joined #ruby
clj_newb has joined #ruby
havenn has joined #ruby
dougireton has joined #ruby
emergion has joined #ruby
<apeiros_>
Innocentus: you mean rack? it's not really cgi calls, though
blacktulip has quit [Remote host closed the connection]
<yoshie902a>
if I require a file twice in code, does it load it twice, or see that it's already loaded and skip the load?
<Eiam>
yoshie902a: try it out? make two files with the same name, define a method differently in each with the same name & see what happens? =0
<danneu>
yoshie902a: the difference between require and load is that require won't load more than once
<danneu>
in it's most basic case, at least
<apeiros_>
yoshie902a: ri Kernel#require
<apeiros_>
it's a normal method and documented.
mockra has joined #ruby
havenn has quit [Ping timeout: 256 seconds]
MissionCritical has quit [Ping timeout: 248 seconds]
dougireton has quit [Client Quit]
<yoshie902a>
thanks! I just has two different .rb files that both require nokogiri and I was worried that if I require both files, it would load/require nokogiri twice, which I thought was less efficient. I'll read more on the documents, thanks!
jenrzzz has joined #ruby
tatsuya_o has joined #ruby
gyre008 has joined #ruby
mockra has quit [Ping timeout: 252 seconds]
noxoc has quit [Quit: noxoc]
kold_ has joined #ruby
<graft>
if i include module B in class A, module B can't call A's class methods, can it?
v0n has quit [Ping timeout: 245 seconds]
<banisterfiend>
graft: yes it can
blaxter has quit [Quit: foo]
Rym has quit [Quit: Rym]
emergion has quit [Ping timeout: 264 seconds]
<graft>
like I could do: module B; hello; end; class A; include B; def self.hello; puts :hello; end; end;
nari has joined #ruby
Rym has joined #ruby
<banisterfiend>
graft: no, not like that
jimeh has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
graft: you can call A's methods inside (instance) methods of B though
pettsson has quit [Quit: Lämnar]
cobragoat has joined #ruby
<graft>
yeah... so what's the way to share a bunch of class methods across a bunch of modules, then?
<Eiam>
can't you just say B::method to call it?
emmanuelux has quit [Remote host closed the connection]
kirun has quit [Quit: Client exiting]
Monie has joined #ruby
<Innocentus>
so ruby runs only on one process? I mean, it is single threaded and not thread safe?
<graft>
well i want to be able to have a bunch of modules A, B, C, all of which have the same class methods defined, and then do class D; include A; include B; include C; end
<graft>
Innocentus: there is a Thread object
<Eiam>
graft: and from D you'd say A::method to call those methods..
dougireton has joined #ruby
<Eiam>
although you may as well just include the files outside the class at that point hmm
epylinkn has quit [Quit: Leaving.]
<graft>
Eiam: well, let's say I wanted a class method that I called in module A, and the same method that I called in B, etc., where would i define it?
dougireton has quit [Client Quit]
<apeiros_>
Innocentus: that's a property of the runtime, not the language
<blazes816>
if you want multiple real thread try jruby or rubinious
<apeiros_>
the standard ruby uses (iirc) 2 threads, and ruby code is indeed only green-threaded
epylinkn has joined #ruby
<Eiam>
I'm not sure I understand the use case, but wouldn't you just have ModuleA::Method1 and ModuleB::Method1 ?
<apeiros_>
jruby uses real (jvm-)threads
<apeiros_>
rubinius was on its way to remove the GIL last I checked. that's been a while, maybe they're GIL-free
chussenot has quit [Quit: chussenot]
autumn has joined #ruby
<Innocentus>
so I can have ruby (with ruby on rails) running multithreaded?
orcris has quit [Ping timeout: 248 seconds]
<Innocentus>
and can I spawn threads in ruby?
ashp has left #ruby [#ruby]
<apeiros_>
you can spawn green threads in about every ruby implementation
DrShoggoth has quit [Ping timeout: 245 seconds]
freakazoid0223 has joined #ruby
danneu has quit [Quit: WeeChat 0.3.8]
<apeiros_>
seems rubinius still considers the 1.x branch the stable one, and that one has a GIL (same approach as "standard" ruby)
gyre007 has joined #ruby
swarley| has joined #ruby
aeontech has joined #ruby
ForSpareParts has quit [Quit: Leaving]
aaronmacy has joined #ruby
noyb has joined #ruby
b1rkh0ff has quit [Ping timeout: 256 seconds]
apeiros_ has quit [Remote host closed the connection]
dagnachew has joined #ruby
MissionCritical has joined #ruby
grizwako has left #ruby [#ruby]
aeontech has left #ruby [#ruby]
dougireton has joined #ruby
elico has joined #ruby
dougireton has quit [Client Quit]
swarley- has joined #ruby
FifthWall has quit [Quit: Computer has gone to sleep.]
Criztian has quit [Remote host closed the connection]