<GoHuyGo>
why am I returning a[n-1] instead of a[n]
delinquentme has joined #ruby
<delinquentme>
include Cloner
lggr has joined #ruby
<delinquentme>
anyone know what cloner is?
bricker has quit [Ping timeout: 244 seconds]
flip_digits has quit [Quit: Computer has gone to sleep.]
zommi has joined #ruby
<banisterfiend`>
delinquentme you're in a better position to figure that out than anyone else here
<Spooner>
GoHuyGo : because in a length n array, n-1 is the last element. I'd use a.last, since that is a lot clearer.
<Spooner>
GoHuyGo : Just like C, Ruby arrays start at index 0 and go to length - 1
<GoHuyGo>
because the count starts at 0?
<GoHuyGo>
gotcha
<GoHuyGo>
I'm getting confused with n and i
<GoHuyGo>
so when you do n.times do |i|
<GoHuyGo>
when n starts at 0, i = 0?
<Spooner>
Yeah, much better to use a name beter than "n" - i is an iterator, which is fine.
<Spooner>
n.times runs from 0 to n-1
<GoHuyGo>
I'll call it element
<GoHuyGo>
okay
<GoHuyGo>
and for each iteration
<Spooner>
Though that code isn't very nice for you ;)
<GoHuyGo>
the variable i will be assigned to n?
<GoHuyGo>
why's that
demian`_ has quit [Quit: demian`_]
<Spooner>
Well, it creates the full array, when you just want 1 element, for example.
arya_ has quit [Ping timeout: 244 seconds]
banisterfiend` has quit [Ping timeout: 260 seconds]
blendedbychris has joined #ruby
<GoHuyGo>
mhmm
<blendedbychris>
is erb supposed to support "case" somehow?
<blendedbychris>
i tried <% case var %> <% when "foo %> … <% end %>
<Spooner>
And we would very rarely use a[i] = x in that case, since a << x is append (we know i is one more than the current length of the array).
blazes816 has quit [Quit: blazes816]
lggr has quit [Ping timeout: 240 seconds]
arya_ has joined #ruby
<GoHuyGo>
kk
<GoHuyGo>
i'll play aruond with append
<Spooner>
Well, in the case of an array, << is just an alias of #push
gfontenot has quit []
<GoHuyGo>
so in my n.times do ... end
<GoHuyGo>
I can simply just append to the array
<GoHuyGo>
since it's not fixed length
blendedbychris has quit [Quit: Leaving.]
<peteyg_>
Hey guys, coming from Python here and I'm used to having help(<object>) giving me a list of calls that the object responds to. Is there something similap in Ruby?
<peteyg_>
similar*
arya_ has quit [Client Quit]
flip_digits has joined #ruby
yshh has joined #ruby
<Spooner>
peteyg_ : object.public_methods
justsee has joined #ruby
justsee has quit [Changing host]
justsee has joined #ruby
manouch has quit [Quit: manouch]
<Spooner>
GoHuyGo : Yes, because [1, 2] << 3 is the same as [1, 2][2] = 3
lggr has joined #ruby
<Spooner>
peteyg_ : I recommend trying out the pry gem as a replacement for irb. Really helps when doign stuff like that (in pry, you'd do "cd object; ls" - it treats data structures like Linux filesystem)
<GoHuyGo>
got it
<GoHuyGo>
Spooner: I was just playing with append and realized that you have to set the first element prior to calling << for it to work
<Spooner>
GoHuyGo : You can create an empty array with a = [], then you can push onto it.
<Spooner>
GoHuyGo : And the pry recommendation goes for you too. Might be helpful!
ffranz has quit [Ping timeout: 264 seconds]
ttt has joined #ruby
peteyg_ has quit [Ping timeout: 252 seconds]
horofox has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
jasonkuhrt has joined #ruby
ckrailo has quit [Quit: Computer has gone to sleep.]
justinmcp has quit [Remote host closed the connection]
acrocity_ has joined #ruby
justinmcp has joined #ruby
banisterfiend` has joined #ruby
AlbireoX has joined #ruby
ttt has quit [Ping timeout: 240 seconds]
dmiller has joined #ruby
cburyta has quit [Remote host closed the connection]
iori has joined #ruby
Chryson has joined #ruby
lggr has joined #ruby
jasonkuhrt has quit [Ping timeout: 244 seconds]
chrishunt has quit [Ping timeout: 268 seconds]
nohonor has joined #ruby
jasonkuhrt has joined #ruby
savage- has quit [Ping timeout: 246 seconds]
Jamone has joined #ruby
Jamone has quit [Changing host]
Jamone has joined #ruby
iamjarvo has joined #ruby
aantix has quit [Ping timeout: 244 seconds]
Monie has quit [Ping timeout: 244 seconds]
xaq has quit [Remote host closed the connection]
acrocity_ has quit [Quit: leaving...]
sepp2k has joined #ruby
Hanmac1 has joined #ruby
lushious has quit [Ping timeout: 252 seconds]
acrocity_ has joined #ruby
quest88_ has joined #ruby
<delinquentme>
banisterfiend`, yeah I wish I had an idea though
lggr has quit [Ping timeout: 244 seconds]
joofsh has joined #ruby
Hanmac has quit [Ping timeout: 245 seconds]
<banisterfiend`>
delinquentme why dont you just figure it out? just find a method on that module, and grab its source_location
<banisterfiend`>
delinquentme or use pry and go: show-source Cloner
lewis1711 has joined #ruby
<banisterfiend`>
it'll tell u where the module is defined and display its source code
stephenjudkins has joined #ruby
lewis1711 has left #ruby [#ruby]
walbert has quit [Remote host closed the connection]
maletor has quit [Quit: Computer has gone to sleep.]
justsee has quit [Quit: Leaving...]
lggr has joined #ruby
emmanuelux has quit [Remote host closed the connection]
uris has joined #ruby
eignerchris has joined #ruby
<delinquentme>
banisterfiend`, pry and go?! this sounds new...
Agis__ has quit [Quit: Agis__]
<delinquentme>
Also the issue is that when I try to load it .. it fails :D
<delinquentme>
so its not exactly there
<banisterfiend`>
delinquentme, errr, byh 'go' i meant 'do this'
eignerchris has quit [Remote host closed the connection]
<delinquentme>
$ pry show-source Cloner
lushious has joined #ruby
<banisterfiend`>
delinquentme im sorry, but you're a moron. For a start 'show-source' is a command INSIDE pry, secondly Cloner (whatever it is) is NOT part of stdlib/core, it's clearly some kind of gem so you'd have to require that gem first
fyolnish_ has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
<delinquentme>
Waiit a minute here
notVert has quit [Ping timeout: 252 seconds]
<delinquentme>
if pry is a codebase with which i execute commands ( show-source) is it not going to be something that I'd run from command line? just as like i put up there?
<delinquentme>
I appreciate the help but that claim seems way off base
rakl has joined #ruby
<banisterfiend`>
delinquentme you have to start pry first, it's a REPL. once it's started then you issue commands like show-source
jenrzzz has joined #ruby
banisterfiend` is now known as banisterfiend
GoHuyGo has quit [Quit: Leaving]
mikepack has quit [Remote host closed the connection]
nacengineer has joined #ruby
rlb3 has joined #ruby
lggr has joined #ruby
josh^ has joined #ruby
sdwrage has joined #ruby
AlbireoX has quit [Read error: Connection reset by peer]
AlbireoX has joined #ruby
xbayrockx has quit [Ping timeout: 240 seconds]
austinbv has quit [Read error: Connection reset by peer]
LouisGB has quit [Ping timeout: 252 seconds]
ncr100 has quit [Ping timeout: 252 seconds]
RubyPanther has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 240 seconds]
alvaro_o has quit [Quit: Ex-Chat]
Criztian_ has quit [Remote host closed the connection]
rlb3 has quit [Quit: rlb3]
adeponte has quit [Remote host closed the connection]
machty has quit [Ping timeout: 256 seconds]
xbayrockx has joined #ruby
zmbmartin has quit [Quit: Leaving.]
RubyPanther has joined #ruby
nateberkopec has quit [Ping timeout: 244 seconds]
lggr has joined #ruby
zommi has quit [Ping timeout: 265 seconds]
Spooner has quit [Ping timeout: 240 seconds]
cj3kim has quit [Quit: This computer has gone to sleep]
dagnachewa has joined #ruby
_karstensrage is now known as karstensrage
davidcelis has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
jrist is now known as jrist-afk
maletor has joined #ruby
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has joined #ruby
nari has joined #ruby
phantasm66 has joined #ruby
lggr has joined #ruby
chrishunt has joined #ruby
Goles has joined #ruby
acrocity_ is now known as acrocity
pu22l3r has joined #ruby
swarley has quit [Ping timeout: 260 seconds]
voodoofish430 has quit [Quit: Leaving.]
ttt has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
Ruler_Of_Heaven_ has quit [Ping timeout: 255 seconds]
pskosinski has quit [Remote host closed the connection]
mrsolo has quit [Quit: Leaving]
pipopopo has joined #ruby
linoj has joined #ruby
Dreamer3 has quit [Quit: Leaving...]
ryanf has quit [Ping timeout: 245 seconds]
lggr has quit [Ping timeout: 260 seconds]
swarley has joined #ruby
banisterfiend has quit [Ping timeout: 240 seconds]
linoj has quit [Client Quit]
Bosox20051 has joined #ruby
LouisGB has joined #ruby
nateberkopec has joined #ruby
iori has quit [Remote host closed the connection]
Ruler_Of_Heaven_ has joined #ruby
pipopopo has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
justsee has joined #ruby
justsee has quit [Changing host]
justsee has joined #ruby
dpk has quit [Quit: Asleep at the keyboard.]
w400z has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
kiyoura has quit [Quit: Leaving]
w400z has quit [Client Quit]
w400z has joined #ruby
lledet has joined #ruby
w400z has quit [Client Quit]
davidcelis has quit [Ping timeout: 244 seconds]
tarwich1 has joined #ruby
lggr has joined #ruby
davidcelis has joined #ruby
ken_barber has quit [Remote host closed the connection]
maletor has joined #ruby
luist has quit [Remote host closed the connection]
freeayu has quit [Ping timeout: 248 seconds]
JustinCampbell has quit [Remote host closed the connection]
pu22l3r has quit [Remote host closed the connection]
freeayu has joined #ruby
dagnachewa has quit [Quit: Leaving]
JustinCampbell has joined #ruby
JustinCampbell has quit [Remote host closed the connection]
JustinCampbell has joined #ruby
dmiller has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 264 seconds]
ryanRT has joined #ruby
JustinCampbell has quit [Remote host closed the connection]
awarner has joined #ruby
ken_barber has joined #ruby
lggr has joined #ruby
cj3kim has quit [Quit: Leaving]
mwilson` has quit [Excess Flood]
mwilson` has joined #ruby
Jay_Levitt has quit [Ping timeout: 244 seconds]
lggr has quit [Ping timeout: 240 seconds]
joelsbeard has quit [Ping timeout: 248 seconds]
havenn has joined #ruby
luckyruby has joined #ruby
\13k has joined #ruby
RubyPanther has quit [*.net *.split]
davidcelis has quit [*.net *.split]
swarley has quit [*.net *.split]
Hanmac1 has quit [*.net *.split]
cbuxton has quit [*.net *.split]
tntc has quit [*.net *.split]
friskd has quit [*.net *.split]
burgestrand has quit [*.net *.split]
asobrasil has quit [*.net *.split]
crodas has quit [*.net *.split]
Guest32003 has quit [*.net *.split]
thnee has quit [*.net *.split]
RJ3000_ has quit [*.net *.split]
bigkevmcd has quit [*.net *.split]
voodoofish has quit [*.net *.split]
dimka has quit [*.net *.split]
zaargy has quit [*.net *.split]
octarine has quit [*.net *.split]
aef_ has quit [*.net *.split]
mahlon has quit [*.net *.split]
willb has quit [*.net *.split]
Eiam has quit [*.net *.split]
ged has quit [*.net *.split]
idoru has quit [*.net *.split]
octarine has joined #ruby
burgestrand has joined #ruby
Hanmac has joined #ruby
RJ3000_ has joined #ruby
mrdodo has joined #ruby
lggr has joined #ruby
xaq has joined #ruby
adeponte has joined #ruby
monkegji_ has quit [Remote host closed the connection]
fyolnish_ has quit [Remote host closed the connection]
<shevy>
but if you are a beginner, it is not good to jump right into GUI stuff with ruby
<shevy>
write console-only stuff first for a while
<Xeago>
jokar: start with programs that calculate primes, and things like that
timmow has joined #ruby
<Xeago>
did you do a hello world yet?
<shevy>
he'll manage that today :P
<Xeago>
tbh, I doubt
<shevy>
hahaha
<jokar>
shevy : can i export ruby code to exe file?
<jokar>
python can
<Xeago>
oh shit, he's on windows too
<shevy>
:(
<jokar>
no
<shevy>
he is dooomed
<jokar>
I'm a linux user
TomJ has joined #ruby
TomJ has joined #ruby
TomJ has quit [Changing host]
<Xeago>
then why an exe file
<jokar>
but some customer need exe file
<Xeago>
customer?
<shevy>
jokar you can kind of put together things into an .exe but it will never be the same as other .exe
<jokar>
i want write app
<shevy>
learn C, compile an .exe, sell it, profit
kaichanvong has joined #ruby
<shevy>
or C++
<jokar>
:)
<jokar>
but ruby is interested
lggr has joined #ruby
<jokar>
i like it
<jokar>
Code must be free
<Xeago>
jokar: write your hello world program, then come back
<jokar>
puts "hello word"
<Xeago>
put it in a file
<jokar>
:)
<Xeago>
make it executable
<jokar>
hello.rb
<jokar>
ruby hello.rb
<Xeago>
no, you are calling the ruby interpreter on the file
<Xeago>
./hello.rb
<jokar>
#/bin/ruby
<Xeago>
still wrong
<Hanmac>
chmod +x hello.rb
<Xeago>
!#/bin/env ruby
<Hanmac>
!#/usr/bin/env ruby
<jokar>
yeah
<Xeago>
I got it in bin Hanmac :)
<Xeago>
needed it in single user mode a while ago
<jokar>
shevy : ruby-gnome is good
<jokar>
thanks
<jokar>
shevy ,Xeago : i must leave out and i will talk to you and answer my questions another time
<jokar>
thanks for all your help
liktoj has joined #ruby
<m3pow>
bloody ubuntu 12.04.1 has some idiotic bugs in unity, and i get weird tooltips from launcher icons
zz_chrismcg is now known as chrismcg
TomJ has quit [Quit: TomJ]
<shevy>
m3pow hehe
<m3pow>
shevy, hello matey !
<m3pow>
seems like i will have to wait for updates
lggr has quit [Ping timeout: 240 seconds]
Jck_true has quit [Read error: Connection reset by peer]
<vectorshelve>
shevy: hi :) Long time
jokar has left #ruby ["PART #linux-cluster :QUIT :Leaving."]
<vectorshelve>
Hanmac: hi
<shevy>
vectorshelve hi. are you still using ruby
<vectorshelve>
shevy: Yes.. I think so :)
bier has joined #ruby
theRoUS_ has joined #ruby
<vectorshelve>
shevy: always wondered why ruby and to a great extent rails hasnt had any tools that can auto generate test suites and scripts.. java and c++ has that
<shevy>
I write these for myself!
lggr has joined #ruby
<shevy>
in my ruby shell, I do "mbl foo.rb" and it generates a skeleton for .rb files
woman is now known as thomas
<Xeago>
tbh, writing a test in ruby is easier then in java/c++/c#
<shevy>
thomas ... was your nick before ... woman ???
<thomas>
yup
<shevy>
hehe
<m3pow>
you're a male now ...?
<m3pow>
cool
<shevy>
anything goes on IRC
PragCypher has quit [Read error: Connection reset by peer]
PragCypher has joined #ruby
osccar has joined #ruby
<thomas>
lol
Virunga has joined #ruby
Shrink has quit [Ping timeout: 264 seconds]
<shevy>
Xeago ... what should a good shell offer the user?
<banisterfiend>
shevy purity of heart
lchin has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
Virunga has quit [Remote host closed the connection]
lchin has quit [Ping timeout: 264 seconds]
shiki has joined #ruby
jmeeuwen has quit [Ping timeout: 252 seconds]
lggr has joined #ruby
Jck_true has joined #ruby
frogprince_mac has joined #ruby
xpen has quit [Remote host closed the connection]
bartj3 has joined #ruby
Shrink has joined #ruby
freeayu__ has quit [Quit: This computer has gone to sleep]
chussenot has quit [Quit: chussenot]
xea has quit [Read error: Operation timed out]
jmeeuwen has joined #ruby
banisterfiend` has joined #ruby
danielpunt has joined #ruby
manouch has quit [Quit: manouch]
lggr has quit [Ping timeout: 260 seconds]
Shrink has quit [Ping timeout: 246 seconds]
acrocity has quit [Ping timeout: 244 seconds]
andremaha has joined #ruby
matthewrobbins has joined #ruby
acrocity has joined #ruby
xea has joined #ruby
banisterfiend` has quit [Remote host closed the connection]
lggr has joined #ruby
mroh_ has joined #ruby
bigkevmcd has quit [Ping timeout: 240 seconds]
mucker has joined #ruby
mroh has quit [Ping timeout: 252 seconds]
RJ3000_ has quit [Remote host closed the connection]
andremaha_ has joined #ruby
monkegjinni has joined #ruby
andremaha_ has quit [Client Quit]
greg has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
andremaha has quit [Ping timeout: 264 seconds]
RJ3000_ has joined #ruby
Beoran__ has joined #ruby
Shrink has joined #ruby
freeayu has joined #ruby
lggr has joined #ruby
Beoran_ has quit [Ping timeout: 240 seconds]
RJ3000_ has quit [Remote host closed the connection]
philcrissman has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 244 seconds]
<Hanmac>
Xeago about sourcecode ... my latest binding code (*.cpp + *.hpp) size is only 0.9% of the binding (*.so) size :D
wataken44 has quit [Remote host closed the connection]
omry has joined #ruby
nanderoo has joined #ruby
wataken44 has joined #ruby
<Xeago>
when using activerecord inside an irb session I cannot get the sqlite3 adapter nor the mysql adapter to work
<Xeago>
it directs me to gem install activerecord-[mysql|sqlite3]-adapter
<Xeago>
which results in ERROR: could not find gem activerecord-sqlite3-adapter locally or in a repository
<Xeago>
crap, that was supposed to be in another channel
bananagram has quit [Ping timeout: 246 seconds]
AndChat| has joined #ruby
ABK has quit [Read error: Connection reset by peer]
heisenmink has joined #ruby
AndChat- has joined #ruby
ABK has joined #ruby
RJ3000_ has joined #ruby
nohonor has quit [Quit: Leaving]
xyzodiac has joined #ruby
lggr has joined #ruby
bartj3 has quit []
vectorshelve has quit [Quit: Page closed]
Banistergalaxy has quit [Ping timeout: 248 seconds]
AndChat| has quit [Ping timeout: 252 seconds]
Guedes has quit [Remote host closed the connection]
heisenmink is now known as awestroke
zommi has quit [Ping timeout: 265 seconds]
bartj3 has joined #ruby
mohits has quit [Ping timeout: 252 seconds]
JustinCampbell has joined #ruby
lggr has quit [Ping timeout: 268 seconds]
cakehero has joined #ruby
niklasb has joined #ruby
[Neurotic] has quit [Remote host closed the connection]
mikehoy has joined #ruby
deadghost has quit [Ping timeout: 246 seconds]
monkegjinni has quit [Remote host closed the connection]
lggr has joined #ruby
pu22l3r has joined #ruby
sailias has quit [Quit: Leaving.]
zommi has joined #ruby
schwap has quit [Ping timeout: 245 seconds]
alek_b has quit [Remote host closed the connection]
areil_ has quit []
areil has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
monkegjinni has joined #ruby
jasonkuhrt has joined #ruby
Neomex has joined #ruby
adambeynon has joined #ruby
sjkaliski has quit [Ping timeout: 252 seconds]
BdeUtra has joined #ruby
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
shiki has quit [Remote host closed the connection]
jasonkuhrt has quit [Ping timeout: 246 seconds]
Elhu has joined #ruby
lggr has joined #ruby
RJ3000_ has quit [Remote host closed the connection]
lledet has joined #ruby
Mon_Ouie has quit [Read error: No route to host]
pu22l3r has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
pu22l3r has joined #ruby
zommi has quit [Ping timeout: 265 seconds]
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby
mark_locklear has quit [Quit: Leaving]
lggr has quit [Ping timeout: 244 seconds]
bartj3 has quit []
ananthakumaran1 has joined #ruby
JustinCampbell has quit [Remote host closed the connection]
JustinCa_ has joined #ruby
ananthakumaran has quit [Ping timeout: 252 seconds]
mikepack has joined #ruby
thone has joined #ruby
sepp2k has joined #ruby
xyzodiac has quit [Quit: Computer has gone to sleep.]
awestroke has quit [Remote host closed the connection]
linoj has joined #ruby
lkba has joined #ruby
krawchyk has joined #ruby
thone_ has quit [Ping timeout: 268 seconds]
Vainoharhainen has joined #ruby
lggr has joined #ruby
bartj3 has joined #ruby
elico has joined #ruby
tommyvyo has joined #ruby
zommi has joined #ruby
Mon_Ouie has quit [Ping timeout: 246 seconds]
jbw has quit [Ping timeout: 252 seconds]
Appineer has joined #ruby
uris has quit [Quit: leaving]
lggr has quit [Ping timeout: 248 seconds]
Nisstyre-laptop has quit [Ping timeout: 256 seconds]
Axsuul has quit [Ping timeout: 268 seconds]
love_color_text has joined #ruby
bobbbo has joined #ruby
zommi has quit [Ping timeout: 265 seconds]
mikepack has quit [Remote host closed the connection]
lchin has joined #ruby
jbw has joined #ruby
<bobbbo>
Whats the best way to have a pointer to an int? So if i do p = oneOfManyPossible, then p = 10, I update oneOFMAnyPossible?
lggr has joined #ruby
<hoelzro>
bobbbo: Ruby doesn't have pointers; what exactly are you trying to accomplish?
<bobbbo>
trying to avoid redoing the logic that decides which var I'm updating
<bobbbo>
so if (some condition) { p = thisInitialValue} else if { p = thisOtherOne } …. etc
<bobbbo>
but I want updates in p to be reflected in the initial variable
<hoelzro>
I see
<bobbbo>
only way I know to do it in ruby is to shove them in an array and store the index, but that seems really, really, lame
<canton7>
numbers are utterly immutable, I believe
Nathandim has quit [Quit: Leaving]
<bobbbo>
I could of course re-do the logic, but trying to avoid that with wizardry
<hoelzro>
indeed they are
lockweel has joined #ruby
lchin_ has joined #ruby
Guedes_out is now known as Guedes
lchin has quit [Ping timeout: 268 seconds]
Spooner has joined #ruby
halfie has joined #ruby
<bobbbo>
cursed ruby, how nasty is doing if (condition) { index = index_to_oneOfManyPosible } .. and from then on just doing array[ index ] ?
metrix has joined #ruby
lggr has quit [Ping timeout: 264 seconds]
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
<Hanmac>
bobbo what are you trying todo? maybe each or each_with_index is better?
spopescu has joined #ruby
spopescu has left #ruby [#ruby]
<metrix>
I am looking through the pathname object to find a way to recursively retrieve children, grand children, great grandchildren etc... of a directory, but I'm don't see a method to do this.. any suggestions?
ananthakumaran1 has quit [Ping timeout: 264 seconds]
<bobbbo>
what I would do is store a reference to which variable it was, and the variable through that reference? Thus avoiding redoing the if logic
balboah has joined #ruby
<bobbbo>
But i'm slowly deciding storing thisVar etc in an array is better any way, and will allow me to more easily get the behaviour I need
lateau has joined #ruby
<metrix>
canton7: Thank you
trevortwining has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
ananthakumaran has joined #ruby
justinmcp has quit [Remote host closed the connection]
justinmcp has joined #ruby
<Spooner>
metrix or Dir.glob("bleh/**/*.frog").each might be simpler, depending on why you are recursing.
tatum_O_o has quit [Remote host closed the connection]
<Hanmac>
Spooner Dir.glob has its own each
<Spooner>
Hanmac: Ack, I always forget that - thanks!
xpen has joined #ruby
Appineer has quit [Remote host closed the connection]
<metrix>
I am writing a quick script to change my working directory to a directory within my source code.. as an example: go lib would go to the first lib directory found
<Spooner>
bobbbo : You probably want a case statement. p = case condition; when CONSTANT1 then thisVar; when CONSTANT2 then thisOtherVar; end
gfontenot has joined #ruby
a_a_g has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 256 seconds]
<Spooner>
bobbbo : Not sure what you mean by the pseudocode inside the loop.
lledet has quit [Quit: lledet]
uris has joined #ruby
<bobbbo>
just reading about the whole object returning nature of the case :)
<bobbbo>
but body of loop can simply be
lledet has joined #ruby
<bobbbo>
array.each do | t |
lledet has quit [Client Quit]
<bobbbo>
p -= random(1,100)
<bobbbo>
end
<bobbbo>
for simplification purposes only, of course.
<bobbbo>
but I want to update the variable that p originated from too
freeayu has quit [Remote host closed the connection]
<Spooner>
What variable did p originate from?
<bobbbo>
declared in the logic done by the if/case
vitoravelino`afk is now known as vitoravelino
<bobbbo>
to allow me to semi-generically handle the host of different variables it could be
<bobbbo>
btw thanks for the tip about the case, that's quite nice. Didn't know it could do that
arya_ has joined #ruby
<Spooner>
Might even be easier to use a Hash if you have a lot of conditions and they are just mappings of constants to constants.
EvanR has joined #ruby
EvanR has quit [Changing host]
EvanR has joined #ruby
carloslopes has joined #ruby
mrdodo has quit [Ping timeout: 244 seconds]
* bobbbo
nods
EvanR has left #ruby [#ruby]
binaryplease has joined #ruby
<bobbbo>
if I was doing essentially, p = index_of_var in the if. then use hash[p] where I have p now..
lggr has joined #ruby
moshee has quit [Ping timeout: 246 seconds]
<Spooner>
Not entirely sure of your use-case, but I think that if p can represent multiple real variables, you just put this into a method and return the value of p at the end. So you'd call it with this to alter the value: my_var = my_meth my_var
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
* bobbbo
bangs his head on the desk
* bobbbo
snuggles Spooner
<bobbbo>
this is more like it !
zmbmartin has joined #ruby
AlbireoX has joined #ruby
<Spooner>
No, I mean you would create a constant hash: MAPPING = { CONSTANT1 => thisVar, CONSTANT2 => thisOtherVar } and then, in the method: p = MAPPING[condition]
<bobbbo>
not quite applicable to my current problem but that sort of thing is great :)
zmbmartin has left #ruby [#ruby]
<Spooner>
Although it is useful to simplify your example in order to ask for help, it can make it a bit harder to make suggestions if it is entirely abstract.
ken_barber has quit [Remote host closed the connection]
philcrissman has joined #ruby
metrix has quit [Quit: ChatZilla 0.9.88.2 [Firefox 15.0.1/20120905151427]]
<Spooner>
You are right, bobbbo, but ||= also works if the value is undefined (which isn't mentioned in that blog :D). x = 12 if x.nil? will fail if x is undefined, but x ||= 12 will set x to 12 if it is nil or if it is undefined.
Nathandim has joined #ruby
* bobbbo
nods
<bobbbo>
super handy shorthand
<m3pow>
hoelzro, how can i find the load path ?
<bobbbo>
how does a value become undefined Spooner ?
<m3pow>
that ruby uses
ttt has joined #ruby
monkegjinni has quit [Remote host closed the connection]
enherit has quit [Read error: Connection reset by peer]
gmci has joined #ruby
<hoelzro>
failshell: key=["root"], I'd key
<hoelzro>
hello CouchDB =)
<hoelzro>
s/key/say/
<failshell>
yes couch hehe
<canton7>
the indication is that that section is unspecified?
thunderstrike has joined #ruby
<failshell>
bad URI(is not URI?):
<canton7>
(as in, in the params bit, anything goes). so it's whatever restrictions your server's putting in place. and i'd quess the same as hoelzro
<Spooner>
bobbbo : Well, I'm actually wrong in this. "z = 12 if z.nil?" _does_ work like "z ||= 12", but if you did just "y.nil?", it would complain that y is undefined.
zz_chrismcg is now known as chrismcg
fyolnish has joined #ruby
Banistergalaxy has joined #ruby
slimjimflim has joined #ruby
<hoelzro>
so it's z = 12 unless defined(z) && !z.nil?
<hoelzro>
right?
AndChat| has joined #ruby
<Xeago>
why not z||=12 ?
monkegjinni has joined #ruby
SCommette has joined #ruby
<slimjimflim>
anybody know where ruby logs live on centos?
<hoelzro>
Xeago: I'm asking if z ||= 12 is equivalent to what I wrote =)
lupine_85 has quit [Changing host]
lupine_85 has joined #ruby
<hoelzro>
slimjimflim: what Ruby program are you running?
lggr has quit [Ping timeout: 248 seconds]
<hoelzro>
Ruby doesn't log things on its own
<slimjimflim>
teamview...rails
jastix has joined #ruby
<slimjimflim>
er redmine
<hoelzro>
depends on your configuration, I suppose
<Spooner>
hoelzro : No, it is z = 12 if !defined?(z) or z.nil? (oh, that is the inverse, isn't it...oops).
sailias has joined #ruby
<slimjimflim>
so should i be looking for teamview logs or rails logs?
<failshell>
do you use Passenger?
tagrudev has quit [Remote host closed the connection]
<Spooner>
However, z = 12 if z.nil? works fine, even if z is undefined, and I do not understand why!
<slimjimflim>
it's running the ruby webserver
<slimjimflim>
started it with: ruby script/server -e production
pskosinski has joined #ruby
<Xeago>
hoelzro: z||=12 equals if (!z) z=12
<hoelzro>
Spooner: well, z = 12 if false brings z into existence in the current scope
<hoelzro>
that's probably why
<hoelzro>
Xeago: thanks
<Xeago>
does an if scope it's contents?
AndChat- has quit [Ping timeout: 252 seconds]
<hoelzro>
no
<Xeago>
so z is accessible outside
<Xeago>
?
<hoelzro>
Ruby's scope works along methods and blocks
<hoelzro>
mhmm
<bobbbo>
orly?
<hoelzro>
yes
<hoelzro>
rly =)
<bobbbo>
:D
<Xeago>
hoelzro: z=12 if (!z)
br4ndon has joined #ruby
ttt has quit [Ping timeout: 260 seconds]
Banistergalaxy has quit [Ping timeout: 268 seconds]
<Xeago>
tho, the return value of (z=12 if(!z)) is different then z||=12 if z is already set
arkiver has quit [Quit: Leaving]
<Xeago>
as z||=abc will always return a value
mmitchell has joined #ruby
ramblex has joined #ruby
lggr has joined #ruby
matthewrobbins has quit [Ping timeout: 244 seconds]
derpops has joined #ruby
und3f has quit [Quit: Leaving.]
Nathandim has quit [Remote host closed the connection]
<Spooner>
12 unless xx (error: undefined) unless yy; yy = 12; end; (error: undefined) zz = 12 unless zz (is fine). Some sort of oddness going on there! I believe it works like that, but I don't understand why the last version works.
<failshell>
ah ah! URI.encore()
<failshell>
s/encore/encode
* hoelzro
wisehs URI.encore were real
<hoelzro>
ugh
<hoelzro>
*wishes
lggr has quit [Ping timeout: 252 seconds]
pricees has quit [Ping timeout: 245 seconds]
TomJ has quit [Quit: TomJ]
quest88_ has joined #ruby
internet_user has joined #ruby
pricees_ has quit [Ping timeout: 268 seconds]
TomJ has joined #ruby
TomJ has joined #ruby
TomJ has quit [Changing host]
lockweel has quit [Quit: ChatZilla 0.9.88.2 [Firefox 15.0.1/20120905151427]]
bluOxigen has quit [Ping timeout: 245 seconds]
k610 has quit [Ping timeout: 260 seconds]
jasonkuhrt has quit [Quit: Leaving...]
Mon_Ouie has joined #ruby
Agis__ has joined #ruby
GoGoGarrett has joined #ruby
chussenot_ has joined #ruby
Agis__ is now known as okeeee
lggr has joined #ruby
fredjean has joined #ruby
stuartrexking has joined #ruby
pricees has joined #ruby
pricees_ has joined #ruby
chussenot has quit [Ping timeout: 264 seconds]
chussenot_ is now known as chussenot
<bobbbo>
is there a "best" way to find all rows from a database where a given column matches a wildcard string?
<Xeago>
yuck
<hoelzro>
bobbbo: a specific column?
<hoelzro>
or any column?
<bobbbo>
specific
<bobbbo>
WHERE name LIKE Bo%
<hoelzro>
selct * from table where column like 'pattern'
<Xeago>
that's yucky
<bobbbo>
so now to try use any fancy ruby.begins
<hoelzro>
umm...
lggr has quit [Ping timeout: 252 seconds]
<hoelzro>
sth = dbh.prepare 'select * from table where column like ?'; sth.execute pattern
<bobbbo>
Is it just a yucky thing to do Xeago?
<Xeago>
if you're doing wildcard search, it's most likely user input
<Xeago>
right?
<Xeago>
like a search for title's
<Xeago>
or usernames
alek_b has joined #ruby
<bobbbo>
something like that yea
Morkel has quit [Quit: Morkel]
<bobbbo>
I'm just curious atm
<Xeago>
you'll hammer your database server down
<bobbbo>
mostly asking if its better to delegate directly to SQL, or try use some ruby wizardry
<Xeago>
look at solr, sphinx, elasticsearch
<Xeago>
don't use a db
_JamieD_ has joined #ruby
<hoelzro>
Xeago: not if your tables are small/well indexed...
ABK has quit [Read error: Connection reset by peer]
lateau has quit [Remote host closed the connection]
<bobbbo>
sounds about right
ABK has joined #ruby
ABK has quit [Read error: Connection reset by peer]
trevortwining has joined #ruby
zommi has joined #ruby
whitenoise has quit [Quit: Leaving]
<bobbbo>
I always feel like I know what I want to do in SQL but should shape it to the ruby way
<bobbbo>
which in truth is how I feel about most of my ruby stuff, as I'm so used to more old school methodologies
<Xeago>
hoelzro: try doing this over a table which size spans ssd's :)
cody- has joined #ruby
asteve has joined #ruby
<Xeago>
neways, off for today
<bobbbo>
:) bb thx for the help
Xeago_ has joined #ruby
davidcelis has quit [Quit: K-Lined.]
cody- has quit [Client Quit]
lggr has quit [Ping timeout: 260 seconds]
Xeago_ has quit [Remote host closed the connection]
arkiver has joined #ruby
failshell has quit [Quit: Lost terminal]
johnlcox has joined #ruby
xyzodiac has joined #ruby
zommi has quit [Ping timeout: 265 seconds]
monkegjinni has quit [Remote host closed the connection]
Nathandim has joined #ruby
workmad3 has joined #ruby
Xeago has quit [Ping timeout: 252 seconds]
lggr has joined #ruby
bartj3 has quit []
senny has quit [Remote host closed the connection]
jprovazn has quit [Quit: Leaving]
stuartrexking has quit [Quit: Leaving...]
quest88_ has quit [Quit: quest88_]
himsin has joined #ruby
Neil_ has joined #ruby
dekroning has joined #ruby
senny has joined #ruby
futini__ has joined #ruby
<dekroning>
I'm getting a "uninitialized Constant" error, when passing a class as argument. Now I would like to see how this object instantiates the class, so I was wondering if there was a way to really see the arguments being passed into a method? because my stack trace isn't showing this
<dekroning>
do I need to use ruby-debug to be able to get down at that level?
<workmad3>
dekroning: is it possible that the class (that I assume you're referencing by name?) hasn't been initialized at the point you're calling the method?
savage- has joined #ruby
deryl has quit [Quit: Leaving.]
cody-- has joined #ruby
rippa has joined #ruby
lggr has quit [Ping timeout: 268 seconds]
davidcelis has joined #ruby
deryl has joined #ruby
banisterfiend` has joined #ruby
mrdodo has joined #ruby
<dekroning>
workmad3: yeah it might be indeed, it's happing in cucumber though, so it should "afaik" require all files under features/ folder
moshee has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
lupine_85 has quit [Ping timeout: 260 seconds]
gregorg_taf has joined #ruby
davidcelis has quit [Client Quit]
gregorg has quit [Read error: Connection reset by peer]
<dekroning>
btw in my gem search I see 3 version: ruby-debug, ruby-debug19 and ruby-debug193 since i'm using ruby version 1.9.3 do I need to use ruby-debug193 ?
maesbn has quit [Remote host closed the connection]
apok has quit [Read error: Connection reset by peer]
xyzodiac has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 256 seconds]
apok has joined #ruby
AndChat| has quit [Ping timeout: 268 seconds]
Synthead has joined #ruby
Banistergalaxy has quit [Ping timeout: 252 seconds]
maesbn has quit [Ping timeout: 252 seconds]
skuul has quit [Quit: So long and thanks for all the fish]
skogis has quit [Remote host closed the connection]
mohits has quit [Read error: Connection reset by peer]
mohits_ has joined #ruby
bier has quit [Quit: Ex-Chat]
chrisbolton has joined #ruby
blendedbychris has joined #ruby
blendedbychris has quit [Changing host]
blendedbychris has joined #ruby
lggr has joined #ruby
justinmcp has quit [Remote host closed the connection]
<fir_ed>
What was the command to find the parent class of a class?
PragCypher has quit [Read error: Connection reset by peer]
justinmcp has joined #ruby
<zipkid>
super?
<hoelzro>
class.superclass?
PragCypher has joined #ruby
arkiver has quit [Ping timeout: 245 seconds]
beneggett has joined #ruby
<dekroning>
is it also possible perhaps to use pry? to see which arguments are passed into a method?
<Spooner>
zipkid : #super calls the method of the same name in the parent class.
savage- has quit [Remote host closed the connection]
gregorg_taf has quit [Changing host]
gregorg_taf has joined #ruby
gregorg_taf is now known as gregorg
gregorg has quit [Read error: Connection reset by peer]
gregorg has joined #ruby
gregorg has quit [Changing host]
gregorg has joined #ruby
arkiver has joined #ruby
ph^ has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 264 seconds]
lupine_85 has joined #ruby
cody-- has quit [Quit: node-irc says goodbye]
cody-- has joined #ruby
ph^ has joined #ruby
ttt has joined #ruby
<bobbbo>
is their a better way to do debug printing than : puts "blah" if debug
ph^ has quit [Remote host closed the connection]
lggr has joined #ruby
hoelzro is now known as hoelzro|away
ph^ has joined #ruby
ph^ has quit [Read error: Connection reset by peer]
<bobbbo>
like make a function dputs that does the check in there etc?
<Spooner>
bobbbo : You can use logger/log4r to have better control over logging. You might also find pry useful for breaking into your program at a point so you can inspect it (binding.pry)
<Spooner>
With log4r, you'd use: info "bleh" or debug "bleh" and set the logging level globaly.
ph^ has joined #ruby
xyzodiac has joined #ruby
ph^ has quit [Remote host closed the connection]
<bobbbo>
hmm nice :)
cody-- has quit [Client Quit]
ph^ has joined #ruby
cody- has joined #ruby
ph^ has quit [Remote host closed the connection]
<Spooner>
Or, to directly answer your question: def debug(value); p "DEBUG: #{value.inspect}" if $debug; end; $debug = true
<Spooner>
When I want a quick debug output, I generally just use: p value (so I can search for " p " to remove them; since all lines are run in Ruby, it is bad form to leave debug messages in Ruby code, unlike, say, if you use the C preprocessor to selectively add them to compilation).
xyzodiac has joined #ruby
xaq has joined #ruby
answer_42 has joined #ruby
xyzodiac has quit [Remote host closed the connection]
ph^ has joined #ruby
JohnBat26 has quit [Ping timeout: 246 seconds]
ph^ has quit [Remote host closed the connection]
ken_barber has joined #ruby
ken_barber has quit [Remote host closed the connection]
ken_barber has joined #ruby
aganov has quit [Quit: aganov]
diegoviola has joined #ruby
WhereIsMySpoon has quit [Changing host]
WhereIsMySpoon has joined #ruby
lggr has joined #ruby
stuartrexking has quit [Client Quit]
carloslopes has quit [Quit: Leaving.]
cj3kim has quit [Quit: This computer has gone to sleep]
apok has quit [Ping timeout: 246 seconds]
tds has joined #ruby
<tds>
join mcgill
beneggett has quit [Quit: Computer has gone to sleep.]
chussenot has quit [Quit: chussenot]
statarb3 has quit [Quit: Leaving]
jasonkuhrt has joined #ruby
cody- has left #ruby [#ruby]
lggr has quit [Ping timeout: 246 seconds]
flype has joined #ruby
chussenot has joined #ruby
ctp has joined #ruby
johnlcox has quit [Ping timeout: 256 seconds]
cody-- has joined #ruby
bluenemo has quit [Read error: Connection reset by peer]
rakuN has quit [Ping timeout: 246 seconds]
cody-- has quit [Client Quit]
br4ndon has quit [Ping timeout: 244 seconds]
cody-- has joined #ruby
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<bobbbo>
sorry for slight delay, but thanks Spooner :)
jasonkuhrt has quit [Ping timeout: 264 seconds]
beneggett has joined #ruby
Bosma has joined #ruby
<bobbbo>
that's essentially what I was going to do. As you say I normally relay on macro hacks and pre processor :p
nat2610 has joined #ruby
lggr has joined #ruby
jjbohn has joined #ruby
cody-- has quit [Remote host closed the connection]
sKeiths has joined #ruby
mrdodo_ has joined #ruby
fredjean has quit [Ping timeout: 252 seconds]
<Spooner>
bobbbo : It is more usual to use TDD/BDD to avoid the need for this sort of tracing (though I still use it plenty :D).
<bobbbo>
Ye on my todo list is to move to a more TDD ruby dev cylce
<bobbbo>
but I only really get chance to use ruby when I'm hacking around at home :p
<bobbbo>
mostly Fortran/C++ at work
<Hanmac>
Spooner & bobbbo: there is a $DEBUG variable which is true when ruby is called with -d
<bobbbo>
(woo Fortran)
<bobbbo>
hmm
<chrisbolton>
Off the top of your head does anyone know the method to remove duplicates in an array?
wallerdev has joined #ruby
<canton7>
uniq ?
<bobbbo>
.uniw
<Hanmac>
chrisbolton: uniq and uniq!
mrdodo has quit [Ping timeout: 260 seconds]
<bobbbo>
ye
<chrisbolton>
Awesome. Thanks everyone.
<bobbbo>
chrisbolton: you don't happen to be from Bristol do you..?
_JamieD_ has quit [Quit: _JamieD_]
<chrisbolton>
bobbbo: Nope. Southern California.
<bobbbo>
phew ^_^
<bobbbo>
I'm sure it's much nicer there too
lggr has quit [Ping timeout: 245 seconds]
<chrisbolton>
Today is going to be a gorgeous day.
dr_bob has quit []
<bobbbo>
thanks for pointing -d out Hanmac
Synthead has quit [Ping timeout: 244 seconds]
peteyg_ has joined #ruby
billycravens has quit [Quit: Leaving...]
fredjean has joined #ruby
dekroning has quit [Ping timeout: 256 seconds]
mahmoudimus has joined #ruby
* lupine_85
learns how to do hot code patches in ruby
<lupine_85>
Do Not Recommend
savage- has joined #ruby
arkiver has quit [Ping timeout: 246 seconds]
xpen has quit [Remote host closed the connection]
balboah has quit [Quit: balboah]
jso has joined #ruby
lggr has joined #ruby
jso has quit [Client Quit]
rjmt_ has quit [Read error: Connection reset by peer]
rjmt_ has joined #ruby
stuartrexking has joined #ruby
<bobbbo>
is that ever that much fun? :D
rakuN has joined #ruby
<bobbbo>
right, I'm off for now, thanks for the help all :)
philcrissman has quit [Remote host closed the connection]
<banisterfiend>
bobbbo no problem, glad to be of assisstance
apok has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
ctp_ has joined #ruby
cody-- has joined #ruby
ctp- has joined #ruby
TomJ has quit [Ping timeout: 252 seconds]
ctp- has quit [Client Quit]
Iszak has quit [Quit: User has gone to sleep.]
TomJ has joined #ruby
TomJ has quit [Changing host]
TomJ has joined #ruby
apok has quit [Remote host closed the connection]
cburyta has quit [Remote host closed the connection]
cj3kim has quit [Quit: This computer has gone to sleep]
luckyruby has quit [Remote host closed the connection]
senny has quit [Remote host closed the connection]
twoism has joined #ruby
mklappstuhl has joined #ruby
cj3kim has joined #ruby
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has quit [Client Quit]
slicslak has joined #ruby
futini__ has joined #ruby
lggr has joined #ruby
a_a_g has joined #ruby
tommyvyo has quit [Quit: Computer has gone to sleep.]
ken_barber1 is now known as ken_barber
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has joined #ruby
RegEchse has quit [Remote host closed the connection]
Vainoharhainen has quit [Quit: Leaving...]
Chryson has quit [Ping timeout: 256 seconds]
Banistergalaxy has joined #ruby
fredjean has quit [Read error: Connection reset by peer]
RegEchse has joined #ruby
tewecske has joined #ruby
tewecske has quit [Max SendQ exceeded]
GoGoGarrett has quit [Remote host closed the connection]
chussenot has joined #ruby
wallerdev has quit [Quit: wallerdev]
apok_ has joined #ruby
flype has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 248 seconds]
gogiel has quit [Ping timeout: 260 seconds]
xaq has joined #ruby
linguini has joined #ruby
mrdodo has quit [Ping timeout: 246 seconds]
mrdodo_ has joined #ruby
apok has quit [Ping timeout: 245 seconds]
apok_ is now known as apok
<linguini>
require "time"; # why is this necessary if time is part of the "ruby core"?
mikepack_ has joined #ruby
<davidcelis>
it isn't
baphled has quit [Ping timeout: 268 seconds]
<linguini>
puts Time.now.iso8601 # only works if I do require "time" ?
stuartrexking has quit [Quit: Leaving...]
fredjean has joined #ruby
ij has quit [Read error: Connection reset by peer]
slicslak has quit [Ping timeout: 256 seconds]
<davidcelis>
=> false
lggr has joined #ruby
<davidcelis>
huh, you're right
<davidcelis>
iso8601 must not be part of core, then
cj3kim has quit [Quit: This computer has gone to sleep]
Bosox20051 has joined #ruby
<linguini>
So, "Time" is core, but some of its methods are not?
flype has joined #ruby
<davidcelis>
which it isn't
<davidcelis>
there's a stdlib Time that reopens Time and adds methods
ij has joined #ruby
stephenjudkins has joined #ruby
slicslak has joined #ruby
pskosinski has quit [Quit: Some alternative (not-controlled-by-fu*up-people) Red Eclipse servers: http://altred.tk/list]
<linguini>
Are there other ways to get more methods in Time?
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has joined #ruby
<linguini>
I notice Time.now.w3cdtf # does not exist even with 'require "time"', though ri mentions it
stephenjudkins has quit [Read error: Connection reset by peer]
slicslak has quit [Client Quit]
guns has joined #ruby
alvaro_o has joined #ruby
<invisime>
linguini: have you looked at strftime?
stephenjudkins has joined #ruby
<linguini>
invisime: Yes, thanks. I'm mostly trying to understand how Ruby's "core" works.
<invisime>
ah. look at source code then. it'll be helpful. :-)
<linguini>
I happened to notice iso8601 was absent, though mentioned by 'ri'.
mklappstuhl has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 248 seconds]
<invisime>
linguini: are you sure you're looking at the same version of code/documentation?
peteyg_ has quit [Ping timeout: 246 seconds]
c0rn_ has joined #ruby
internet_user has quit [Remote host closed the connection]
MasterIdler has joined #ruby
adamkittelson has joined #ruby
<linguini>
invisime: No; I'm not positive. I am on gentoo and using what came with 'emerge'. But my comment on iso8601 above is definitely using the same version of ruby.
monkegjinni has joined #ruby
internet_user has joined #ruby
mrdodo_ has quit [Read error: Connection reset by peer]
c0rn_ has quit [Client Quit]
<invisime>
linguini: you might try checking the versions manually.
blendedbychris has quit [Ping timeout: 246 seconds]
mrdodo has joined #ruby
Rydefalk has quit [Read error: Connection reset by peer]
<linguini>
invisime: How can I find the source code for the core class "Time"?
cj3kim has quit [Quit: This computer has gone to sleep]
cburyta_ has joined #ruby
<Hanmac>
apidock.com/ruby/Time/w3cdtf/class
c0rn_ has joined #ruby
lggr has joined #ruby
hbpoison has quit [Ping timeout: 252 seconds]
<invisime>
linguini: if you installed from source on your machine, you've got a copy somewhere on your file system. (does emerge put the source in some consistent location?) otherwise, there are various version available for viewing online.
mrdodo has quit [Remote host closed the connection]
bricker has joined #ruby
<linguini>
ruby -e 'require "rss"; puts Time.now.w3cdtf' # works
gogiel has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
<GeekOnCoffee>
hint: that's doing it wrong
tommyvyo has joined #ruby
mrsolo has joined #ruby
<linguini>
Hmm. What's the right way?
<GeekOnCoffee>
not including an rss library if you're not doing rss ;)
<linguini>
Hmm. So apparently, what I'm really investigating is 'ri'.
deadghost has quit [Ping timeout: 268 seconds]
deadghost has joined #ruby
<linguini>
And it seems that ri, on my system, tells me of methods that do only exist given certain "require", though it makes no mention of this.
tyfighter has joined #ruby
carloslopes has joined #ruby
<linguini>
Perhaps the Time class is particularly prone to this (?).
ttt has joined #ruby
<linguini>
Maybe I should extend Time myself. def hhmm ; strftime("%H:%M") ; end
jrist is now known as jrist-mtg
lggr has joined #ruby
eldariof has joined #ruby
samflores has joined #ruby
<invisime>
linguini: yeah, something like that might be most correct.
joeycarmello has quit [Remote host closed the connection]
gmci has quit [Quit: Computer has gone to sleep.]
moted has quit [Remote host closed the connection]
Smoth has joined #ruby
mrdodo has joined #ruby
schwap has joined #ruby
billycravens has joined #ruby
cj3kim has joined #ruby
havenn has joined #ruby
cody-- has quit [Remote host closed the connection]
ttt has quit [Ping timeout: 260 seconds]
znow has joined #ruby
<znow>
hey, how can I generate a range that goes from 450 to 1100 and jumps by 50? so 450, 500, 550 etc
mmitchell has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
Use Range#step
moted has joined #ruby
<davidcelis>
Mon_Ouie: i hate it when you're in here, you answer right as i'm typing mine in
<Smoth>
Hello #ruby ! I'm in the needing of doing some http requests, so i've figured out to use the URI object like http://sprunge.us/RJZd but modifying the uri object dosen't work, so maybe someone knows the correct idiom
phinfonet has joined #ruby
tatum_O_o has quit [Remote host closed the connection]
timmow has quit [Quit: is having a nap]
ananthakumaran has quit [Quit: Leaving.]
adeponte has quit [Remote host closed the connection]
RJ3000_ has joined #ruby
rbwsam has joined #ruby
IrishGringo has quit [Remote host closed the connection]
adeponte has joined #ruby
pskosinski has joined #ruby
<Hanmac>
znow & Mon_Ouie & davidcelis: Numeric has step too: 450.step(1100,50) {|e| p e}
<znow>
Hanmac: <3
<znow>
Hanmac: thanks
mroh_ is now known as mroh
<havenn>
znow: Or you could stubbornly refuse to #step: (9..22).map { |n| n * 50 }
ramblex has quit [Remote host closed the connection]
jrajav has joined #ruby
lggr has joined #ruby
fantazo has joined #ruby
mrdodo has quit [Remote host closed the connection]
panpainter has joined #ruby
znow has quit [Quit: Page closed]
internet_user has quit [Remote host closed the connection]
GoGoGarrett has joined #ruby
samflores is now known as samflores|away
lggr has quit [Ping timeout: 240 seconds]
stephenjudkins has joined #ruby
topriddy has left #ruby [#ruby]
nwest has joined #ruby
GoHuyGo has joined #ruby
internet_user has joined #ruby
lggr has joined #ruby
keppy has joined #ruby
Nisstyre has joined #ruby
xaq has quit [Remote host closed the connection]
havenn has quit [Remote host closed the connection]
macmartine has joined #ruby
krawchyk_ has joined #ruby
mikeg has joined #ruby
DrShoggoth has quit [Quit: Leaving]
idletom has joined #ruby
savage-_ has joined #ruby
headius has joined #ruby
Spooner has quit [Ping timeout: 244 seconds]
krawchyk has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 260 seconds]
bluenemo has quit [Remote host closed the connection]
mrdodo has joined #ruby
wallerdev has quit [Quit: wallerdev]
dekroning has joined #ruby
samflores|away is now known as samflores
blendedbychris1 has joined #ruby
blendedbychris has quit [Ping timeout: 252 seconds]
trevortwining_ has joined #ruby
jjbohn has quit [Quit: Leaving...]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
savage- has quit [Ping timeout: 248 seconds]
mrdodo has quit [Remote host closed the connection]
bondar has joined #ruby
cody-- has joined #ruby
apok has quit [Remote host closed the connection]
gmci has joined #ruby
trevortwining has quit [Ping timeout: 245 seconds]
trevortwining_ is now known as trevortwining
apok has joined #ruby
blendedbychris has joined #ruby
blendedbychris has quit [Changing host]
blendedbychris has joined #ruby
jjbohn has joined #ruby
PragCypher has quit [Read error: Connection reset by peer]
lggr has joined #ruby
xanaru has joined #ruby
PragCypher has joined #ruby
mikepack has joined #ruby
blendedbychris1 has quit [Ping timeout: 245 seconds]
Nathandim has joined #ruby
mikepack_ has quit [Ping timeout: 245 seconds]
baphled has joined #ruby
workmad3 has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
liktoj has quit [Remote host closed the connection]
trevortwining has quit [Quit: trevortwining]
baphled has quit [Ping timeout: 264 seconds]
chrisja has joined #ruby
mikepack has quit [Remote host closed the connection]
trevortwining has joined #ruby
mikepack has joined #ruby
baphled has joined #ruby
adeponte has quit [Remote host closed the connection]
schickung has joined #ruby
arya__ has quit [Ping timeout: 256 seconds]
adeponte has joined #ruby
RJ3000_ has quit []
xanaru has quit [Remote host closed the connection]
vitoravelino`afk is now known as vitoravelino
lggr has joined #ruby
c0rn_ has quit [Quit: Lates.]
mikepack has quit [Ping timeout: 244 seconds]
techhelp has joined #ruby
joelsbeard has joined #ruby
ukd1 has joined #ruby
ckrailo has joined #ruby
mohits has quit [Read error: Connection reset by peer]
jerrad has joined #ruby
arya_ has joined #ruby
c0rn_ has joined #ruby
brjannc has joined #ruby
brjannc has quit [Remote host closed the connection]
sn0wb1rd has joined #ruby
cj3kim has quit [Quit: This computer has gone to sleep]
lggr has quit [Ping timeout: 246 seconds]
TomJ has joined #ruby
TomJ has quit [Changing host]
TomJ has joined #ruby
havenn has joined #ruby
dmnd has joined #ruby
dmnd has quit [Changing host]
dmnd has joined #ruby
stkowski has joined #ruby
ttt has joined #ruby
jerrad_ has joined #ruby
<GoHuyGo>
I'm working on a daily problem where you calculate when the best time to sleep is based on an input time of when you want to wake up
lggr has joined #ruby
<GoHuyGo>
shoudl I create an array
<GoHuyGo>
and find all the 90m intervals
<GoHuyGo>
going backwards
jgrevich has joined #ruby
cj3kim has joined #ruby
arya_ has quit [Ping timeout: 248 seconds]
Advocation has joined #ruby
jerrad has quit [Ping timeout: 256 seconds]
ttt has quit [Ping timeout: 260 seconds]
lggr has quit [Ping timeout: 264 seconds]
jgarvey has joined #ruby
jerrad_ has quit [Remote host closed the connection]
d3vic3 has joined #ruby
jerrad has joined #ruby
dekronin1 has joined #ruby
parzo has quit [Ping timeout: 260 seconds]
arya_ has joined #ruby
Virunga has joined #ruby
adeponte has quit [Remote host closed the connection]
arya_ has quit [Client Quit]
horofox has quit [Quit: horofox]
dekroning has quit [Ping timeout: 246 seconds]
Bosox20051 has quit [Quit: Leaving]
lggr has joined #ruby
cody-- has left #ruby [#ruby]
Spooner has joined #ruby
xaq has joined #ruby
thunderstrike has quit [Read error: Connection reset by peer]
brahman has joined #ruby
Dreamer3 has joined #ruby
thunderstrike has joined #ruby
<brahman>
HI, I have writen a class contained within a module. This class needs access to a third party module. I am able o require the 3rd party module however when trying to use the constructor from this module the code errors with undefine constant.
<Spooner>
brahman : Modules don't have constructors.
<brahman>
what is the best practice for using 3rd party modules within your own classes
greg- has joined #ruby
<blazes816>
GoHuyGo: how many intervals?
<brahman>
Spooner: thanks, I understand the diff between modules and classes.
<Mon_Ouie>
Also don't confuse files, modules and classes
<brahman>
typo
lggr has quit [Ping timeout: 260 seconds]
<brahman>
s/3rd party ,module/3rd party class/
<Spooner>
Oh, sorry, you mean #initialize in the module masking the one in the class. Carry on :$
xorigin has joined #ruby
<brahman>
let me see if I can write up an example...
<Spooner>
You don't require in a scope. It is global.
ukd1 has quit [Quit: leaving]
<brahman>
Spooner: Ah.
<Spooner>
In the class you: include ThirdParty::Module
<brahman>
Thanks
<brahman>
Let me try this.
<brahman>
I have been using ruby for 2 days now. it's really neat
Axsuul has joined #ruby
dmnd has quit [Quit: dmnd]
<Spooner>
And in case it isn't just an error in the pastie, classes should be called Something, not something.
aantix has joined #ruby
dekronin1 has quit [Ping timeout: 246 seconds]
maletor has quit [Quit: Computer has gone to sleep.]
krawchyk has joined #ruby
<Spooner>
By 3rd-party module, do you mean a gem?
<brahman>
Spooner: error in pastie...
doomMonkey has quit [Ping timeout: 264 seconds]
<brahman>
Spooner: yes.
<Spooner>
I guessed so, but not sure.
<brahman>
in this case aws-sdk
<brahman>
brb
dekronin1 has joined #ruby
dekronin1 has quit [Client Quit]
Goles has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
Synthead has quit [Read error: Connection reset by peer]
mark_locklear has joined #ruby
okeeee has quit [Quit: okeeee]
wallerdev has joined #ruby
<Spooner>
Yeah, you just require 'aws-sdk' somewhere, usually at the top of the file (out of any scopes). Not sure why you are getting that error though, but I'd look at the line that error comes from, of course.
dekronin1 has joined #ruby
<brahman>
back
krawchyk_ has quit [Ping timeout: 260 seconds]
dekronin1 has quit [Client Quit]
<GoHuyGo>
blazes816: 90m intervals
<brahman>
Going to take a closer look
theRoUS has quit [Remote host closed the connection]
areil has quit [Remote host closed the connection]
<JonValt>
(I'm a total n00b so be gentle with me) - I want to use something like Dir.chdir(ENV['APPDATA']) and include a subdirectory of that. Like the equivilent of %appdata%\Application. My obvious stupid kludges like Dir.chdir(ENV['APPDATA'],"/Application") don't work. Help?
tatum_O_o has joined #ruby
havenn has quit [Remote host closed the connection]
<GoHuyGo>
havenn: nothing really, it's just part of the problem
maletor has joined #ruby
<GoHuyGo>
The human body goes through 90 minute sleep cycles during the night, and you feel more refreshed if you wake up at the end of a sleep cycle than if you wake up during a sleep cycle. The challenge is to make a program that takes a wake-up time and outputs the possible times to fall asleep so that you will wake up at the end of a sleep cycle.
adeponte has quit [Remote host closed the connection]
<znow>
Spooner: |d|?? or isnt it |s| ? ;)
<Spooner>
YEs, sorry, typo.
lggr has joined #ruby
axl_ has quit [Quit: axl_]
cburyta has quit [Read error: Connection reset by peer]
emmanuelux has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
<znow>
Spooner: thanks mate
stkowski has joined #ruby
cody-- has joined #ruby
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
allyraza has joined #ruby
troii has joined #ruby
zodiak has quit [Ping timeout: 272 seconds]
ttt has joined #ruby
tro11 has joined #ruby
<tro11>
hi all
xorigin has quit [Quit: leaving]
lggr has quit [Ping timeout: 256 seconds]
<tro11>
anyone here?
<horofox>
where does my shared examples should go in rspec? (which file)
cakehero has quit [Quit: Computer has gone to sleep.]
CoverSlide has left #ruby [#ruby]
<troii>
tro11 hi
<tro11>
hi troii
* Hanmac
is now known as no-one, and says to tro11: "no-noe is there"
<Spooner>
Hi tro11 - just ask your question. There are 100s of people in here, who don't all need to say hello to everyone ;)
cakehero has joined #ruby
<allyraza>
I have seen in lot of libs what exactly does it mean why do devs use underscore @_instance
<tro11>
whats the closest to ajax for ruby?
<tro11>
parse a restful rspec file into a class that can read xml in the matching format
Jay_Levitt has joined #ruby
<Mon_Ouie>
allyraza: That may perhaps be used in a mixin that needs states, to avoid name conflicts (though mixins that have states aren't that great an idea in the first place)
adeponte has joined #ruby
ttt has quit [Ping timeout: 240 seconds]
<Mon_Ouie>
In other contexts, it's pointless
samflores|away is now known as samflores
<allyraza>
Mon_Ouie: I have seen it being used in classes
<tro11>
whats the simplest way to map a formated xml file to a ruby class so it can be parsed, modified, and recreated etc?
<Hanmac>
there are 230860 hello user comibnations: 680.times.to_a.combination(2).count
<troii>
ruby guys, i think tro11 needs some help
<Hanmac>
tro11 nokogiri is cool for xml parsing
chessguy has joined #ruby
<tro11>
thanks Hanmac
cody-- has quit [Quit: node-irc says goodbye]
<troii>
is that japanese?
<tro11>
looks that way
lggr has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
banisterfiend has quit [Ping timeout: 246 seconds]
<brahman>
Spooner: When I initalize the ec2 object, "ec2 = AWS::EC2.new" my program assumes that AWS::EC2.new is a submodule of my A module, ie A::AWS::EC2.new. How can I specify the top of the name space? ie no A:: before the AWS::EC2
<Hanmac>
only the name
Synthead has joined #ruby
<tro11>
does my name look strange here?
<brahman>
Not sure if that makes any sense.
Emmanuel_Chanel has joined #ruby
<Spooner>
brahman : The error isn't too clear. It looks for the constant, AWS::ECS in several places, both in the global scope and in the A module where the code is being run.
rubious has quit [Quit: Leaving...]
<Hanmac>
tro11 i have seen more worse names than yours
<tro11>
really?
<tro11>
have any examples Hanmac?
cakehero has quit [Quit: Computer has gone to sleep.]
mrdodo has joined #ruby
<brahman>
Mmm. Going to refactor from scratch in a more simple way. I think I got carried away... ;-)
fredjean has quit [Ping timeout: 246 seconds]
<Hanmac>
"banisterfiend" is a nick you can be scared of
<Spooner>
brahman : That class should be available if you have required the gem.
lggr has quit [Ping timeout: 264 seconds]
<tro11>
I should use that name
doomMonkey has joined #ruby
<tro11>
worst I saw was "stabnburn"
yalue has quit [Quit: Leaving]
<Spooner>
Worst was whoever that gimp was who set up an echo bot in here the other day.
cburyta has joined #ruby
<tro11>
robots are a category that goes beyond having a bad name
<brahman>
Spooner: Ok, If I remove the modules it works as a class.
<brahman>
I think I might be getting warmer...
<GoHuyGo>
RubyPanther: I was able to enter the date as a DateTime using...
<GoHuyGo>
time = DateTime.strptime(gets, '%I:%M %p').to_time
kirun has joined #ruby
<Spooner>
RubyPanther's answer would allow the user more options on how to enter the time. That one I gave depends on an exact format.
delinquentme has joined #ruby
<delinquentme>
this if !params[:site].nil? ... this is a Not nil?
<Muz>
Yes.
<RubyPanther>
There are also potential TZ issues if not specified in the input
<Spooner>
i.e DateTime.parse "17:40" and DateTime.parse "5:40 PM" would work with #parse.
nwest has quit [Quit: Computer has gone to sleep.]
SCommette has quit [Quit: SCommette]
xclite has quit [Remote host closed the connection]
sepp2k1 has quit [Remote host closed the connection]
<troii>
tro11 your name is not bad
<tro11>
is this better than mynameisdeleted?
mikepack has joined #ruby
<troii>
i dont think so
baphled has quit [Ping timeout: 245 seconds]
rubious has joined #ruby
greg has quit [Quit: Leaving...]
wmoxam_ has joined #ruby
cburyta has quit [Read error: Connection reset by peer]
lggr has joined #ruby
cburyta has joined #ruby
tr4656 has quit [Read error: Operation timed out]
<Spooner>
delinquentme : There is a difference between if !params[:site].nil? and if params[:site] - the answer is different if the value is false.
linoj has quit [Ping timeout: 246 seconds]
cakehero has joined #ruby
cburyta has quit [Read error: Connection reset by peer]
cburyta has joined #ruby
mrdodo has quit [Read error: Connection reset by peer]
cj3kim has quit [Quit: This computer has gone to sleep]
cburyta has quit [Read error: Connection reset by peer]
Vinzgore has quit [Ping timeout: 245 seconds]
cburyta has joined #ruby
mrdodo has joined #ruby
<delinquentme>
Spooner, so the first would eval as true and the second would eval as false
xaq has quit [Remote host closed the connection]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
* delinquentme
dances ! ... hesitantly
chessguy has quit [Remote host closed the connection]
<delinquentme>
yeah bc false != nil
mikepack has quit [Ping timeout: 240 seconds]
troii has left #ruby [#ruby]
<Spooner>
Yep.
nanderoo has left #ruby [#ruby]
dmnd has joined #ruby
dmnd has quit [Changing host]
dmnd has joined #ruby
hoelzro|away is now known as hoelzro
lggr has quit [Ping timeout: 246 seconds]
schickung has joined #ruby
<brahman>
Spooner: ok, so I had a clash in namespace AFAIK. my full namespace path was: CompanyName::AWS. So am assuming there was issues when I was requiring AWS::EC2 within CompanyName::AWS.
davidcelis has quit [Quit: K-Lined.]
davidcelis has joined #ruby
<brahman>
Moved the namepsace to CompanyName::Cloud and it works as expected...
<brahman>
Meh.
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
<brahman>
Spooner: thanks for your help this evening.
<CodeVision>
how do i pass a single argument with spaces as command (argument) to Process.spawn?
<delinquentme>
isnt there some double ## + string that highlights differently in ruby? I thought it was something like ##FIX THIS
AndChat| has joined #ruby
<delinquentme>
... yes I know this is per IDE / text editor
AndChat- has joined #ruby
<hoelzro>
CodeVision: specify your command as an array rather than a string
lledet has quit [Ping timeout: 246 seconds]
lledet_ is now known as lledet
timonv has quit [Remote host closed the connection]
Elico1 has joined #ruby
dmiller has joined #ruby
pricees_ has quit [Ping timeout: 268 seconds]
<Elico1>
anyone knows of a good regexp validator?
<davidcelis>
Elico1: rubular.com
<CodeVision>
hoelzro: yeah that's what i figured, but doesn't seem to work, guess im doing something wrong, ill experiment some more :)
dmiller has quit [Remote host closed the connection]
nga4 has quit []
ttt_ has joined #ruby
Banistergalaxy has quit [Ping timeout: 245 seconds]
karakedi has quit [Ping timeout: 240 seconds]
shiki has quit [Remote host closed the connection]
AndChat| has quit [Ping timeout: 268 seconds]
xyzodiac has joined #ruby
lggr has joined #ruby
hoelzro is now known as hoelzro|away
BigFatFatty has joined #ruby
gfontenot has quit []
Samanagh has joined #ruby
GoHuyGo has quit [Quit: Leaving]
lledet has quit [Read error: Connection reset by peer]
lledet has joined #ruby
Criztian has joined #ruby
Smoth has quit [Remote host closed the connection]
ttt_ has quit [Ping timeout: 260 seconds]
futini__ has quit [Quit: Lost terminal]
Chryson has joined #ruby
gnarmis has joined #ruby
gnarmis has left #ruby [#ruby]
wpaulson has joined #ruby
maletor has quit [Ping timeout: 252 seconds]
wpaulson has quit [Client Quit]
dakine has quit [Remote host closed the connection]
rakuN has quit [Quit: rakuN]
lggr has quit [Ping timeout: 264 seconds]
havenn has joined #ruby
maletor has joined #ruby
jroes has joined #ruby
sailias has quit [Quit: Leaving.]
<jroes>
anyone have any hotel recommendations for rubyconf this year? looks like the grand hyatt is sold out on the last night, and there are no evening flights home for me
lggr has joined #ruby
ken_barber has quit [Remote host closed the connection]
stephenjudkins has joined #ruby
<alphabitcity>
i included a module in a class — trying to figure out how to access the including class' name outside of an instance method .. in the instance methods defined in the module, i am able to do self.class.name. any ideas?
jimeh has joined #ruby
ken_barber has joined #ruby
parzo has quit [Quit: Leaving.]
yaymukund has joined #ruby
pettsson_ has quit [Remote host closed the connection]
<workmad3>
Muz: that's a case of trying to use a right-value as a left-value ;)
<bricker>
jeez you guys
<bricker>
It was just a question
Averna has joined #ruby
Averna has quit [Max SendQ exceeded]
<workmad3>
bricker: yeah, and we're not sure what the hell you're actually asking
<rking>
bricker: One that still hasn't been explained.
<TTilus>
bricker: without code sample we are just guesssing here
Averna has joined #ruby
<Muz>
Ultimately, it sounds like it's either a problem with Rails, or your Rails related code. At least, going by the example given. #RubyOnRails may be a better place to air this specific example.
<bricker>
TTilus: there is no code sample
<workmad3>
bricker: can you give us a code example of what you mean though?
<deryl>
in my gem I'm using ARGV (via ARGV.shift). In my specs and features doing a 'p ARGV.inspect' shows the filename of the spec or feature file being currently run. I need to fake (or otherwise replace) the data in ARGV. Is this even possible? Is there a gem I could use for faking ARGV just for use in tests?
<TTilus>
bricker: no code?!
<bricker>
workmad3: No, I think I am just saying the wrong thing
<rking>
There's a saying from Strunk & White, "If you don't know how to say a word, say it loud!" That's kind of what you did. =) (So it's a good thing, as long as you learn from it)
<workmad3>
bricker: such as a code example of what you mean by 'assigning the headers hash'
<bricker>
lol
<bricker>
fucking forget it
rakunHo has joined #ruby
<rking>
deryl: Why not just assign over it?
<bricker>
I've never seen a group of people so eager to help in this channel
<Muz>
deryl: ARGV = [whatever, you, want]
<rking>
deryl: Or use a 3rd thing, like @argv = ARGV then override it for the tests.
adeponte has quit [Remote host closed the connection]
<workmad3>
deryl: better yet... remove the explicit dependency on ARGV
<deryl>
that won't crapcan the test currently being run? (Didn't try it because i didn't want to trash my tests and wasn't sure of the consequences)
<rking>
Yeah. Right. TheGem::CLI.run ARGV in bin/thegem
<workmad3>
^^ that sort of thing
dmiller has joined #ruby
adeponte has joined #ruby
<workmad3>
bricker: we were just curious what exactly you meant by 'actually immutable'
<deryl>
ok, will look into CLI.
lggr has joined #ruby
<workmad3>
bricker: incidentally, the closest, I believe, you can get to 'immutable' in ruby is to freeze an object... and if you try to modify a frozen object then ruby *will* complain
<bricker>
workmad3: I was confused and said the wrong thing. I was trying to assign `headers` in a controller - and it wasn't doing anything so I thought "it must be immutable", but it turns out that `headers` is the request headers (now I know)
<workmad3>
bricker: heh :)
havenn has quit [Ping timeout: 245 seconds]
<deryl>
workmad3: the explicit comes from trollop. not sure how i would override that usage pattern, but I'll definitely look into it. Even to my newbieness, that seems 'brittle'
<workmad3>
deryl: wrap it in a method that takes an argument, call the argument 'argv' and then pass in ARGV in your bin-script
<workmad3>
deryl: and then in a test, pass in a different array ;)
derpops has joined #ruby
<deryl>
ahhh. hehe that so never entered my mind :) glad I ask questions!
timrom has quit [Ping timeout: 246 seconds]
<workmad3>
deryl: and then adjust any reference to ARGV to point to argv :)
xyzodiac has quit [Quit: Computer has gone to sleep.]
Solnse has quit [Ping timeout: 256 seconds]
Nathandim has quit [Remote host closed the connection]
<deryl>
got it. added to the project TODO. Thanks for the advise.
<deryl>
err advice
dmiller has quit [Ping timeout: 268 seconds]
lggr has quit [Ping timeout: 244 seconds]
<workmad3>
also, the trollop parse method (from my quick google) is defined with 'def parse cmdline=ARGV', you could follow a similar idea
<deryl>
yeah i;ll have to revisit the trollop code. there's my after dinner mint it seems hehe
Synthead has quit [Quit: p33 ba115]
<workmad3>
same with options... def options args=ARGV, *a, &b
stkowski has quit [Quit: stkowski]
timrom has joined #ruby
hbpoison has joined #ruby
cburyta has joined #ruby
bier has quit [Ping timeout: 245 seconds]
joelsbeard has joined #ruby
<deryl>
wait, you can use the splat *before* a block? doesn't splat soak *everything* up not caught by any prior var?
lggr has joined #ruby
<deryl>
or am i confusing myself there?
<workmad3>
block arg is special
<deryl>
ah
invisime has quit [Quit: Leaving.]
<deryl>
so many little things hehe
<workmad3>
:)
<deryl>
ok, off to do some reading. thank you all for the suggestions. &
sagax has quit [Quit: Ухожу я от вас]
<workmad3>
still looking at your code... if you altered your parse_cmds method to be something like 'def self.parse_cmds(args=ARGV)'
<workmad3>
and then adjusted line 69 to use args instead of ARGV, and passed in 'args' as the first param to all your Trollop::options calls
hadees has quit [Quit: hadees]
lledet has quit [Quit: lledet]
<deryl>
nice!
<workmad3>
I'd also suggest that you make it a non-static method btw
Nisstyre-laptop has joined #ruby
<workmad3>
and instantiate an OptionsParser that storts @cmd and @cmd_opts
<deryl>
don't know what you mean by that
budha has quit []
<deryl>
the non-static
<workmad3>
at the moment you're storing @cmd and @cmd_opts as class-instance variables
hbpoison has quit [Ping timeout: 245 seconds]
<deryl>
right
<workmad3>
you should either make them local variables, or treat OptionsParser as a more normal class, IMO
beneggett has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 256 seconds]
<deryl>
i tried the local, and confused the hell out of myself on how to keep passing them around (like to the Dtf::Command class methods)
<deryl>
and what do you mean by 'more normal class'?
alphabitcity has joined #ruby
<deryl>
i might have to revisit TWGR methinks.
<workmad3>
so rather than OptionsParser.parse_cmd, you'd do parser = OptionsParser.new; parser.parse_cmd(ARGV)
alphabitcity has quit [Client Quit]
<deryl>
ohhhh
<workmad3>
and then you'd pass the parser around, and objects would query it for the cmd and options
<deryl>
i was thinking that doing that was a redundancy that was against 'good style'
<deryl>
so i nixed that early on
<deryl>
thats why i've been trying to stick with *just* calling the classes directly and limit instances except for the case of the models themselves
<deryl>
was i wrong in that line of thinking?
<workmad3>
it's just that right now you'd have an issue in the (I admit unlikely) event of multiple threads being inside the parse_cmd method at the same time
<deryl>
or am i just crossing a 'it makes more sense this way' line?
joeycarmello has quit [Remote host closed the connection]
<deryl>
hrmm.
<workmad3>
it's a bit of a mix in all honesty, I'm not sure if I'd go the instance route or the non-ivar route with this atm
bananagram has quit [Ping timeout: 252 seconds]
<workmad3>
but I wouldn't store data in class ivars like that
<deryl>
going to copy this part of the conversation to the TODO file to redigest later. some of its a bit confusing on a fast think
jenrzzz has quit [Ping timeout: 256 seconds]
frogprince_mac has quit [Quit: Leaving...]
<workmad3>
at least, not without giving it careful thought :)
<rking>
I wouldn't worry about being good OO as much as being simple: simple to understand, simple as in DRY. If OO stuff helps that, great.
<deryl>
hehe. well my personal goal is to take what i learn in the classes, apply them to dtf, and bounce where i get confused off you guys.
chrisbolton has quit [Quit: chrisbolton]
<blazes816>
lol @ class-oriented programming
<rking>
blazes816: Hehehaha
<rking>
blazes816: I mean, Perl has some positives, but its kludgey objects are not one of them.
<blazes816>
now they only teach 'pseudo oop' i.e. no actually programming
<rking>
blazes816: Permission to burn school down: granted.
<blazes816>
rking: I love perl, but i would definitely not consider it naturally oop
<RubyPanther>
I'd rather use Perl than Java, if done correctly, but like Saint Wall said, "If you want to do everything using OOP then Ruby is a better language than Perl."
<blazes816>
haha, that's why I dropped out
<workmad3>
rking: I agree when actually applying... however when teaching, I prefer a more exaggerated approach that emphasises the aspects you're trying to foster in a particular paradigm
sent-hil has quit [Remote host closed the connection]
timrom has joined #ruby
<deryl>
lurking for the moment. want to soak in as you discuss. at the stage where i'm confused on things but not sure why or exactly where.
<rking>
workmad3: What OO ideas do you believe are like that?
neurotech has joined #ruby
<deryl>
(conceptually as well as code)
jenrzzz has joined #ruby
<shevy>
rking sure. thing is, part of the code is like ... 3 or 4 years old by now. I am mostly just maintaining things... when it is fun... somehow there are conflicting ways to solve something... somehow I need to find a better way to fix bugs and add new things, without having to spend minutes trying to find the file in question where the bug could be.
lggr has quit [Ping timeout: 246 seconds]
seanstickle has joined #ruby
derpops has quit [Ping timeout: 248 seconds]
<workmad3>
rking: for starters, just the concept of an 'object'
cardoni has joined #ruby
<workmad3>
personally, for an OO course, I'd probably go with smalltalk, ruby or maybe scala nowadays
monkegjinni has quit [Remote host closed the connection]
<rking>
Scala? Interesting.
<blazes816>
erlang
<workmad3>
languages where you have more of a concept of an 'object' divorced from a class
<rking>
Ah
<rking>
JavaScript?
<workmad3>
possibly
tommyvyo has joined #ruby
tommyvyo has quit [Changing host]
tommyvyo has joined #ruby
derpops has joined #ruby
linoj has joined #ruby
<rking>
workmad3: If you can elaborate on the class-oriented programming vs. "object divorced from a class", I'd like to confirm I have any clue what you mean by the latter being superior to teach.
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has joined #ruby
monkegjinni has joined #ruby
<workmad3>
rking: well, with a language like java you have to create a hierarchy of classes in order to do anything meaningful
havenn has joined #ruby
<workmad3>
rking: which moves the focus onto creating an elaborate, 'correct' class (or type) hierarchy rather than focusing on getting the objects themselves doing what you want
ssspiff has joined #ruby
ssspiff has quit [Changing host]
ssspiff has joined #ruby
hadees has joined #ruby
<workmad3>
rking: it is, after all, *object* oriented programming... classes are a useful categorisation, but you should be able to do without them
mmitchell has quit [Remote host closed the connection]
<rking>
Isn't that an issue of static typing vs Duck Typing?
apok has quit [Remote host closed the connection]
sspiff has quit [Ping timeout: 244 seconds]
apok has joined #ruby
<workmad3>
not really
<workmad3>
scala lets you deal with objects while still being statically typed
parzo has joined #ruby
<rking>
I need a better opposite of "Duck Typing"
<workmad3>
dynamic typing is the classic example
<rking>
It's like "implicit interfacing" or something
linoj has quit [Client Quit]
parzo has quit [Client Quit]
lggr has joined #ruby
<workmad3>
besides, C++ lets you do duck-typing in templates ;)
derpops has quit [Ping timeout: 245 seconds]
horofox has quit [Quit: horofox]
nari has joined #ruby
swarley_ has joined #ruby
havenn has quit [Ping timeout: 246 seconds]
cardoni has quit [Ping timeout: 264 seconds]
specialGuest has quit [Quit: WeeChat 0.3.8]
<shevy>
argh
baphled has quit [Ping timeout: 246 seconds]
<rking>
workmad3: That's true, but working with them sucked bad (so many limitations, terribly mangled symbols in backtraces, etc.) I think C++11 fixes some of the terribleness.
uris has quit [Ping timeout: 268 seconds]
wereHamster has quit [Read error: Operation timed out]
<rking>
Especially as a teaching tool, I wouldn't want to have to explain templates vs. plain old Duck Typing.