apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
emmanuelux has joined #ruby
ramblex has quit [Quit: ramblex]
jimeh has quit [Ping timeout: 250 seconds]
rasbonics has quit [Quit: rasbonics]
iocor has quit [Quit: Computer has gone to sleep.]
b1rkh0ff has quit [Ping timeout: 245 seconds]
asuka_ has quit [Read error: Operation timed out]
Asher1 has joined #ruby
voodoofish4301 has joined #ruby
andrew__ has quit [Remote host closed the connection]
Asher has quit [Ping timeout: 250 seconds]
asuka_ has joined #ruby
tomzx has joined #ruby
voodoofish430 has quit [Ping timeout: 240 seconds]
libertyprime has quit [Quit: Lost terminal]
libertyprime has joined #ruby
gtuckerkellogg has joined #ruby
gtuckerkellogg has quit [Client Quit]
thecreators has joined #ruby
cableray has joined #ruby
thecreators has quit [Remote host closed the connection]
khakimov has joined #ruby
libertyprime has quit [Quit: Lost terminal]
amalvagomes has joined #ruby
libertyprime has joined #ruby
berserkr has quit [Quit: Leaving.]
kenichi has quit [Remote host closed the connection]
fmcgeough has joined #ruby
jgrevich has quit [Quit: jgrevich]
adfdfgsdh has joined #ruby
<adfdfgsdh>
what is the meaning of it all?
libertyprime has quit [Client Quit]
<seanstickle>
No meaning at all.
<adfdfgsdh>
getting up ridiculously early in the morning, working at an unfulfilling job, coming home and having to go to sleep early to be able to run the course the next day. Why?
tayy_ has joined #ruby
libertyprime has joined #ruby
stkowski has quit [Quit: stkowski]
<seanstickle>
No reason.
thecreators has joined #ruby
Kabaka has quit [Ping timeout: 276 seconds]
<adfdfgsdh>
I cannot take another day of this pain.
icy` has quit [Remote host closed the connection]
<adfdfgsdh>
I broke my leg recently in a car accident. I was drinking one too many, and I strayed over to the left lane. I had a head on collision with some woman, she died.
libertyprime has quit [Client Quit]
tayy has quit [Ping timeout: 248 seconds]
libertyprime has joined #ruby
* Muz
fails to see how any of this is interesting, or relevant to this channel.
<seanstickle>
Yeah...
<adfdfgsdh>
me being in pain isn't uninteresting
<adfdfgsdh>
I just want to know how do I make it stop? how do I stop this pain?
shevy has quit [Ping timeout: 248 seconds]
tomb_ has joined #ruby
AzizLight has quit [Ping timeout: 260 seconds]
brianpWins has quit [Quit: brianpWins]
vitor-br has joined #ruby
ilyam_ has joined #ruby
noganex has quit [Ping timeout: 245 seconds]
vitor-br has quit [Remote host closed the connection]
<davidcelis>
include that in EVERY PROJECT. trust me. i'm from the internet.
<alegacyreborn>
lol
<alegacyreborn>
I wish I understood that code but I am just beginning to learn Ruby
tayy_ has quit [Remote host closed the connection]
Guest92523 has quit [Quit: /quit]
<davidcelis>
it basically instantiates an object to pass the inverse of a message to the original object
alindeman has joined #ruby
<davidcelis>
so you can do `1.not == 2` instead of `1 != 2`
<davidcelis>
because i fucking hate bangs
nobitanobi has quit [Quit: Leaving.]
nobitanobi has joined #ruby
shevy2 has joined #ruby
BrokenCog has joined #ruby
mikeycgto has joined #ruby
mikeycgto has quit [Changing host]
mikeycgto has joined #ruby
<davidcelis>
so 1.not creates a NotClass, which then sends the negation of any passed message (in this case =ツ to the base object (in this case the 1 Fixnum)
<adfdfgsdh>
can anyone tell me how i can make the pain stop?
<davidcelis>
adfdfgsdh: vicodin
adamkittelson has quit [Remote host closed the connection]
<adfdfgsdh>
can't, my doctor won't prescribe them to me.
adfdfgsdh has left #ruby ["Leaving"]
TaTonka has joined #ruby
keppy has quit [Read error: Operation timed out]
ilyam has quit [Quit: ilyam]
looopy has joined #ruby
wilmoore has quit [Remote host closed the connection]
digitalcakestudi has quit [Quit: Leaving.]
g0bl1n has joined #ruby
g0bl1n has quit [Changing host]
g0bl1n has joined #ruby
davidcelis has quit [Quit: K-Lined]
nej has quit [Quit: Leaving...]
flip_digits has joined #ruby
dbgster has quit [Quit: dbgster]
chson has joined #ruby
nobitanobi has quit [Quit: Leaving.]
liluo has quit [Remote host closed the connection]
<shadoi>
I thought that was a bit harsh, then I looked at it.
<krz>
hm i guess i can assign it to a var
jrist-afk is now known as jrist
<seanstickle>
shadoi: ha
<shadoi>
krz: there's no award for keeping everything on one line.
<shadoi>
break it up, make it readable.
jrist is now known as jrist-afk
Hanmac has quit [Ping timeout: 252 seconds]
Hanmac has joined #ruby
headius has quit [Quit: headius]
td123 has quit [Quit: WeeChat 0.3.7]
aantix has quit [Quit: aantix]
niklasb has quit [Read error: Operation timed out]
dv310p3r has joined #ruby
dnyy has quit [Remote host closed the connection]
billiamii has quit [Read error: Connection reset by peer]
<krz>
bnagy: you in? what we spoke about yesterday. given i have the following data: https://gist.github.com/2822101 is it possible to remove any "visits" with minute > 209?
jonathanwallace has joined #ruby
davidcelis has joined #ruby
<krz>
or anyone?
libertyprime has quit [Quit: Lost terminal]
libertyprime has joined #ruby
Urth|Away is now known as Urthwhyte
dnyy has joined #ruby
RudyValencia has quit [Read error: Connection reset by peer]
jcromartie_ has joined #ruby
RudyValencia- has joined #ruby
jenrzzz-mac has quit [Quit: jenrzzz-mac]
<krz>
so far. I've got this: @activity_feeds.each {|k| k['visits'].delete_if {|x| x['minute'] >= 209 } } doesn't seem like its doing it. but at the same time i get no error
hakunin has quit [Read error: Connection reset by peer]
adeponte has quit [Remote host closed the connection]
jcromartie has quit [Ping timeout: 252 seconds]
jcromartie_ is now known as jcromartie
<GeekOnCoffee>
krz: is it coming from ActiveRecord?
<krz>
GeekOnCoffee: no mongodb
<krz>
well yea AR
<krz>
i mean mongoid
albemuth has joined #ruby
libertyprime has quit [Quit: Lost terminal]
libertyprime has joined #ruby
liluo has joined #ruby
hakunin has joined #ruby
jenrzzz-mac has joined #ruby
alexim has quit [Ping timeout: 240 seconds]
jenrzzz-mac has quit [Read error: Connection reset by peer]
<krz>
ok @activity_feeds.entries.each { |k| puts k['visits'].each { |k2| k['visits'].delete_if { |x| x['minute'] >= 209 } } } works. but its going through two each loops. any way i can write this better?
nfluxx has quit [Read error: Operation timed out]
g0bl1n has quit [Ping timeout: 252 seconds]
jenrzzz-mac has quit [Ping timeout: 260 seconds]
jenrzzz-mac_ has quit [Ping timeout: 240 seconds]
tfitts has quit [Ping timeout: 246 seconds]
c0rn has joined #ruby
nfluxx_ has quit [Ping timeout: 252 seconds]
tewecske has quit [Quit: Leaving.]
<krz>
is sort and sort_by the same?
straind has joined #ruby
seanstickle has quit [Quit: Nihil sub sole novum]
<krz>
dammit. ruby is just elfin amazing
<krz>
effin*
<krz>
i love one liners
tfitts has joined #ruby
cantonic has quit [Remote host closed the connection]
<shadoi>
lulz
dbgster has joined #ruby
xnm has quit [Quit: WeeChat 0.3.7]
albemuth has quit [Quit: Computer has gone to sleep.]
kevinbond has quit [Quit: kevinbond]
libertyprime has quit [Quit: Lost terminal]
libertyprime has joined #ruby
test34- has quit [Ping timeout: 252 seconds]
nej has quit [Quit: Leaving...]
<alegacyreborn>
Cya everybody
alegacyreborn has quit [Quit: Leaving]
wilmoore has joined #ruby
yankov has joined #ruby
kah_ has joined #ruby
choffstein has quit [Remote host closed the connection]
albemuth has joined #ruby
_blackbird is now known as radmacd
bricker88 has quit [Quit: Leaving.]
albemuth has quit [Client Quit]
test34 has joined #ruby
test34 has quit [Changing host]
test34 has joined #ruby
Araxia_ has quit [Quit: Araxia_]
test34- has joined #ruby
test34- has quit [Changing host]
test34- has joined #ruby
test34 has quit [Ping timeout: 248 seconds]
jonathanwallace has quit [Read error: Connection reset by peer]
thecreators has quit [Quit: thecreators]
jonathanwallace has joined #ruby
wvdschel has joined #ruby
cantonic has joined #ruby
benyarb has quit [Ping timeout: 244 seconds]
busybox42 has quit [Ping timeout: 245 seconds]
G has quit [Remote host closed the connection]
sspiff has quit [Ping timeout: 252 seconds]
dv310p3r has quit [Ping timeout: 246 seconds]
jodell has quit [Remote host closed the connection]
benatwork has joined #ruby
cryptfu has joined #ruby
benyarb has joined #ruby
billiamii has joined #ruby
sbanwart has quit [Ping timeout: 260 seconds]
c0rn has quit [Quit: Computer has gone to sleep.]
jchauncey has joined #ruby
jchauncey has quit [Client Quit]
digitalcakestudi has joined #ruby
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
benatwork has quit [Ping timeout: 246 seconds]
kah1 has joined #ruby
x0F_ is now known as x0F
kah1 has quit [Remote host closed the connection]
jamesaxl has quit [Ping timeout: 252 seconds]
AlbireoX`Laptop has joined #ruby
kenneth has quit [Quit: kenneth]
mikepack has quit [Read error: Connection reset by peer]
dv310p3r has joined #ruby
theRoUS_ has joined #ruby
cbuxton1 has joined #ruby
dhaskew_ has joined #ruby
dhaskew has quit [Read error: Connection reset by peer]
dhaskew_ is now known as dhaskew
ghosTM55 has joined #ruby
dhaskew has quit [Read error: Connection reset by peer]
dhaskew_ has joined #ruby
dhaskew has joined #ruby
dhaskew_ has quit [Read error: Connection reset by peer]
cbuxton has quit [Ping timeout: 245 seconds]
ten00 has joined #ruby
counterbeing has quit [Quit: Computer has gone to sleep.]
busybox42 has joined #ruby
apok has quit [Quit: apok]
ten00 has quit [Client Quit]
kenneth has joined #ruby
kenperkins has joined #ruby
Karmaon is now known as doesUbuntuHateAw
Asher1 has quit [Quit: Leaving.]
doesUbuntuHateAw is now known as AwayNickAwayNick
Asher has joined #ruby
AwayNickAwayNick is now known as Karmaon
bambanx has joined #ruby
kenperkins has quit [Client Quit]
<bambanx>
hey guys
freeayu__ has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
<freeayu__>
what's the symbol if line =~ /m./
<freeayu__>
if line =~ /m./
<freeayu__>
if line =~ /m./
<freeayu__>
if line =~ /m./
<freeayu__>
what's the symbol "~" in the "if line = ~ /m./"
freeayu__ has quit [Killed (idoru (Spam is off topic on freenode.))]
cousine has quit [Remote host closed the connection]
dv310p3r has quit [Ping timeout: 246 seconds]
libertyprime has quit [Quit: Lost terminal]
libertyprime has joined #ruby
jonathanwallace has quit [Remote host closed the connection]
seanstickle has joined #ruby
kevinbond has joined #ruby
voodoofish4301 has quit [Quit: Leaving.]
ghosTM55 has quit [Quit: leaving]
ghosTM55 has joined #ruby
mikepack has joined #ruby
mikepack has quit [Read error: Connection reset by peer]
mdhopkins has joined #ruby
radic has quit [Disconnected by services]
radic_ has joined #ruby
radic_ is now known as radic
bambanx_ has joined #ruby
<bambanx_>
hi
Urthwhyte is now known as Urth|Away
bambanx_ has quit [Client Quit]
Gavilan has joined #ruby
ghosTM55 has quit [Quit: leaving]
peregrine81 has joined #ruby
ipoval has joined #ruby
bambanx has quit [Ping timeout: 250 seconds]
mikepack has joined #ruby
krusty_ar has quit [Remote host closed the connection]
diegok has quit [Remote host closed the connection]
uris has joined #ruby
ryanf has joined #ruby
xaq has joined #ruby
fivetwentysix has joined #ruby
crodas has quit [Read error: Operation timed out]
williamcotton has quit [Quit: williamcotton]
libertyprime has quit [Quit: Lost terminal]
libertyprime has joined #ruby
choffstein has joined #ruby
bambanx has joined #ruby
<bambanx>
hey guys
<bambanx>
bnagy,
<bambanx>
what plugins u use in your vim for ruby?
andrew_ has joined #ruby
hamfz_ has joined #ruby
kenperkins has joined #ruby
<bnagy>
greetings, humans
<bnagy>
bleah, coffee
test34- has quit [Ping timeout: 248 seconds]
horseman has quit [Read error: Connection reset by peer]
Urth|Away is now known as Urthwhyte
savage- has joined #ruby
azm has joined #ruby
azm has quit [Changing host]
azm has joined #ruby
kah_ has quit [Ping timeout: 246 seconds]
horseman has joined #ruby
sepp2k has joined #ruby
<horseman>
sepp2k: sup seppdogg
seanstickle has quit [Quit: Nihil sub sole novum]
xaq has quit [Remote host closed the connection]
fgwaegeawgfwa has joined #ruby
mohits has quit [Ping timeout: 248 seconds]
Gavilan has quit [Ping timeout: 252 seconds]
one8zero has joined #ruby
fivetwentysix has quit [Quit: fivetwentysix]
a_a_g has joined #ruby
cha1tanya has joined #ruby
derick_skibotn has joined #ruby
jenrzzz-mac has joined #ruby
derick_skibotn has left #ruby [#ruby]
one8zero has quit [Client Quit]
zenith6 has joined #ruby
kenperkins has quit [Quit: Computer has gone to sleep.]
fgwaegeawgfwa has quit [Ping timeout: 265 seconds]
jenrzzz-mac has quit [Client Quit]
fivetwentysix has joined #ruby
wallerdev has joined #ruby
keanehsiao_ has quit [Read error: Connection reset by peer]
keanehsiao has joined #ruby
dbgster has quit [Quit: dbgster]
Gavilan has joined #ruby
keanehsiao has quit [Read error: Connection reset by peer]
keanehsiao has joined #ruby
kevinbond has quit [Quit: kevinbond]
Progster has quit [Ping timeout: 240 seconds]
davidpk has quit [Quit: Computer has gone to sleep.]
kenperkins has joined #ruby
azm has quit [Ping timeout: 256 seconds]
vitor-br has quit [Ping timeout: 246 seconds]
jcromartie has quit [Read error: Connection reset by peer]
igotnolegs has joined #ruby
larissa has left #ruby ["Saindo"]
amalvagomes has quit [Quit: amalvagomes]
A124 has joined #ruby
amacgregor_osx_ has quit [Remote host closed the connection]
A124 has left #ruby [#ruby]
mdhopkins has quit [Quit: mdhopkins]
ericcoleman has quit [Remote host closed the connection]
<dekz>
bnagy: It's an error, I wouldn't classify that as an exception though. Especially when there is a very simple way to determine the error (response.status)
mikepack has quit [Remote host closed the connection]
<bnagy>
which you should definitely do once you've rescued it
<bnagy>
so you can decide what to do :)
mikepack has joined #ruby
<bnagy>
I honestly can't even see your point of view on this
<dekz>
bnagy: tbh I think it should be left up to the user of the library to deal with what happens on 400s. I know you'll probably say 'ryo' or monkey patch.
<bnagy>
you try an API call. It fails. Why would you _not_ raise?
<bnagy>
the point of raising an exception is exactly what you say - to let the user decide what to do
<bnagy>
just rescue it :)
<krz>
bnagy: starting at line 69 :-P
<bnagy>
krz: and what's the problem?
<krz>
bnagy: i need the output to include the iso two letter country code. ilke: http://pastie.org/3993086
ghanima has quit [Quit: Leaving.]
davidpk has joined #ruby
mikepack has quit [Ping timeout: 244 seconds]
iamjarvo has quit [Quit: Leaving.]
<dekz>
bnagy: I can see your point. It is an error but I'm coming from the code that probably exists everywhere now just because of this one implementation decision. https://gist.github.com/6e2c0b55416c9abe0b36 Can you see where I am coming from?
<bnagy>
krz: ok well you have two options
<bnagy>
krz: combine the country name and the iso code in the key, or include the code in the value where you have the count
<dekz>
bnagy: I just think exceptions should be saved for exceptional circumstances. 40x I wouldn't consider as exceptional as connection refused
<dekz>
bnagy: honestly. This all stemmed from me trying to show an example in an IRB session and getting an exception at 400 instead of a response. It's not what I expected nor wanted
<Alantas>
dekz: And so you threw us an exception. :P
<bnagy>
krz: try messing with the group_by in irb
zenith6 has quit [Quit: Leaving]
Vert has quit [Read error: Connection reset by peer]
<bnagy>
krz: fundamentally, group_by determines what the grouping keys will be in the grouped hash - they can be anything, it's just a question of what that block returns
univers has quit [Remote host closed the connection]
<krz>
bnagy: it groups fine. the problem. is how do i include the iso two letter code?
<krz>
include it in the output
<bnagy>
krz: try messing with the group_by in irb
G has joined #ruby
<krz>
so the issue is in the grouop_by statement
<krz>
for a minute i thought it was in the each.with_object
<bnagy>
dekz: I think you should patch Exception to create ActualException KindOfAnException and NotAsExceptionalAsThose
<bnagy>
we need fuzzy exception handling
<bnagy>
this worked / didn't work stff is too limiting
<dekz>
bnagy: that's already happening, it's just everything is an exception. Next patch will probably have response.status == 200 raise SuccessException
<dekz>
IAmATeapotException
SegFaultAX has joined #ruby
<bnagy>
418!
Chryson has quit [Quit: Leaving]
<bnagy>
in your long code, btw, you could have just done do_request rescue raise 'Err'
<bnagy>
unless you wanted to check for exactly status 400
<bnagy>
but anyway. Bored with that now.
Solnse has joined #ruby
one8zero has joined #ruby
<Alantas>
raise TheRule
DanBoy has joined #ruby
zizzyx has joined #ruby
<zizzyx>
i'm having a little bit of trouble figuring out how to import data into my irb session. i have an array of hashes with some data and i'm mucking about in irb to figure out the expressions needed to transform it into what i want
<zizzyx>
should i make the data a top level variable in the file and require it in irb?
<Alantas>
If you're just mucking around, sure.
<zizzyx>
i've tried that without success but may have done it wrong
<zizzyx>
how do i access that var?
mikeycgto has quit [Remote host closed the connection]
yxhuvud has joined #ruby
pzol has joined #ruby
<Alantas>
By name as usual. If it's defined in the toplevel, it'll be available there.
ruby has joined #ruby
hemanth has joined #ruby
<zizzyx>
hm
<Alantas>
Should be, anyway.
nricciar has quit [Ping timeout: 252 seconds]
<zizzyx>
i get a nameerror trying to access it
<krz>
bnagy: me is riddled
ruby has quit [Client Quit]
ruby has joined #ruby
lkba has quit [Ping timeout: 248 seconds]
<Alantas>
zizzyx: Hmm, so do I, now that I try it.
<Alantas>
You can assign it to a constant and that works. Herp = "derp"
<zizzyx>
local_variables only returns :_
<zizzyx>
oh ok thanks
<Azure>
question: I have relative filepaths (from the script's directory) that I want to pass into open(). Would I HAVE to use File.dirname(__FILE__) + the relative file path in order to have it open relatively?
<bnagy>
Alantas: is it the same with load?
<bnagy>
probably, but curious
nricciar has joined #ruby
<Alantas>
bnagy: I dunno; I don't use it.
ruby has quit [Client Quit]
<Alantas>
Azure: If you're on 1.9, there's require_relative. Otherwise, yeah, that seems to be the conventional trick.
<bnagy>
Azure: that won't work in all cases though
<Azure>
I don't mean require_relative
<Azure>
I mean actually opening a file.
tchebb1 has joined #ruby
<Alantas>
Azure: Oh, for just general files, not "require". Yeah, the dirname thing should do the trick.
<bnagy>
Azure: File.dirname(caller[0]) is better
ruby has joined #ruby
<Mon_Ouie>
No it's not. caller[0] doesn't even return a filename.
* Azure
has 7 instances of that in a bootstrap script.
<Alantas>
What's caller[0]? The script that was originally invoked? And if different scripts require the script file in question?
<bnagy>
Mon_Ouie: ok, well it works better for me in this universe
<bnagy>
Mon_Ouie: and it's hose require_relative is written
<bnagy>
*how
<Azure>
for instance: File.dirname(__FILE__) + '/config/twitter_oauth.yaml'
tchebb has quit [Ping timeout: 246 seconds]
<bnagy>
Alantas: basically you'll get an absolute path out of dirname(caller[0]) so it will always work
<Alantas>
Azure: That should be fine. That'll give you the filename.
<bnagy>
__FILE__ breaks when you access the script with a relative path
twinturbo has joined #ruby
<Alantas>
bnagy: And __FILE__ will give you a path that's relative to the same directory that File.new/.open works from.
<Alantas>
(The pwd.)
freakazoid0223 has joined #ruby
<Mon_Ouie>
You can use File.expand_path if needed
jenrzzz-mac has joined #ruby
<bnagy>
if you're in the script dir, OR you use an absolute path or one that expands to a full path (~/foo/...) __FILE__ works
djdb has joined #ruby
<Mon_Ouie>
And require_relative doesn't work by trying to parse caller
<bnagy>
but in my (recent) experience you can replace all use of __FILE__ with require_relative or caller[0] and it is >=
<Azure>
I'm opening files relative to my main script's path.
<bnagy>
that's old, it's caller[0] now afaik
<Azure>
files meaning txt, yaml, etc.
<Mon_Ouie>
hat's how he implemented it, not how it's implemented in YARV
<Azure>
(and ftr I'm running 1.9.3p0)
<bnagy>
Mon_Ouie: seems you're right for the C source, I found 2-3 ruby versions though and they all parse caller
<bnagy>
but everything else I said is still right :)
albemuth has quit [Quit: Computer has gone to sleep.]
ghosTM55 has joined #ruby
<Mon_Ouie>
Oh, and now that I think about it, caller[0] is the file (+ method/block and line) that *called* the current method
<Mon_Ouie>
Not the current one
one8zero has quit [Quit: one8zero]
<Alantas>
I made test directories "a" and "b", and made a file a/includeme.rb and a file b/test.rb that invokes File.dirname(__FILE__) + '/..a/whatever'. And it works fine from any directory I've tried it in.
<Alantas>
Both for 'require' and for opening files (IO.foreach to be exact).
<bnagy>
Alantas: try with a relative path, go up one level and do ruby foo/myscript.rb
williamcotton has joined #ruby
graspee has joined #ruby
<krz>
bnagy: almost got it with: https://gist.github.com/2833895 but i don't understand why this approach adds another level into the array
<Alantas>
I've run it from "b", from "a" (ruby ../b/test.rb), from /usr/local/fucking/bin with an absolute path. All of them work.
<Mon_Ouie>
Alantas: It works as long as you didn't change the CWD from Ruby
<Mon_Ouie>
Try using Dir.chdir
* Alantas
tosses Dir.chdir('..') before the __FILE__ line. Still works.
<Mon_Ouie>
File.expand_path(path, __FILE__) works though
<bnagy>
Alantas: yeah but none of those are relative paths :)
kylemcgill has quit [Remote host closed the connection]
<bnagy>
.. expands
SegFaultAX has quit [Quit: leaving]
<bnagy>
krz: cause you made the grouping key an array
SegFaultAX has joined #ruby
balazs_ has quit [Read error: Operation timed out]
heftig has quit [Quit: leaving]
<Alantas>
I think the only pitfall would be if you did a chdir between getting the filename (with __FILE__) and trying to open it.
<krz>
bnagy: i tried with @top_hits.map(&:visits).flatten.group_by {|h| h['country_name'], h['iso_two_letter_country_code']}.each.with_object({}) {|(k,v),new| new[k]=v.size}.to_a.sort{ |x,y| y[1] <=> x[1] } returns an error
<krz>
how else could i have done it?
<bnagy>
Alantas: try what I said before
twinturbo has quit [Quit: twinturbo]
dhruvasagar has quit [Ping timeout: 245 seconds]
ruby has quit [Remote host closed the connection]
<bnagy>
from your test.rb, cd .. and ruby b/test.rb
<krz>
group_by {|h| h['country_name', 'iso_two_letter_country_code']} also return an error
<Alantas>
bnagy: 05/29 10:11:40 pm Alantas: I've run it from "b", from "a" (ruby ../b/test.rb), from /usr/local/fucking/bin with an absolute path. All of them work.
benatkin has joined #ruby
<bnagy>
krz: I'm just saying, the extra level is there because your key is an array
balazs has quit [Ping timeout: 245 seconds]
<bnagy>
if you don't want it to be an array, make it something else, like a string
<bnagy>
Alantas: I read it. Now do exactly what I said
<Alantas>
Hell, I just changed it to read the filename with __FILE__, then Dir.chdir to the middle of nowhere (/etc), then IO.foreach. *Still* works, and I actually didn't expect it to that time.
yannis has quit [Quit: yannis]
<Alantas>
Huh, it does fail with 'ruby b/test.rb', since apparently it's not picking up on '..' (which on *nix systems is a hardlink to the parent anyway).
<zizzyx>
am i misunderstanding hash key lookup? i have a key called parent_id in a hash, but when i pass in a hash to a function and call hash.parent_id.nil? i get an error saying there is no method by that name
<bnagy>
zizzyx: hashes don't create accessor methods for you
<krz>
bnagy: still with group_by? or should i alter the with_object block?
<bnagy>
ok, but undefined keys will also return nil
<dekz>
zizzyx: which bit in particular in that link you supplied?
<zizzyx>
the accessor method
<zizzyx>
hash.[key]
<bnagy>
hsh.[key] is not the same as hsh.key
<zizzyx>
bnagy this is for a job where i'm being asked to learn ruby, so the data supplied has parent_id as nil in the case of it being a root node. would you like the data i've been supplied with?
<zizzyx>
bnagy when i explicitly put those brackets i get a syntax error
mdw has joined #ruby
<bnagy>
zizzyx: I'm just saying you can just check against if hsh['parent_id']
<bnagy>
you don't need if hsh['parent_id'].nil?
<Alantas>
hsh.key? 'parent_id'
<bnagy>
sorry unless hsh['parent_id'] my bad
<zizzyx>
ok so if the key exists but the value is nil then it returns false Alantas ?
werdnativ has quit [Read error: Connection reset by peer]
<zizzyx>
ok i get it now, didn't know i needed the single quotes
<bnagy>
well the quotes only work if the key is a string
<Alantas>
hsh.key? returns true if the key exists, false if it does not, regardless of the value stored there.
<dekz>
zizzyx: try this, a.send :[], 0 have a think about what that does. It asks the a object to perform the method identified as :[]
<Alantas>
(No idea if it's applicable here. Just throwing it out there.)
robbyoconnor has quit [Read error: Connection reset by peer]
<bnagy>
Alantas: I think it always has a parent_id key, but the root node has it point to nil
<Alantas>
And yeah, hsh.key?("parent_id") and hsh.key?(:parent_id) refer to different keys.
<bnagy>
to build a trie etc
savage- has joined #ruby
<zizzyx>
i need to build a tree and print it out heirarchically
<zizzyx>
trying to learn the ruby way to do it
robbyoconnor has joined #ruby
<bnagy>
zizzyx: so it's hsh[:parent_id], those are symbol keys
<zizzyx>
ok ty muchly
<Alantas>
Well, you'd start with some parent node n, and then look for everything where [:parent_id] == n
<bnagy>
actually tbh this is a bit of a chalkmark against 1.9 hash syntax
<zizzyx>
does ruby tree have a lookup method
<zizzyx>
or do i need to implement it myself
<bnagy>
cause unless you know about it, it's hard to see why parent_id: should be referred to as :parent_id
<zizzyx>
yeah but i'm ok with that
<Alantas>
Ruby doesn't have trees built-in.
<zizzyx>
every language has gotchas
<bnagy>
zizzyx: select probably works for what you want
<zizzyx>
oh ok i figured you guys would be familiar with whatever is most popular implementation of tree
TrevorBramble has quit [Quit: "Exit...Stage Left"]
c0rn has joined #ruby
<bnagy>
there are a zillion trees used in algorithms :)
raul782 has quit [Remote host closed the connection]
<zizzyx>
heh
daniel_hinojosa has quit [Ping timeout: 245 seconds]
<dekz>
bnagy: that's valid 1.9 hash syntax?
<bnagy>
dekz: {foo: 3} yeah
<zizzyx>
so the prompt is to print a heirarchical listing of the nodes. i'm pretty junior so i want to make sure my understanding of the solution is correct
<dekz>
bnagy: eww
<zizzyx>
i need to set up the tree properly and then do a depth-first traversal and print out each node correct?
<bnagy>
zizzyx: wow. There are a million ways to do this
<bnagy>
zizzyx: personally I would create classes for Tree and Node
<zizzyx>
yeah the number of possible methods has me a bit locked up
<bnagy>
since it's a learning exercise, but you can do everything just from the array of hashes
<Alantas>
def print_tree( tree, current=0, level=0 ); puts( (' ' * level) + ': ' + tree[current][:title] ); tree.each{ |node| print_tree(tree,node[:id],level+1) if node[:parent_id] == current }; end
balazs has joined #ruby
<bnagy>
yeah that, standard recursion
balazs_ has joined #ruby
<bnagy>
although tbh that's a bad approach with ruby
<Alantas>
Er, s/': ' + //;
<bnagy>
because of the tiny stack
<dekz>
zizzyx: in future try and use ruby-doc for looking at how hashes and other classes work. This way you can be sure that not only is it correct, but that it's correct for the version you're using. http://www.ruby-doc.org/core-1.9.3/Hash.html
<bnagy>
but for this tree it will work :D
<zizzyx>
ok thanks dekz
<zizzyx>
my future boss said my implementation should work for infinitely deep trees, what kind of implementation specifics does that imply?
<Alantas>
Nothing will work for infinite trees.
<zizzyx>
btw i'm really sorry for the dumbass questions but my education is as far as basic data structures class which was in (barely any) python
<dekz>
zizzyx: that implies an infinite stack if you want to use recursion
<bnagy>
ahhh, then you can't recurse
<bnagy>
well, not that way
<Alantas>
"Arbitrarily-deep" trees is probably what was meant. :P
<zizzyx>
he also mentioned using recursion so maybe i should post the email
<bnagy>
you can use an explicit stack
c0rn_ has quit [Ping timeout: 250 seconds]
c0rn_ has joined #ruby
<dekz>
you'll never get a return if it's infinite
<bnagy>
instead of using the ruby stack, you need to use an Array as your stack
<dekz>
so zizzyx you want to parse that tree and build it, then traverse it
<bnagy>
now write recursive_print and you're done ;)
<zizzyx>
ok thanks for all the help guys
choffstein has joined #ruby
<zizzyx>
i'm pretty excited to learn the language and get started, the people i'm joining said they have been working tons of hours because of their contract backlog
ananthakumaran has joined #ruby
kil0byte has quit []
<bnagy>
zizzyx: word of warning - the example above _will_ fail on deep trees, make sure you test with them
<zizzyx>
i'm looking at ruby-lang.org's list of tutorials, which is the best reference for basic syntax elements, such as your #root nodes above
choffstein has quit [Ping timeout: 246 seconds]
<bnagy>
have you programmed much before?
<zizzyx>
i just haven't come across the #identifier notation hyet
<zizzyx>
i'm more familiar with python
<bnagy>
oh that, it's just a comment :)
<zizzyx>
so in your code example how far does the comment extend?
<zizzyx>
did you mean #root or possibly $root or @root
<bnagy>
zizzyx: I'm not even convinced it's syntax in a oneliner
<bnagy>
it was just explanatory. :) If you broke the code up onto multiple lines it would be a comment until eol
<zizzyx>
oh right my brain parsed that poorly
Solnse has quit []
<zizzyx>
wasn't expecting a comment in a one-liner lol
<dekz>
bnagy: you should use do…end on multiple lines!
<bnagy>
dekz: no, you're not my mom.
<dekz>
or aren't I
<bnagy>
I use do end for loops and threads and {} for each etc
<dekz>
zizzyx: do you understand that the code does that bnagy wrote?
<dekz>
what*
<dekz>
you have a few things to look at there, select, each, and blocks in general
TheFuzzball has quit [Quit: Leaving...]
<zizzyx>
yeah i see what it does but i'm not sure if it matches the data i have
<zizzyx>
is my data considered an array of hashes
jenrzzz-mac has quit [Quit: jenrzzz-mac]
<dekz>
zizzyx: it won't, you need to transform it to a tree first
<zizzyx>
so would it be array.select { |value| value[:parent_id].nil? }.each...
<dekz>
or some structure representing a tree
vectorshelve has joined #ruby
<zizzyx>
seems like that line pulls out the root nodes from the array of nodes i have
<vectorshelve>
hemanth: hai dude
<hemanth>
vectorshelve, hey
<zizzyx>
or is it just assuming i have a big hash of nodes with a parent attribute and it pulls all the nodes from that hash with no parents, then prints their children?
L-----D has joined #ruby
<dekz>
attempting to use that structure without transforming your array of hashes will cause complexity that you may want to avoid. I suggest taking your data, then turning it into a tree
<dekz>
zizzyx: I think the exercise is calling for you to create a tree structure
<zizzyx>
i'm trying to figure out if the code bnagy is posting is transforming the data i pasted or manipulating the tree i'm supposed to make from it
<zizzyx>
i'm planning on making a tree
<Alantas>
http://pastie.org/3993405 ← No idea if this'll work. But it's easier to sketch out code like that in a text editor and not in a single-line IRC text entry~!
<dekz>
zizzyx: technically it could do both
<dekz>
zizzyx: it depends on how you implement recursive_print
<bnagy>
actually I think as stated it would be recursive_print( hsh, root )
<dekz>
zizzyx: implement the tree and it will be easier, cleaner and more 'correct'
<bnagy>
cause you need visibility for all the possible nodes
<bnagy>
but even if you build the tree you still have to be careful with your recursion depth
<dekz>
^
cha1tanya has quit [Read error: Operation timed out]
<bnagy>
tbf, it's still pretty clean just using that has
<bnagy>
like each level is hsh.select {|node| node[:parent_id]=this_level_parent}
krz has quit [Quit: krz]
<bnagy>
which is fairly readable
peregrine81 has quit [Quit: Computer sleeping.]
c0rn has quit []
<bnagy>
== not =
<zizzyx>
would i be incurring a big runtime penalty if i pull nil parented nodes from the hash with that select, and then use recursive_print to select nodes from the hash with parent_id matching the id of the argument root
cha1tanya has joined #ruby
<zizzyx>
oh that's breadth first
<bnagy>
for huge trees - yes
<zizzyx>
if i did it that way i'd also have to run another select to ensure that the node has no further children before finally printing it
<zizzyx>
so that could get hefty
<bnagy>
class Node; attr_accessor :parent, :children; end
* Alantas
points at my paste again. No recursion, just a stack Array, each of which also notes where it should resume its search (for additional children) from.
<dekz>
it's a question of how many times you want to 'walk' that hash
<zizzyx>
employer wants recursion demonstrated
liluo_ has joined #ruby
liluo has quit [Read error: Connection reset by peer]
<Alantas>
No function-call recursion, I mean. It should still walk the tree successfully, to arbitrary depth.
<bnagy>
that's working code, but for a different structure, it's out of a grammar parser I use
<bnagy>
same principle
<Alantas>
There's a reverse_each, I think.
<bnagy>
yeah it does reverse.each, afair
twqla has quit [Ping timeout: 244 seconds]
<Alantas>
Also, counterpoint to shevy's remark that he's never seen Ruby code that didn't use 2-space indentation. (I *thought* it looked a little odd~!) Hehe.
<bnagy>
I use 4 spaces. Screw 2, can't read it properly
<Hanmac>
i used tabs and let my browser show them as 2 spaces
<bnagy>
tabs! get the tar and feathers!
looopy has joined #ruby
jenrzzz-mac has quit [Client Quit]
<Alantas>
Cry "Havoc!" and let loose the dogs of war!
seivan has joined #ruby
benatwork has joined #ruby
<bambanx>
bnagy, you run ruby into vim?
<dekz>
Alantas: can you avoid the throwing of exceptions for flow control?
Igoru has joined #ruby
CheeToS has joined #ruby
<dekz>
bnagy: maybe it's a ruby thing using exceptions for flow control everywhere!
<bnagy>
bambanx: no, I just edit in it
<Alantas>
dekz: catch/throw aren't exceptions in Ruby, they're actually meant to be used for flow control. Exceptions are raise/rescue.
<bambanx>
bnagy, ok
<Igoru>
i think i've found an encoding problem inside a file from Rack, but i have no idea of where to report/fix the problem... could anyone help me?
<dekz>
Alantas: fair enough, I'm also new to ruby in general here :)
<Alantas>
If I could have done something like "next whatever" to get it to jump to the next iteration of the "until stack.empty?" loop, I would have just done that.
<Igoru>
i'm using ruby 1.9.2 and my code complains of invalid byte sequence in utf-8 in rack-1.4.1/lib/rack/utils.rb:98. the code is: "name =~ %r(\A[\[\]]*([^\[\]]+)\]*)" and the file declares its encoding as "binary"
<graspee>
get 1.9.3
<graspee>
why are you using ruby that's over 2 years old?
<Igoru>
because i'm noob? lol
<Alantas>
Igoru: Maybe 'name' is coming from a source marked as UTF-8?
<Igoru>
Alantas: maybe. all my code is utf8, and the files are declared as utf8 too.
<Igoru>
graspee any idea on why upgrading ruby would solve that?
<graspee>
no idea. but why run that risk?
araujo has quit [Ping timeout: 250 seconds]
benatwork has quit [Ping timeout: 245 seconds]
<Igoru>
graspee: because i dont wanna upgrade ruby version on this part of the project... lol
<graspee>
the first thing you should do whenever you have problems with something is check your version
seivan has quit [Read error: Connection reset by peer]
<graspee>
and then ugrade to the latest stable one
<Igoru>
don't want to compile ruby, reinstall gems, re-test the system, etc.
<Igoru>
that's what i did with...... rack. the origin of the problem, at least for me heheh
seivan has joined #ruby
lobak has quit [Remote host closed the connection]
lobak has joined #ruby
<Igoru>
in fact, i think i'm using 1.9.2 because heroku tells me to do so.
digitalcakestudi has quit [Ping timeout: 246 seconds]
<Igoru>
just a couple of weeks ago they released the ability to change the production ruby version
mdw has quit [Remote host closed the connection]
<Igoru>
yes, confirmed. heroku runs primarily on 1.9.2. i cannot risk changing ruby version because a "small" bug like that... at least if there's no obvious reason, just a "guess"
<Alantas>
Hell, I still use 1.8.7. Never had encoding problems, and irb works: more than I can say for 1.9.3 when I took it for a spin the other day.
<graspee>
irb works fine with 1.9.3
<graspee>
you must have some config problem
<Alantas>
Anyhow, if you're reading data from an external source, you might have to force_encoding it, or whatever. I had to do that with a 1.8.7 script I rigged to work in 1.9.3.
<Igoru>
Alantas me too. i have to change to 1.8.* when i want to use some tools here. problems with readline.
<graspee>
but why would you run irb rather than pry anyway?
<Igoru>
because we don't know those strange names, maybe?
<Hanmac>
Alantas: and you may bet problems in the next debian versions? because i heard that they planed to drop 1.8 some as it dies
<Hanmac>
get
<horseman>
graspee: are you a pry groupie
<Alantas>
graspee: I tried pry. gem install it, no problem. Running it, it spews "redefining constants" warnings, then dies on some library it didn't find.
<graspee>
it would seem so
<Igoru>
why don't you try to help instead of saying "why dont u do that?" lol
<Alantas>
$ irb => "irb> "
<horseman>
Alantas: because you dont hvae Readline installed
<graspee>
i am trying to help
senny has joined #ruby
nai has joined #ruby
<Igoru>
horseman and how to install readline? lol
JohnBat26 has joined #ruby
<Alantas>
Doesn't Ruby itself come with a script-accessible Readline library?
<graspee>
but if people are too afraid to change their ruby version and think "pry" is some mysterious witchcraft and don't know how to install readline then i can't help
<Igoru>
i've already tried to follow rvm guide but it didnt help
<Alantas>
It'd be like saying it failed because there's no bignum support.
<horseman>
Igoru: i always start out by believing in myself, if i believe in myself i can do anything.
<horseman>
Alantas: Nah it doesn't u have to build it b4 u install ruby
<Hanmac>
pry is not so bad, but i hate its creator ... and it should use an newer slop version
<Igoru>
well... gotta try that another day. i'm sure i've already spent many neurons on this task some time before
<horseman>
Alantas: also without readline even your irb experience would be a bit impoverished
nirakara has joined #ruby
<Alantas>
My irb works fine. I can even tab-complete filenames.
<Igoru>
horseman yes, irb without readline is crappy. because of that when i wanna use irb i change to 1.8.7
<Alantas>
The 1.9.3 one would emit control characters or something when I tried to tab... or backspace!
<horseman>
Alantas: can you up-arrow to history?
nai has quit [Remote host closed the connection]
<Igoru>
yes, that's the lack of readline
<horseman>
Alantas: can you gist the error u get when u try to use pry?
<Igoru>
gotta try to upgrade ruby now. geez
<horseman>
Alantas: whenever u get the chance
gregorg has joined #ruby
gregorg has quit [Changing host]
gregorg has joined #ruby
<Igoru>
no "easier" idea about the encoding problem?
<Alantas>
horseman: I would, but then I'd have to reinstall rbenv, and 1.9.3 (rebuilding it too!), and pry.
<graspee>
what's so bad about rebuilding it
<graspee>
you make it sound like it takes 5 years or something
nirakara has quit [Client Quit]
nfluxx has joined #ruby
<Alantas>
Anyhow: require "readline". Tada!
harukomoto has quit [Ping timeout: 240 seconds]
MissionCritical has quit [Ping timeout: 244 seconds]
nirakara has joined #ruby
<Igoru>
in fact, if you are in the middle of a task, 'rebuilding everything' takes longer than you would expect.
<Alantas>
graspee: The number of hoops to jump through is not infinite, but still more than I'm willing to do for this, so it might as well be.
<Igoru>
just what i meant XD
maesbn has joined #ruby
ryanf has joined #ruby
<Igoru>
i've stumbled in a simple encoding problem and now i'm recompiling ruby to see if it "magically" solves the problem? lol
<Alantas>
Windows? Reboot! Linux? Recompile!
<Igoru>
hahahahahaha
araujo has joined #ruby
<graspee>
i just can't see why anyone would use a previous ruby version unless they had to use some library which didn't work with 1.9
ABK has joined #ruby
<Igoru>
and mac? buy a new one?
nilg` has joined #ruby
buschhardt has joined #ruby
<Igoru>
graspee as i said before, heroku was only supporting 1.9.2 until, like, last week.
<Igoru>
i'm not obligated to upgrade to 1.9.3 as soon as heroku did.
<Igoru>
in fact i'm not sure if they are already supporting 1.9.3. what i know is that it's now possible to change the ruby version you use via Gemfile.
<dekz>
graspee: has a point though, many issues seem to be resolved from having the latest runtime installed.
<Alantas>
I have no particular reason to stay in 1.8.7 (aside from the fact it's confirmed to work for me), but no particular reason to switch to 1.9.3 either. So, I'm fine where I am.
<dekz>
but there is a difference between installing an older version instead of a newer version, and only using what may be available at the time
<Alantas>
Bird in the hand.
<horseman>
Alantas: Bird in the bush.
noodletraveler has joined #ruby
<dekz>
This is more to do with my experiences and 1.8 and 1.9 jruby ruby spec
igaiga has joined #ruby
<dekz>
it would relate less so with 1.9.2 and 1.9.3
<graspee>
how about 1.9.3 is faster than 1.8.7
<Igoru>
reinstalling aaaaall the gems again.
<dekz>
lol
Morkel has joined #ruby
igaiga_ has quit [Ping timeout: 244 seconds]
Solnse has quit [Quit: Leaving.]
buschhardt has left #ruby [#ruby]
araujo has quit [Ping timeout: 256 seconds]
horseman has quit [Remote host closed the connection]
mneorr has joined #ruby
<Igoru>
ok, now i'm needing to install a pre-release version of bundler. how funny it is.
SegFaultAX|work2 has quit [Read error: No route to host]
workmad3 has joined #ruby
SegFaultAX|work2 has joined #ruby
<Igoru>
guess what? now the encoding error changed of file.
maesbn has quit [Read error: Connection reset by peer]
schovi has joined #ruby
maesbn has joined #ruby
<graspee>
"changed of file"?
<Igoru>
to my first question: where could i get help from rack team?
maesbn has quit [Read error: Connection reset by peer]
<Igoru>
yes... the error is more meaningful, at least.
mneorr_ has joined #ruby
maesbn has joined #ruby
<Igoru>
but it didnt vanished, just changed of name lol
<graspee>
i don't know what "changed of file" means
<Alantas>
That doesn't grammar.
<Igoru>
it was being thrown in a file and now is in other
mneorr has quit [Ping timeout: 260 seconds]
mnaser has quit [Quit: Computer has gone to sleep.]
<Igoru>
sorry, i'm not native speaker .-.
<Igoru>
the error changed from a file to another (?)
<graspee>
ok
<Igoru>
to 'decode_www_form_component'... i'm trying to upload a picture
<graspee>
at least now you are on firm ground though, so people can help you
<Igoru>
and it's complaining exactly about the content of the binary file uploaded
gilead has joined #ruby
Eldariof59-ru has joined #ruby
tchebb1 is now known as tchebb
<Igoru>
the funiest part is that the upload works on opera. lol
alup has quit [Read error: Connection reset by peer]
mdw has joined #ruby
solidus-river has joined #ruby
<solidus-river>
whats the difference between an instance function vs a class function in ruby
<solidus-river>
sytactically
<solidus-river>
*syntactically for definition
<Hanmac>
class functions are singleton functions at the class object
workmad3 has quit [Read error: Operation timed out]
<solidus-river>
so how would i definte an instance function?
<Alantas>
herp = Classname.new ← class method
<Hanmac>
class A def abc; p "instance"; end; def self.abc; p "class"; end; end;
<Alantas>
herp.derp() ← instance method
ph^ has joined #ruby
petercs has joined #ruby
<solidus-river>
ah, so instance methods just can only be called on instances of the class then? where as class methods can be called either from an instance or the whole class
<Alantas>
No, class methods can only be called on the whole class, not on instances.
mdw has quit [Remote host closed the connection]
<Hanmac>
nearly every instance can have singleton methods too ... expept fixnum, and symbols
<CombatWombat>
Interestingly enough though, instance methods don't actually belong to objects, they belong to the class of the object. Be it the class, superclass, somewherein the hierarchy, or the eigenclass.
Banistergalaxy has joined #ruby
dhruvasagar has joined #ruby
becom33 has joined #ruby
maesbn has quit [Remote host closed the connection]
Igoru has left #ruby [#ruby]
<Alantas>
To explain: singleton method = a method defined on a specific object, rather than all objects of a class (instance method) or the class itself (class method).
<Alantas>
s/object/instance/g;
<becom33>
whats up fellas
<Alantas>
The opposite of down.
<Banistergalaxy>
Class methods are singleton methods too, alantas
araujo has joined #ruby
twqla has joined #ruby
<solidus-river>
include loads once where require loads every time, right?
<solidus-river>
or did i get that backwords
<Alantas>
Banistergalaxy: Ah, that's true. The class itself is represented by an object, itself an instance of the "Class" class, and identified by the constant of the same name as the class. Class methods are singletons of that instance.
<Alantas>
(Something like that.)
<Hanmac>
solidus-river: otherwise, require loads only once
<Alantas>
solidus-river: "include" is for mixins, which is a different thing than "require". Maybe you're thinking of "load"?
<solidus-river>
yes
<solidus-river>
sorry, thinking of require vs load
lopin has joined #ruby
ghosTM55 has quit [Quit: Lost terminal]
<solidus-river>
got it load loads every time
<solidus-river>
easy to remember
gregorg_taf has joined #ruby
gregorg has quit [Read error: Connection reset by peer]
seoaqua has joined #ruby
ecigman has joined #ruby
tomzx has quit [Ping timeout: 252 seconds]
<ecigman>
hi i have a quick n00bie syntax question: what does it mean when a function definition is followed by ? like def function(a,b,c)?
<bnagy>
syntax error?
<ecigman>
err def function?(a,b,c)
<bnagy>
def foo?( *args ) is a convention that suggests that you can treat the result as a truthy value
<bnagy>
for use in if foo? 3 ... etc
<CombatWombat>
Oh splat-args. :(
<ecigman>
like guarantees it returns true false
<bnagy>
if File.exists? 'blah.txt' etc
Eldariof59-ru has quit []
<bnagy>
ecigman: no, not that at all
<bnagy>
it guarantees it will return something truthy (not nil or false) for the positive case and something falsey for the negative case
maesbn has joined #ruby
<bnagy>
but it might return a string or whatever for the positive case
<ecigman>
falsey would be not nil or false
<ecigman>
?
<ecigman>
*nil
hoelzro|away is now known as hoelzro
<ecigman>
or false
<bnagy>
falsey is nil or false, pretty much
<ecigman>
lol
<bnagy>
truth is not that
<ecigman>
k
<ecigman>
understand
<bnagy>
*truthy
<ecigman>
thank you bnagy
<bnagy>
so 2 is truthy, as is true and "rabbits"
<ecigman>
right
<ecigman>
not nil and not false
<ecigman>
cool concept
<solidus-river>
so pass simply frees up its space in the process sceduling for a thread
<solidus-river>
but doen't necissarily keep the thread in a sleep state
<bnagy>
solidus-river: it's a 'hint' to the scheduler
<bnagy>
like 'if you got anybody waiting, I'm done for a bit'
<solidus-river>
ah, kk, so it would be good to put maybe in a really intensive loop or something
<bnagy>
well best example I have had recently is say you have two threads, one is reading from a socket and one is processing
<Hanmac>
information: functions like map! will return nil if nothing has changed
JC_SoCal_ has joined #ruby
AlbireoX`Laptop has quit [Remote host closed the connection]
<bnagy>
they're both in a loop, in the reader you do get_a_chunk; Thread.pass, to hint that the processor has a chunk to work on now
<solidus-river>
ah, kk
zommi has joined #ruby
<solidus-river>
that makes sense
<bnagy>
it's pretty rare that you would need it imho
robin850 has joined #ruby
bluOxigen has joined #ruby
JC_SoCal_ is now known as MoMo_
MoMo_ is now known as MoMo
<solidus-river>
you can name vars via a hash tag correct?
<bnagy>
not really
cordoval has joined #ruby
<bnagy>
you can pass a has as arguments with lots of different sugar so it looks that way
cordoval has left #ruby [#ruby]
a_a_g has joined #ruby
`gregorg` has joined #ruby
gregorg_taf has quit [Read error: Connection reset by peer]
<bnagy>
set_polarity( -1, nacelle: :starboard )
takus has joined #ruby
`gregorg` has quit [Changing host]
`gregorg` has joined #ruby
`gregorg` is now known as gregorg
<Alantas>
Which is syntactic sugar for: set_polarity( -1, {:nacelle => :starboard}) (Passing a numeric literal and a Hash literal to the function.)
nirakara has quit [Quit: This computer has gone to sleep]
cha1tanya has quit [Ping timeout: 240 seconds]
<Alantas>
I think a better approach would be to group them by program, not by field. @progs = [["photoshop", "this is for photo editing by adobe"], ["dreamweaver", "a tool used for web design"], ...]
<hoelzro>
becom33: why not use a hash to store name by key and description by value?
<Alantas>
Or, uh, that.
<hoelzro>
Alantas' solution is pretty good too
<kenneth>
def use a hash
<kenneth>
or an array of hashes
<becom33>
kenneth, wait
<Alantas>
The Hash approach is probably better. You can always have the values be a compound type if you need more info.
<bnagy>
then you would have noticed that your name and desc arrays are different sizes :)
davidpk has quit [Quit: Computer has gone to sleep.]
* hoelzro
thinks it's silly that custom impls of <=> must return -1, 0, or 1
<becom33>
so I want to write a little search method
<Alantas>
Well, what you're doing is making a struct class, then subclassing the result. Which seems a little wasteful.
<hoelzro>
becom33: you probably should use symbols for the keys, I think
<epitron>
becom33: @info.select { |k,v| k =~ query }
<epitron>
or: k =~ query or v =~ query
<epitron>
:)
jimeh has joined #ruby
<hoelzro>
becom33: are you searching, or looking up an exact match?
<becom33>
it only gets a one string . for a exmaple . "photo" so I want to sort it and get the result . plus I want to search in a key first then value if one of it has the search word it shoud appear
<hoelzro>
if the latter, stick with the hash; if the former, I'd say go with an array of hashes/objects
<epitron>
it would be easier if he told us the entire purpose of this program
<becom33>
hoelzro, not exact match
<epitron>
instead of having us slowly assemble an understanding of the program by asking random questions about specific aspects
<CombatWombat>
Bitch, where are your tests?!
* Alantas
is looking to see if there's syntax akin to: Foo = Struct.new(:herp, :derp) do; include Comparable; def <=>(that); return 5+3i; end; end
<epitron>
Alantas: hahaha... i just read your thing about how subclassing an anonymous class is wasteful :)
<epitron>
why not write it in assembler!
<epitron>
using ruby is a huuuuuuuuuuuuge waste :)
trebaum has joined #ruby
trebaum has quit [Changing host]
trebaum has joined #ruby
nirakara has joined #ruby
ramblex has joined #ruby
prtksxna has joined #ruby
<Alantas>
So one isn't allowed to keep such things in mind when using Ruby?
<shevy2>
hmm
<shevy2>
if ruby could easily produce assembler code, we could write a RubyOS
<graspee>
atlantas you don't need semicolons after do and end i don't think
<shevy2>
he just wanted to have it on one line for here
<hoelzro>
shevy2: you *really* like that idea, don't you?
<hoelzro>
=)
red-panda has quit [Remote host closed the connection]
<shevy2>
hoelzro it must happen. we cant let the rails guy destroy ruby :(
<Alantas>
graspee: Well, I use them in place of hitting Enter when writing up one-liners on IRC.
sirdeiu has quit [Read error: Operation timed out]
<graspee>
i mean in one line even
<shevy2>
everything including your pants will become used "for the web" with rails
eggie5 has quit [Quit: eggie5]
yonggu_ has joined #ruby
<shevy2>
I am going to call it the phpification of ruby
<graspee>
(1..10).each do |f| print f end
<graspee>
works fine
<epitron>
becom33: that works, but this isn't a very useful way of implementing search. a better way is to have search return the actual matches. then you can print them, or do other operations on them! :)
<Tasser>
graspee, puts (1..10).join("\n") is faster
<graspee>
that wasn't the point i was making
<becom33>
epitron, that doesnt work
kenneth has quit [Quit: kswizz.com]
<shevy2>
graspee but he used 3 instructions, you use only one
<bnagy>
becom33: your search method is really just a limited subset of Hash#select
<epitron>
becom33: becom33: @info.select { |k,v| k =~ query or v =~ query } ?
<becom33>
wait
roams has quit [Ping timeout: 250 seconds]
<shevy2>
epitron, double becom33 ? :)
<bnagy>
or just take a block in your search and select with it on @info
yonggu has quit [Ping timeout: 246 seconds]
<graspee>
ok it seems you're right sorry
<Alantas>
def search(lis); puts( @info[lis] || "why u no name existing program t('_'t)" ); end
<shevy2>
becom33, why do you have "33" in your nick?
<graspee>
i assumed because there was no ; needed after do and end in my situation that there wouldn't be in yours
<graspee>
but i blame ruby's vague syntax rather than anything else
roams has joined #ruby
mneorr_ has quit [Remote host closed the connection]
sirdeiu has joined #ruby
<Alantas>
graspee: Well, I'd normally use { this } for one-liners anyway. I assumed one would use do...end for class defs and the like.
shevy2 is now known as shevy
<Alantas>
So I don't have experience using do...end in oneliners. So I play it safe and use ; where there'd be end-of-line in a real script.
<shevy>
I tend to prefer the {} most of the time
nfluxx has quit [Quit: nfluxx]
<bnagy>
becom33: def search &blk; @info.select &blk; end
<CombatWombat>
Alantas: I sure hope you bludgeoned him with a heavy stick.
<Alantas>
I did let loose the dogs of war, as I recall. That'll have to do for now.
francisfish has joined #ruby
<bnagy>
becom33: although frankly, as you have it thw ehole thing may as well be a subclass or DelegateClass to Hash
<graspee>
it's getting the dogs of war back in the kennel that's always the problem
<bnagy>
Alantas: misquotes will not stop me using 4 space indents
abionic has joined #ruby
alup has joined #ruby
nirakara has quit [Quit: This computer has gone to sleep]
<epitron>
bnagy: hahah.. Storage is essentially a Hash, with less methods :)
<epitron>
oh sorry, you just said that
<graspee>
*cough*fewer
AlbireoX`Laptop has joined #ruby
<epitron>
thank you grammar nazi!
<epitron>
heil!
<graspee>
i can never understand why not every programmer has top notch grammar skills
<graspee>
i mean programming is all about syntax and grammar rules
<graspee>
if you get them wrong in code, stuff breaks
<epitron>
you mean, you can never understand why every programmer does not have top notch skills
<epitron>
english is a flexible language
<epitron>
C is not
<epitron>
we can take liberties in english
<CombatWombat>
Gherkin!
Drakx has quit [Ping timeout: 248 seconds]
<graspee>
it's not taking liberties though, it's just wrong
<CombatWombat>
Perl executable poems.
<Tasser>
epitron, C is kinda flexible too, you can do one thing in different ways
heftig has quit [Ping timeout: 260 seconds]
<bnagy>
english also has many more rules
fr0gprince_ has quit [Remote host closed the connection]
ABK has quit [Ping timeout: 245 seconds]
<bnagy>
graspee: I've yet to see .. or I'm yet to see .. ... or both?
<Alantas>
Don't underestimate the power of pointer casting.
<CombatWombat>
"Where you be at?" is an entirely valid question in English, by the way.
<graspee>
i've yet to see
<bnagy>
do they mean exactly the same thing?
<rippa>
where da hood at
<epitron>
graspee: language's rules are in the minds of the speakers... and "with less <x>" is commonly understood to mean "with less <x> than <previous subject>"
<Alantas>
"I'm yet to see" implies that, without the "yet", you'd "be to see".
<bnagy>
CombatWombat: yeah no, it's not
<bnagy>
nice try with the subjunctive though
fr0gprince_ has joined #ruby
<graspee>
epitron the whole "speakers define language" thing is a cop-out
heftig has joined #ruby
<epitron>
graspee: some people decided to formalize something at some point, and "fewer" was seen to be better... but whatever!
<epitron>
it's not a cop-out!
<graspee>
it is
<epitron>
speakers do define language
<CombatWombat>
bnagy: No, it totally is. But then again, that depends on whose particular rules you use in validating. Oxford man?
<Alantas>
Speakers define the language, but it *is*, in fact, thereby defined.
<graspee>
so i can say shred devil cup cup mug sand? and expect you to understand me?
<bnagy>
Alantas, graspee, you might want to consult the internet if you think it's black and white :)
<epitron>
where do you think they get grammar rules from?
<epitron>
sigh
<CombatWombat>
graspee: Sure, but I'm not giving you that reach around you asked for.
<Tasser>
epitron, history
<epitron>
nevermind
<graspee>
ugh
<epitron>
this is a stupid argument
<epitron>
even if i win, i lose
<graspee>
don't even go there
<CombatWombat>
What's the difference between a duck?
<Alantas>
Speakers set the conventions that help convey information. Straying from the conventions makes it harder to convey information.
clockwize has joined #ruby
<bnagy>
CombatWombat: If you use the archaic subjunctive of to be it would be 'Where be you?'
<Tasser>
Alantas, and when the conventions become regularities, grammar emerges ;-)
<bnagy>
although if it were that old you there would be plural :)
igaiga has quit [Remote host closed the connection]
<Alantas>
So all the English people speak is like in a little cloud, each particle in a different place, but still gravitating around a point: standard language.
<Alantas>
Tasser: Right.
<graspee>
but when people misuse language with the effect of removing distinctions and making the language less precise, i kick off
<CombatWombat>
bnagy: I see the value in your proposition, but haven't seen much that definitively proves mine as incorrect English.
<bnagy>
CombatWombat: that's because of logic and proving negatives
<bnagy>
you should try some, it's good stuff for programming
<CombatWombat>
bnagy: Probably actually because there's no particular mandate that canonically proclaims that the format was incorrect, but you know, we can always pretend you're correct. I'd assume you'd be rather tickled by that, and I imagine you have a wonderful smile.
jrist-afk has quit [Ping timeout: 252 seconds]
<graspee>
it's funny that when there's an argument about language people tend to step up their vocabulary
<epitron>
preposterous!
<shevy>
what language
<bnagy>
CombatWombat: well the trailing 'at' is a fairly universally incorrect use of a prepostion
<epitron>
shevy: english
<CombatWombat>
Purportedly, it's a game of one-upsmanship.
d3vic3 has quit [Quit: leaving]
<bnagy>
like.. there's a reason they put 'pre' in that word
Banistergalaxy has joined #ruby
<shevy>
epitron, ohhhh... I thought a programming language :(
<graspee>
it is a programming language, man
benatwork has joined #ruby
<graspee>
they try to program you, man
<Alantas>
If people often say "X is incorrect", then it probably is. After all, consensus (not centralized control) is what matters; and look, there seems to be consensus!
<graspee>
get your tin foil, man
<epitron>
cultural operating system is the proper term
<Alantas>
Or does a consensus only count if it's convenient?
<shevy>
graspee I could write a englishOS?
<graspee>
it's out there alreayd
<graspee>
already*
<graspee>
society is the operating system, man!
<bnagy>
Alantas: yes. That's the kind of thing linguists talk about for HOURS
<Alantas>
shevy: BASIC?
<epitron>
sapir-whorf is realllll
<shevy>
graspee, nah, I exist outside of society
<Hanmac>
shevy no choice Latin :P
<CombatWombat>
bnagy: That's a common myth to suppose that a preposition only belongs before the subjective noun.
<graspee>
so far outside of society that you're on irc
<CombatWombat>
Again, just a philosophy, a dialect, a mere idea.
<Tasser>
wtf @ rails making method
<Alantas>
Someone once wrote a Perl thing that lets you write it in Latin. (Google it.)
heftig has quit [Quit: leaving]
<shevy>
graspee noone around me uses IRC :(
yankov has quit [Quit: yankov]
<Tasser>
ehh method! an ambiguity
<epitron>
Perlicus!
<CombatWombat>
"What did you step on?"
d3vic3 has joined #ruby
<graspee>
"on what did you step"
<shevy>
"step what on you did"
<shevy>
^^^ yoda
<epitron>
haha
<Alantas>
graspee: I'd have to disagree, there. That's the kind of nonsense up with which I will not put!
<CombatWombat>
My word, what have you happened to step upon?
<epitron>
Alantas: ahahaha
<bnagy>
CombatWombat: yeah I mainly meant with regards to at
<shevy>
you guys really should argue over programming languages instead
<Alantas>
"What did you step on?" is akin to "return nil unless herp?(derp)"
<rails>
:<
<shevy>
graspee, rails is big though
<bnagy>
I'm prepared to accept that ending a sentence with some prepostitions is established enough to be legal
<CombatWombat>
bnagy: But you can't hold a dangling preposition over me as if it's some universal law, when it has no such rule.
<shevy>
it's like a growing cancer
igaiga has joined #ruby
<graspee>
rails is business
<Alantas>
vs "On what did you step?" / "if not herp?(derp) then return nil end"
<Tasser>
Alantas, derp.herp? :-)
<graspee>
and i hate business
<shevy>
I hate herp and derp
<bnagy>
I didn't, only trailing 'at', especially with where, it's redundant, and, frankly wrong
<Hanmac>
Wombat ... could it be that you are a "drop bear"? :P
<shevy>
they are still at it!!!
<becom33>
hay shevy
<epitron>
Alantas gets it
<shevy>
becom33 why is the 33 in your nick
<CombatWombat>
It's mostly just a nerve-tickler to have it left on there when it's unnecessary. It certainly isn't 'wrong' though.
<becom33>
shevy, and shevy2 both are the same person rit ?
mdw has joined #ruby
benatwork has quit [Ping timeout: 245 seconds]
<graspee>
maybe shevy2 is more advanced
<shevy>
becom33, yeah, its my nick when I get disconnected
<epitron>
shevy2: shevy harder
bashdy has joined #ruby
<CombatWombat>
It really must come down to which particular flavor of the English language you subscribe to.
<shevy>
about a minute before I get disconnected, I cant read anything new on IRC :(
<graspee>
flavour*
<becom33>
it actally means become:3
<graspee>
muha!
<shevy>
lol graspee
<CombatWombat>
Ho ho, clever.
<graspee>
uk4ever down with the colonies
<shevy>
becom33, huh? becom33 means become:3 ?
<bnagy>
CombatWombat: basically it's a sentence you invented to show off you know a rarely used and arguably incorrect subjunctive, but it's wrong in other ways as well
<Hanmac>
CombatWombat are you a "drop bear" ?
addi has joined #ruby
<shevy>
graspee the UK empire kinda morphed into the global US empire, but they still drive the wrong way :(
<addi>
Stefunel, you there?
<bnagy>
and the claim that it's 'entirely' valid is just ridiculous
<becom33>
shevy, yea . first 3 refers to 'e' and last 3 refers a goffy face
<graspee>
there was never a uk emprie
<graspee>
it was the british empire
<shevy>
becom33 oh I see
<CombatWombat>
bnagy: It's mostly one of those great thought-pieces of the English language. A short sentence riddled with fun little arguable points.
<CombatWombat>
bnagy: But I agree, for the modern English speaker, it's 'wrong'.
<epitron>
commonwealth \o/
<shevy>
graspee the root of the evil was the UK, the rest were just colonies
<zizzyx>
i'm still working on that prompt of transforming a flat list into a tree, and i'm wondering about a minor implementation detail - how should i go about getting a hold of already created nodes when i want to assign a child to them? or assign an already created node as a parent to a new node. here is my code: http://pastie.org/3993879
<becom33>
btw I just made that up . I have no idea why I choose this name . its a random word I got into mind when I was registering in to IRC
maasha has joined #ruby
<graspee>
england is the real project. america is the uppity project fork
<zizzyx>
basically i think i need to implement a 'lookup by id' method somewhere since all the nodes will have an id parameter
<shevy>
and "commonwealth"... that would imply prosperity among its members. I refuse to use positive terms for slave-nations
igaiga_ has joined #ruby
<epitron>
hmm
<bnagy>
zizzyx: I'm not sure we should help you much more if this is for a job interview style question
<becom33>
amma gahai bat eken :/ katha seen eka do
<epitron>
shevy: i really like the ability to travel and work freely amongst commonwealth nations
<bnagy>
if you can't do it from the help we gave you before (which is more or less a complete solution) then maybe you need to study some more :)
<shevy>
epitron always use the whip with sweet candy!
<zizzyx>
i recognize that before you gave me complete solutions but that's not really what i wnat
<zizzyx>
is that the form that help usually takes in here
igaiga has quit [Ping timeout: 244 seconds]
heftig has joined #ruby
<CombatWombat>
We don't do your homework for you. :D
<zizzyx>
i'm kinda trying to uh
<zizzyx>
learn
<shevy>
zizzyx only if you equal bnagy == everyone else here
<zizzyx>
so helping me break conceptual boundaries would be aces
<maasha>
Hey, I don't understand this: "Martin_23".match(/([A-Z])+.+(\d+)/) => #<MatchData "Martin_23" 1:"M" 2:"3"> - why is the second match "3" - I would have expected 23?
<shevy>
zizzyx but usually questions are easy like... how to iterate over an array
freeayu1 has joined #ruby
<epitron>
shevy: i guess europe has something similar, right?
<maasha>
ah, greedy behaviour
<epitron>
the EU?
<shevy>
epitron, well the EU has
wvdschel has quit [Remote host closed the connection]
<bnagy>
zizzyx: I can comment on the style though = just take the whole hash as the parameter to initialize
<zizzyx>
thank you
<epitron>
shevy: can you work in other countries without (many) restrictions?
<bnagy>
zizzyx: and your to_s can just be @title
<epitron>
(in the EU)
<shevy>
epitron yeah
<epitron>
so it's like the commonwealth, but emerging from a desire to unify, than an empire
jrist-afk has joined #ruby
<epitron>
s/than/instead of/
<shevy>
somewhat, yeah
<shevy>
no unifying language though
<maasha>
no, something here is different to perl.
<epitron>
that's good, i think :)
<CombatWombat>
We should all just write executable poems.
<epitron>
it's good when people standardize voluntarily :)
pk1001100011 has joined #ruby
<graspee>
who can guess what directory my gems are stored in?
jamesphig has quit [Ping timeout: 260 seconds]
<epitron>
i suppose if everything is a mess, involuntary standardization can be a decent temporary solution
<maasha>
I better find a book and read.
hakunin has quit [Remote host closed the connection]
<epitron>
that goes rotten quickly tho
<CombatWombat>
graspee: ~/PHP/Wordpress/ ?
<graspee>
nup
<shevy>
graspee /usr/lib/ruby/gems/1.8/
<bnagy>
maasha: it should be the same. your middle .+ is eating a \d
<graspee>
1.8?!!?
<graspee>
i'll give you a clue
<Hanmac>
shevy: gem "name" contents
<graspee>
i laugh at 1.8 and despise its sandwiches
<graspee>
i don't think anyone has earlier than 1.8 here. or i would hope not
<bnagy>
actually I hate them
<shevy>
graspee, yeah I think ruby 1.8.4 was the lowest I saw here on #ruby the last ~2 years
<Hanmac>
graspee: gem environment
<shevy>
graspee are you using debian?
<epitron>
([A-Z])+ would make a lot of groups if your name was all caps :)
Divinite has joined #ruby
fserb has joined #ruby
<Muz>
Hanmac: that's slow and inefficient though! You have to wait for Ruby to actually fire up and do something, which is /dire/ with jRuby!!
<Muz>
:p
parse_ has quit [Quit: Lost terminal]
<CombatWombat>
Muz: You pervy! :D
<Hanmac>
Muz: what do you mean??
<graspee>
i'm using ubuntu so kind of
<CombatWombat>
Meh, not really all that bad if your environment isn't rails-heavy.
<CombatWombat>
I can fire up a jvm in about 0.7 seconds
<Muz>
Hanmac: well, you could just echo $GEM_HOME from your terminal. `gem environment` actually starts a ruby interpreter that runs `gem`
<CombatWombat>
With jruby
<graspee>
and i tried to install rvm ages ago, it went wrong, i installed the ruby stuff from the ubuntu repos then i got miffed off and downloaded the latest source and compiled and installed it
<CombatWombat>
graspee: You didn't even use checkinstall, did you?
<graspee>
no
<Muz>
It's not normally an issue, unless you're using jRuby, which can be (comparatively) slow to start up.
<CombatWombat>
FEARLESS WARRIOR
<shevy>
graspee, then your gem path is in /var/ something
<graspee>
hmm
<Muz>
Only if you do a systemwide install
<graspee>
thanks i'll take a look
charliesome has joined #ruby
<CombatWombat>
Jruby isn't fun for running lots of shortlived processes, for sure.
<CombatWombat>
But I fucking love that thing.
<epitron>
does jruby have a daemon?
<shevy>
RVM will only modify in $HOME right?
<epitron>
for forking off jruby faster?
<Hanmac>
Muz no you cant
Vainoharhainen has joined #ruby
<Muz>
shevy: by default.
<CombatWombat>
epitron: Yeah it has nailgun.
<graspee>
yeah but i got rid of jvm
<graspee>
rvm*
<Muz>
Hanmac: /I/ can.
<shevy>
hehe
<Hanmac>
i dont have $GEM_HOME so it fails
<bnagy>
epitron: jruby doesn't implement fork
fbits has joined #ruby
<Muz>
GEM_HOME is exported by rvm
<CombatWombat>
epitron: But it has analogues.
<epitron>
haha
<shevy>
I dont like the J in JRuby
<bnagy>
well it has native threads, so win
<Muz>
shevy: who does? ¬_¬
<Hanmac>
Muz: and let me guess if you build gems you only want it to work with rvm right?
<shevy>
:)
<Muz>
Hanmac: nope. How does that come into it?
<CombatWombat>
My dick is my best friend, it's the only one who stands up for me. :(
<Hanmac>
graspee: you could try this too: ruby -r "rubygems" -e "p Gem.path"
<epitron>
CombatWombat: jruby includes nailgun?
horseman has joined #ruby
<CombatWombat>
shevy: Naw, I'm actually pretty good at running a number of jvm instances without fucking up. Must be shit people who don't know how to be orsum.
<graspee>
oho thansk
tvw has joined #ruby
<CombatWombat>
epitron: Yes.
<shevy>
and monofilament whip
adambeynon has joined #ruby
<graspee>
usr local lib ruby gems 1.9.1
<shevy>
graspee whoa that is a fucked up path
<graspee>
and home graspeh .gem ruby 1.9.1
<epitron>
CombatWombat: soooooo... specific java apps have to be instrumented if you want nailgun to be able to nail them?
<graspee>
it has slashes too
<shevy>
it even is in violation of the FHS, if your ruby is at /usr/bin/ruby
<CombatWombat>
epitron: I've only used the nailgun stuff with ruby.
<CombatWombat>
But otherwise, no.
<graspee>
well the ruby i just installed from src stuck itself in usr local bin ruby i think
<shevy>
graspee, by default GNU configure will assume the prefix to /usr/local if not instructed otherwise
<graspee>
i just downloaded the src tarball and did configure make make install
<graspee>
yeah that's why loads of stuff i make from src ends up not in my path haha
<CombatWombat>
I'm pretty much set up with rvm.
kenperkins has quit [Quit: Computer has gone to sleep.]
<graspee>
angband.... angband.... RUN ANGBAND DAMNIT oh /usr/local/games/angband
red-panda has joined #ruby
williamcotton has quit [Quit: williamcotton]
<graspee>
i just felt i had to give the channel an insight into my noobiness because they might have started to believe i was god-like in my powers and i need you to have a realistic idea of me :P
<shevy>
see, a path like /usr/local/games
<shevy>
that makes no sense really
<shevy>
there is no structure like ... /usr/local/{editor,ide,browser,terminal,whatever}
<shevy>
I think the FHS even recommends the use of a games/ directory :)
<Hanmac>
maybe this could work too and maybe better ... string.gsub!(/[#{hash.keys.join('|')}]/,hash) ...
<Hanmac>
the bad is that the keys maybe not have the same size
octobrainz has quit [Quit: Never look down on someone unless you're helping them up.]
octobrainz has joined #ruby
<bnagy>
shevy: when I was at uni, /usr/local was on an NFS mount and everyone used terminals, so they had games in /usr/local/games so they could set group perms on the whole dir
<bnagy>
so it makes perfect sense if you're from the right era :S
jhchabran has quit [Remote host closed the connection]
octobrainz is now known as cephalopod
krz has joined #ruby
<graspee>
and in a multi-user environment
<kalleth>
horseman: lol
<kalleth>
if i could embed vim-like editing
krz has quit [Client Quit]
<Alantas>
/usr/"local" as an NFS mount point.
peterhil has quit [Ping timeout: 265 seconds]
krz has joined #ruby
<Tasser>
Alantas, it's not the local you think of ;-)
<epitron>
horseman: i really like their presentation-thing
Morkel has quit [Quit: Morkel]
<horseman>
epitron: but it just seems like a normal editor really, just with "cool graphics" lulz
<shevy>
isn't that a violation of the FHS? I thought every mount point would be required to be under /mnt :D
<epitron>
horseman: yep
<epitron>
but the interactive demo is super sexy :D
<epitron>
with the webgl zooming
<shevy>
kalleth, I'd like to do editor-baking
<graspee>
shevy you could point usr local at mnt something though
<shevy>
I pick up the best components from 100 different editors, and then make my own!
<Hanmac>
shevy NO ... /home and /boot are on extra partions
<Hanmac>
on my system
<horseman>
kalleth: in what situations do you use kvo vs using notifications
<shevy>
Hanmac, ah yes, forgot that
<epitron>
NEVAR FORGET
Morkel has joined #ruby
<graspee>
i've got a dodgy external drive that mounts in windows but not in linux
yonggu_ has quit [Remote host closed the connection]
<kalleth>
horseman: kvo?
yonggu has joined #ruby
<horseman>
kalleth: key value observing
<horseman>
kalleth: the cocoa thing
Morkel has quit [Client Quit]
<kalleth>
i don't
<horseman>
kalleth: related to cocoa bindings
<kalleth>
ever
<horseman>
why?
<kalleth>
because i have no idea what you're talking about
<horseman>
kalleth: wait, you're the objc programmer i spoke to yesterday right? or did i mix you up with someone else?
<kalleth>
the latter
<kalleth>
:p
<horseman>
hehe ok sorry
<kalleth>
hence my confuzzledness
davidw has joined #ruby
Morkel has joined #ruby
davidw is now known as Guest50470
<shevy>
lol
Ammar01 has joined #ruby
<bnagy>
wtf... this has been working til now, I swear it just broke
fserb has quit [Quit: ttyl]
<bnagy>
to write something out to a decent filename, I use Tempfile.new, save t.path, t.close! andf then File.open(t) and write to it
<bnagy>
which used to work... now it appears the file is being deleted on process exit
<bnagy>
even though it shuldn't be a tempfile anymore :|
<matled>
bnagy: you should not close! (unlink) the file and then just reopen it with File.open! that's racy
<bnagy>
matled: how does it race?
<hoelzro>
bashdy: because Tempfile doesn't care
<matled>
someone could take the filename in between
<bnagy>
and what should I do instead?
<hoelzro>
Tempfile's destructor will still delete it
<matled>
I don't know, the Tempfile class seems unsuitable if it cannot keep the file
<hoelzro>
bnagy: can you access the file description?
<hoelzro>
matled: that's by design, I think
<hoelzro>
s/description/descriptor/
<bnagy>
yeah it delegates to File, so
<matled>
hoelzro: imho it should have an option to teek the file
<matled>
*keep
<hoelzro>
it should, I agree
<bnagy>
yeah, that's what I want :(
<hoelzro>
but I don't know if it does
<shevy>
hehehe
<shevy>
welcome to Tempfile!!!
<matled>
the normal mkstemp(3) function should do what you want
<Hanmac>
imo tmpfile is not designed to keep the file ...
<matled>
I think Tempfile just reimplements it
<matled>
and did it in a bad way for a long time (I think they fixed it now)
<bnagy>
ok, but I prefer to have windows compatible code (bleah)
<bnagy>
I am just wondering why the finalizer is still in place even after you unlink
<bnagy>
maybe it installs an at_exit
tewecske has joined #ruby
<bnagy>
you'd think it would just unlink it and let the OS sort out the rest
<matled>
bnagy: you could just generate random filenames and File.open them with O_CREAT|O_EXCL (at least on posix, dunno about windows)
test34 has joined #ruby
test34 has quit [Changing host]
test34 has joined #ruby
<bnagy>
matled: yeah, but what I wanted was the filename generation code from Tempfile
<bnagy>
cause it seemed silly doing it myself
<bnagy>
but I guess I'll have to, and just use Dir.tmpdir
<matled>
you could send a bug report / patch and wait 2 years :)
<bnagy>
if it really is the Tempfile::Remover then it's definitely a bug imho
<bnagy>
once the tempfile object is closed and unlinked then its job is done
<matled>
mh, quite often I use Tempfile to create a file and then move it over to another place.. it's not that nice of Tempfile to unlink still after I moved the file either, some other process could have taken that filename in between
<bnagy>
something like card_stack.sample(cards) at some point
huamm has joined #ruby
<heftig>
keppy: the card stack is divided into hands evenly, without leftovers?
<heftig>
also, in random order?
<bnagy>
keppy: bleah you can't use sample, you need to use cards.times do hand << deck.pop end or something
<TTilus>
damn it, Process.kill(0, pid) to detect if a process with pid exists does not work within my app (it works on irb), in the app it always returns 1 as sign of ability to send signall, no matter what the pid is
<bnagy>
deck is a better name than card_stack :)
<TTilus>
this is old rails app
<bnagy>
TTilus: that's creepy
<TTilus>
does rails fsck up Process.kill?
<TTilus>
bnagy: tell me about it
<heftig>
keppy: (1..52).each_slice(7).to_a
<heftig>
gets you 7 7-card hands, and three leftovers
becom33 has quit [Ping timeout: 265 seconds]
becom33 has joined #ruby
<bnagy>
another skeleton is (1..hands).map {|hand| (1..cards).map {|card| deck.pop}}
<graspee>
wow. do you need voice to talk in ruby-lang?
<shevy>
graspee, yup since a few months
<shevy>
graspee is one reason why I am less often there now. the other reason is that #ruby has much more folks
<graspee>
how am i supposed to speak ... if i have no mouth?
m_3 has quit [Quit: leaving]
<shevy>
I think if you register the nick you can talk
<graspee>
oh
<graspee>
i had a problem with that
<shevy>
their reasoning is "you can still listen and learn, but not talk, unless you have registered"
<Hanmac>
shevy: maybe its because of horseman?
<shevy>
I am usually too lazy to auto register and I think it sucks, especially on channels like #ruby-lang which are already moderated
<graspee>
well i won't boost their figures any more then
<Tasser>
lots of channels need registering nowadays
<shevy>
Hanmac, nah, horseman was banned on #ruby-lang anyway
<shevy>
half the guys here are banned on #ruby-lang ;)
<Hanmac>
you too? :P
<shevy>
nope
<shevy>
the biggest abuse are all those who were banned for disagreeing with zenspider
<graspee>
disagreeing about what?
<shevy>
tsume/wolfe is still my favourite example of that
<shevy>
graspee about anything, especially with what zenspider says
serroba has joined #ruby
<shevy>
it follows a certain aggro-pattern. zenspider gets more and more aggressive, if you respond in an aggressive way and hype it up, he ends the discussion by banning them.
<graspee>
i just wondered what issues there would be that people could disagree on
<shevy>
graspee you would get banned if you dont stop this!
Richmond has joined #ruby
<graspee>
that's not disagreeing though
* shevy
takes op on #ruby.
<shevy>
alright, I have enough ...
ken_barber has joined #ruby
* shevy
bans graspee
amalvagomes has joined #ruby
<shevy>
or let's just require voice here :>
BiHi has joined #ruby
<shevy>
often though, those that got banned, are unbanned at a later time
<shevy>
usually by someone else than the one who banned them
<Hanmac>
and is 21.12.2012 the day where houseman gets unbanned?
<graspee>
i don't think christians have aligned their apocalypse to the end of the mayan long count
<graspee>
and of course neither did the mayans
berkes has joined #ruby
teolicy has joined #ruby
<shevy>
Hanmac no idea
<shevy>
I wanna have mRuby today
<teolicy>
Hi. I'm trying to port something from Ruby, and ran into the line "exec foo, bar".
<shevy>
it just uses whatever Foreman.runner returns
<shevy>
the two arguments to the method here are somewhat processed, then turned to exec as arguments
<shevy>
def fork_with_io(command, basedir)
<shevy>
I am glad that I dont have to maintain this, code without any documentation scares me :)
<teolicy>
Ah, wait, I got it, I got it. He's "cheating". Foreman.runner references bin/foreman-runner, which is a tiny shell script precisely so he won't have to deal with shell escaping.
<teolicy>
Never mind, thanks.
amar_key has joined #ruby
Progster has joined #ruby
Squarepy has quit [Changing host]
Squarepy has joined #ruby
liluo_ has quit [Remote host closed the connection]
dbgster has quit [Quit: dbgster]
teolicy has left #ruby [#ruby]
replore has joined #ruby
ph^_ has joined #ruby
cha1tanya has quit [Ping timeout: 252 seconds]
ph^ has quit [Ping timeout: 240 seconds]
`brendan has joined #ruby
irrationalfab has joined #ruby
amalvagomes has quit [Quit: amalvagomes]
nirakara has quit [Quit: This computer has gone to sleep]
jackiechan0 has quit [Ping timeout: 245 seconds]
benatwork has joined #ruby
wilmoore has quit [Remote host closed the connection]
<shevy>
hoelzro it kinda creates a .gemspec file and checks for proper file permissions and so on
ben_alman has joined #ruby
iocor has quit [Quit: Computer has gone to sleep.]
<shevy>
it also generates a *_version.rb file though, unasked. that annoyed me... I dont want those things to create any other file for me, except for a .gemspec file
kuranai|off is now known as kuranai
dekroning has joined #ruby
itnomad has quit [Ping timeout: 265 seconds]
bglusman has joined #ruby
Squarepy has quit [Ping timeout: 256 seconds]
tomzx has joined #ruby
manizzle has quit [Ping timeout: 246 seconds]
apeiros_ has joined #ruby
vectorshelve has quit [Quit: Page closed]
A124 has joined #ruby
red-panda has quit [Remote host closed the connection]
<pk1001100011>
Hanmac: Thank you. :o I will never need so big numbers. :D Or I suck…
looopy has quit [Remote host closed the connection]
looopy has joined #ruby
teh4 has joined #ruby
digitalcakestudi has joined #ruby
tk___ has joined #ruby
hynkle has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
tatsuya_o has joined #ruby
<bigfatfrock>
what's the purpose of defining class methods with a leading "self"?
<bigfatfrock>
I guess that's a good google question :)
chson has quit [Remote host closed the connection]
uris has joined #ruby
ph^ has quit [Remote host closed the connection]
teh4 has quit [Quit: Leaving]
paradoja has joined #ruby
theRoUS_ has joined #ruby
theRoUS has quit [Disconnected by services]
theRoUS has joined #ruby
theRoUS has quit [Disconnected by services]
capibara has joined #ruby
<matled>
bigfatfrock: you mean def self.foo?
theRoUS has joined #ruby
ElitestFX has quit [Ping timeout: 245 seconds]
<matled>
bigfatfrock: this defines a singleton method on the class. i.e. you call it as SomeClass.foo, and not on an instance of the class
theRoUS_ has quit [Changing host]
theRoUS_ has joined #ruby
theRoUS has quit [Disconnected by services]
theRoUS_ is now known as theRoUS
<keanehsiao>
anybody in Taiwan looking for a job? :p
theRoUS_ has joined #ruby
ph^_ has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
<keanehsiao>
We are hiring
jrist-afk is now known as jrist
v0n has quit [Quit: Quitte]
<bigfatfrock>
matled: thanks a lot, I understand that!
<bigfatfrock>
and that's what I meant, yep :)
a_a_g has left #ruby [#ruby]
irrationalfab has quit [Remote host closed the connection]
jonathanwallace has quit [Remote host closed the connection]
<matled>
bigfatfrock: note that this can be done on any object, even though this is seldomly used (for good reasons, imo)
carloslopes has joined #ruby
manizzle has joined #ruby
uris has quit [Read error: Connection reset by peer]
uris_ has joined #ruby
Croms has joined #ruby
<bigfatfrock>
it's weird to me that a method is a singleton and not the class itself
<bigfatfrock>
I think of a singleton as allowing only one instance of a class to be instantiated
<bigfatfrock>
but I probably need to pull out my design patterns book
iocor has joined #ruby
Asher has quit [Quit: Leaving.]
<matled>
bigfatfrock: well, actually you define that method on the "eigenclass" (or whatever it is called nowadays) of the object. i.e. a class between the real class that exists only for this specific object
<adac>
carloslopes, no luck. bit this seems to work: 'if @feedback_channel.analogue_to != "None" and to_test'
<adac>
carloslopes, yes :)
<adac>
carloslopes, and hwo to test if "to_test" is false?
crankycoder has joined #ruby
<carloslopes>
adac: !to_test
i8igmac has quit [Quit: Leaving]
<carloslopes>
adac: i think.. let me try here
<adac>
carloslopes, kk
bashdy has joined #ruby
<Hanmac>
bigfatfrock & matled maybe its important for you, but if you use only extend, no eigenclass is generated, and it can be still marshal'ed
<carloslopes>
adac: yes.. !to_test :)
<adac>
carloslopes, it enters 'if @feedback_channel.analogue_to != "None" and to_test' EVEN IF to_test is false
<adac>
lol this is freaking me out
<adac>
something is fishy here
<pwned>
adac: perhaps to_test is not boolean
<carloslopes>
adac: pwned yes, i think that what pwned say it's true
<pwned>
to_test= "42" then to_test== true would be false
<pwned>
but to_test would be true
<carloslopes>
adac: because to_test = true; if to_test == true should work
iocor has joined #ruby
red-panda has joined #ruby
<pwned>
any ruby bots here:
<carloslopes>
adac: check if your variable is instantiated correctly
<adac>
pwned, carloslopes looks like that but this is very strange. When I output it it shows me either "true" or "false" value for "to_test"
<pwned>
adac: "true" == true is false
<carloslopes>
adac: "true" is not true
ABK has joined #ruby
<carloslopes>
adac: "true" is a string and true is a boolean
<carloslopes>
adac: they are different things
<workmad3>
"true" is merely truthy
<pwned>
I think "true" should have been equal to true
<workmad3>
but "false" is also truthy :)
<adac>
lol
<adac>
well its true without "" that outputs me
<workmad3>
pwned: go to PHP :P
<pwned>
"true"== true.to_s #though
<pwned>
workmad3: please no insults
<workmad3>
pwned: you're the one that's suggesting "true" should equal true
<workmad3>
pwned: which it does in PHP ;)
<adac>
but it looks like that both re indeed srings i have to test
<carloslopes>
pwned: hmm think not.. because in this case we will need to use strict equals operator to check if boolean is really a boolean
<pwned>
workmad3: just because I like dates doesn't mean I want to live in saudi arabia
<adac>
its not bool, my "true" and "false" are strings for some reason
<adac>
Is there a way to output the datatype?
<carloslopes>
adac: "true".class
<carloslopes>
adac: true.class
<workmad3>
pwned: you can do 'if "true" ' and it will be truthy and go into the branch
sspiff has quit [Remote host closed the connection]
<adac>
carloslopes, lets check this :)
<matled>
Hanmac: interesting, this seems to be true for string but not for classes. i.e. class Foo; def self.foo; end; end; Marshal.dump(Foo) still works fine
<pwned>
carloslopes: because "false" will be true ? yeah I guess
<pwned>
you're right
awarner has joined #ruby
<carloslopes>
pwned: yes.. if 'true' == true, it will be similar to javascript.. that we have == and === operators
<pwned>
what if I just want "true" to be true and not "false" to be false :D
<carloslopes>
pwned: and i don't like this :)
<carloslopes>
pwned: (my opinion) :p
celm has joined #ruby
maurosr has joined #ruby
<adac>
carloslopes, pwned, workmad: its a string indeed accoring to .class
maurosr has left #ruby ["WeeChat 0.3.7"]
chomp has joined #ruby
<adac>
*according
<carloslopes>
adac: good.. so you will need to put to_test == 'true' in your if statement
<workmad3>
pwned: but an equality comparison of 'true == "true" '... well, the boolean true is definitely not the string "true"
C0deMaver1ck has joined #ruby
philcrissman has joined #ruby
Progster has quit [Ping timeout: 244 seconds]
<adac>
carloslopes, jepp (: thank you guys for helping me out!
<carloslopes>
adac: yw ;)
<pwned>
yeah he's welcome
iocor has quit [Quit: Computer has gone to sleep.]
LBRapid has joined #ruby
seivan has joined #ruby
kevinbond has joined #ruby
<pwned>
workmad3: saudi arabia is a nice place by the way. I just won't be persuaded to live there.
<pwned>
they have lots of great engineers from india and middle east
<pwned>
salaries are great
liluo has joined #ruby
<workmad3>
:)
lxsameer has joined #ruby
iocor has joined #ruby
irrationalfab has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
<graspee>
saudi arabia is a great place to live if you aren't a religious or political minority, homosexual, apostate or woman
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
ananthakumaran has quit [Quit: Leaving.]
internet_user has joined #ruby
<pwned>
graspee: Those may be true unless you are an engineer. In which case they just let you do your job.
jonathanwallace has quit [Remote host closed the connection]
<pwned>
I miss the times you had to link at least five libraries to make a simple game
<pwned>
now you just link four
<workmad3>
heh :)
<shevy>
oh god
<shevy>
I hate boost
tcopp has joined #ruby
<shevy>
they should really stop proliferating non-integrated extensions to C++, and either drop them, or put up a new C++ that has all the shit that is needed
<sec_>
how do sort on object?
<sec_>
how do sort on object?
<pwned>
shevy: they do, once every five years
<pwned>
well this time it was 9 years
<workmad3>
pwned: 5 years? you've got to be kidding
<shevy>
sec_ object.sort or .sort_by
brainer has joined #ruby
<shevy>
pwned I kinda have the feeling that they will still require boost ...
<pwned>
or perhaps it is logarithmic progression
<workmad3>
pwned: last official C++ standard was 1998, new one was 2011, and there was a technical update in the middle
<pwned>
D's whole existence is based on a verse in ISO 14882:98 that says that an implementation doesn't have to provide the standard library
<graspee>
ah
<pwned>
not a very strong basis
<shevy>
hoelzro, google puts money into shit... see Dart, the language that will DESTROY javascript
<shevy>
sec_, it is a regex. // splits on each-character
<graspee>
i've heard of D and go but never knew what they were really. i knew D was related to C vagually
freeayu1 has quit [Quit: 离开]
<shevy>
sec_, you can not sort a string alone. you need to treat it as array of characters, if you want to use .sort. or you come up with your own sorting algorithm... but it will still split on char or bytes, I assume
trebaum has joined #ruby
trebaum has quit [Changing host]
trebaum has joined #ruby
<shevy>
yeah I was surprised that noone uses D
<sec_>
shevy: ok
<shevy>
you always read how superior D is but then it fails to dominate
<hoelzro>
shevy: it's better than C++, mo
<hoelzro>
as a language, that is
<shevy>
yup. I keep on reading the same. it just does not seem to deliver in May 2012 :)
<CannedCorn>
it says could not create makefile due to some reason, probably lack of necessary libraries or headers
<ramblex>
sec_: yes, then you can use .values to get what you want i think
<CannedCorn>
took a look in the mkmf file and it looks as though there are problems during extraction
mikepack has joined #ruby
kenperkins has joined #ruby
robdodson has joined #ruby
<sec_>
wow
<sec_>
very cool ramblex
hakunin has quit [Remote host closed the connection]
<sec_>
thanks
<ramblex>
np
saltnvinegar has quit [Quit: saltnvinegar]
elux has joined #ruby
<elux>
hey guys
<elux>
does anyone here use Rack::Cache?
<Hanmac>
sec_ a.group_by{ |i| i.chars.sort.join}
savage- has quit [Remote host closed the connection]
<elux>
i noticed its not thread-safe.. i was trying to use it with the Puma rack server, and it started doing some weird shit, then i realized whats going on ..
<elux>
perhaps there is a synchronized data store tho ..?
<ramblex>
Hanmac: you don't even need the join i don't think
<Hanmac>
ramblex depend on the output he wants
* sec_
start feel like ruby
dekroning has quit [Ping timeout: 244 seconds]
blacktulip has joined #ruby
jrajav has joined #ruby
looopy has quit [Read error: Connection reset by peer]
looopy has joined #ruby
niku4i has joined #ruby
ElitestFX has joined #ruby
billiamii|work has joined #ruby
test34 has quit [Ping timeout: 244 seconds]
test34 has joined #ruby
bglusman has quit [Remote host closed the connection]
<CannedCorn>
anyone familiar with ruby in windows at all
<dev_>
made me think it was printing 14 but its printing 1 1 4 2 9 3 1 6 4 without the new line
maesbn_ has quit [Remote host closed the connection]
<ramblex>
indeed
wallerdev has joined #ruby
axl_ has quit [Read error: Connection reset by peer]
looopy has joined #ruby
<dev_>
I am assuming the \n sequence will do the work
axl_ has joined #ruby
<shevy>
:)
thecreators has quit [Read error: Connection reset by peer]
<dev_>
thx guys this thing is fun
thecreators has joined #ruby
chienpo has joined #ruby
red-panda has joined #ruby
MasterIdler has joined #ruby
rdamen has joined #ruby
<dev_>
one last question
<dev_>
in eclipse i'm trying to analyze a code
DrShoggoth has joined #ruby
<shevy>
ewww
<davidcelis>
ew
<shevy>
eclipse!
<ramblex>
heh
<dev_>
wait what you guys use?
<ramblex>
vi
<dev_>
i'm on ubuntu
<shevy>
I use bluefish 1.0.7
manizzle has quit [Ping timeout: 246 seconds]
<Hanmac>
dev_ i use gedit for single files and eclipse for projects
fjfish has quit [Remote host closed the connection]
jackiechan0 has joined #ruby
<shevy>
ruby code should be simple, if someone needs an IDE for ruby code then it seems too complicated for 99% of the usage cases for ruby
aantix has joined #ruby
<dev_>
okay, coming from java, when you type a variable and dot, it displays options of what you can do, tha'ts why I chose eclipse but my question is, I don't even get that functionality
aantix has quit [Read error: Connection reset by peer]
<sec_>
ramblex: 100% correct
<sec_>
ramblex: thanks
<Hanmac>
shevy: i write an binding, so sometimes i need more then 100 files to look over ...
<davidcelis>
dev_: gedit is fine for projects
iocor has joined #ruby
<davidcelis>
esp. with gmate
aantix has joined #ruby
<sec_>
gmate is on macosx?
<shevy>
Hanmac and you use ... eclipse?
<davidcelis>
gmate is a gedit plugin to make it more textmate like
<Hanmac>
yeah and it works file
<davidcelis>
you can get it from the package manager
<Hanmac>
fine
<davidcelis>
i can't stand IDEs in general
niku4i has quit [Remote host closed the connection]
<davidcelis>
unless you're one of the people that consider vim an IDE
<Hanmac>
dev_ do you install the ruby plugins for eclipse? and if that not work i think this smart function lookup cant work on ruby because ruby is to dynamic
aantix has quit [Read error: Connection reset by peer]
<dev_>
I installed the aptana plugin
<dev_>
here's what I'm trying to accomplish.. i have this code I need to analyze
<dev_>
it uses a lot of require, and that sounds like import from java
<dev_>
i need to know what lines of codes uses a specific library
<dev_>
for example instance.memory
<dev_>
in java, clicking on instance will tell me the type of object
<dev_>
that sort of thing.
keppy has joined #ruby
<davidcelis>
java is statically typed
<davidcelis>
in ruby, a variable can have anything
krusty_ar has quit [Ping timeout: 246 seconds]
<davidcelis>
to highlight a variable in ruby and know what object it stores would require a step-through of, potentially, a LOT of code
khakimov has quit [Quit: Computer has gone to sleep.]
ipoval has joined #ruby
brianpWins has quit [Quit: brianpWins]
berkes has quit [Ping timeout: 246 seconds]
rushed has quit [Quit: rushed]
<dev_>
david what it stores is far fetched but at least what class it belongs to originally
<dev_>
or at that point in the code
itnomad has joined #ruby
ABK has quit [Ping timeout: 252 seconds]
mikepack has quit [Remote host closed the connection]
jnoob22 has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
rushed has joined #ruby
apeiros_ has joined #ruby
fudanchii has quit [Quit: WeeChat 0.3.8-rc2]
xaq has quit [Remote host closed the connection]
<elux>
is there a way to do something like Dir[some_path+"*"] .. and have it return the filename, but also the stats of a file.. specifically, the length or last time it was modified..
fudanchii has joined #ruby
<apeiros_>
elux: Enumerable#map and File.stat
<elux>
yea.. for sure..
<elux>
was hoping i could do it with a single call
<apeiros_>
add a method, there, one call…
<elux>
lol.. i meant IO request
<elux>
s
<elux>
but fair enough.. that should work. thanks!
v0n has quit [Quit: Quitte]
<apeiros_>
I don't think there's a low-level API to stat a whole dir
<apeiros_>
but I ain't a C programmer
robdodson has quit [Quit: robdodson]
<dev_>
for example this code i'm looking at has, require "fileutils", now I can search if file that and see if it is a library of ruby, but can't really tell for sure where in the code it is being called, vice versa. if I had a line of code calling a method, I would like to know at least what class' method it is calling.
<davidcelis>
dev_: You can't really do that, dude; you can't even tell what class the variable points at just by highlighting it. Ruby is dynamically typed, it can have any object in it depending on how the code has run thus far with various inputs
adeponte has joined #ruby
<davidcelis>
dev_: Best you can do is use a debugger or stick in a `puts variable.class` statement
<dev_>
okay thanks
<dev_>
that was very helpful, again first day in ruby.. lol know so little
<davidcelis>
sure thing
<davidcelis>
most people i know don't bother with ruby-debug
<davidcelis>
they just throw in puts statements
<dev_>
yeah i know what you mean
twqla has joined #ruby
bier has quit [Ping timeout: 245 seconds]
bricker88 has joined #ruby
CheeToS has quit [Ping timeout: 240 seconds]
bluOxigen has quit [Ping timeout: 245 seconds]
alem0lars has quit [Quit: quit]
itnomad has quit [Quit: Leaving]
<pwned>
I throw in tests
<pwned>
it is less painful when you're drunk
<dev_>
lol
<dev_>
now I understand why people using vim and all these text editors
sepp2k has quit [Remote host closed the connection]
<shevy>
davidcelis I used advanced debugging
<shevy>
davidcelis I use pp rather than puts for it... :>
<davidcelis>
pp is nice
<davidcelis>
i use pry
<bnagy>
I used pry today for debugging, for the first time
<bnagy>
was completely useless, went back to 'p'
<bnagy>
:)
<horseman>
bnagy: what was useless about it naggy!
<pwned>
I use vodka and plums for debugging
<horseman>
bnagy: did you use 'pry' or 'binding.pry' ?
<bnagy>
horseman: it just didn't tell me anything I didn't know before
<bnagy>
binding.pry
andrew_ has quit [Remote host closed the connection]
<bnagy>
turns out I typo'd initialize and went blind
<horseman>
bnagy: well...all it ever claimed to do is give you an interactive session at the point you call it, if that's not useful then i guess you have a kind of bug that isn't amenable to that sort of exploration
<shevy>
hah!
<shevy>
I hate mistyping initialize
<shevy>
"def intialize"
<shevy>
took me way too long to find that error
<bnagy>
inorite??
<sec_>
can you tell me basic usage about OOP in ruby?
chrismcg is now known as zz_chrismcg
heftig has joined #ruby
yankov has quit [Remote host closed the connection]
<C0deMaver1ck>
sec_: everything in Ruby is OOP
<bnagy>
you can't help but use OOP, everything is an object
<bnagy>
except some things
ipoval has quit [Quit: ipoval]
a_a_g has joined #ruby
Morkel has joined #ruby
jimeh has quit [Ping timeout: 246 seconds]
<bnagy>
sec_: think in terms of actual objects, and what that object should be able to DO (methods) and what ATTRIBUTES the object should have that support those actions (@ivars)
bglusman has joined #ruby
<bnagy>
and then the interactions build fairly naturally
jgrevich has joined #ruby
<Hanmac>
and everything which is an object is an instance too
booginga has joined #ruby
<horseman>
sec_: basic usage would be to define a class: class Hello; def blergh; end; end
<bnagy>
eventually you'll start to recognise patterns
<horseman>
sec_: and instantiate the class like so: hello = Hello.new
<sec_>
(a) Create a class Dessert with getters and setters for name and calories. Define instance
<sec_>
methods healthy?, which returns true if a dessert has less than 200 calories, and delicious?,
bier has joined #ruby
<sec_>
which returns true for all desserts.
<bnagy>
an then you'll start yelling at people for doing it wrong
<horseman>
sec_: sounds like homework
<horseman>
:)
<sec_>
horseman: take this examle
<bnagy>
and then you'll start preaching agile development and XP
<sec_>
horseman: yeah,
<horseman>
sec_: do your own homework :)
<bnagy>
and then someone will (hopefully) shoot you
medik has quit [Quit: ...]
<sec_>
horseman: i am doing
<horseman>
sec_: if you cant do it, then clearly you weren't paying attention in class
<sec_>
horseman: so i am here
<sec_>
horseman: :)
medik has joined #ruby
<pwned>
I'm surprised you have ruby class
<sec_>
pwned: yeah,
<pwned>
"ruby".class == "String" ?
lopin has quit []
<bnagy>
class Dessert;attr_accessor :name, :calories;def healthy?;@calories<200;end;def delicious?;true;end;end
<pwned>
Dessert.new.tap do |dessert| dessert.@calories= 3000; puts dessert.healthy? end
bglusman has quit [Remote host closed the connection]
beneggett has joined #ruby
<pwned>
you can chain tap this map that each theother
<pwned>
it's clean and modular
<pwned>
it is also the k-combinator
Helius has quit [Ping timeout: 248 seconds]
<pwned>
who doesn't love k-combinators?
<horseman>
heftig: i have a few applications similar to that
<horseman>
it's nice
<horseman>
and i think quite readable if you're used to it :)
<bnagy>
horseman: I have been looking, not very seriously, for a solution to that for years :)
philcrissman_ has quit [Remote host closed the connection]
<bnagy>
1,2,3].tap {|a| a.delete_at(2)}
<bnagy>
=> [1, 2]
<sec_>
horseman: yeah, i only use ruby 1-2days
<bnagy>
never thought of tap
<horseman>
cool
counterbeing has quit [Ping timeout: 244 seconds]
<bnagy>
it's gross and I dunno if I would use it in real code, but it's cooool
GuidovanPossum has joined #ruby
jrist-afk is now known as jrist
bigfatfrock has left #ruby [#ruby]
<sec_>
bnagy: has no 'return thing' in code?
robbyoconnor has quit [Read error: Connection reset by peer]
robbyoconnor has joined #ruby
medik has quit [Ping timeout: 265 seconds]
Vainoharhainen has quit [Quit: Leaving...]
ericcoleman has joined #ruby
dEPy has joined #ruby
jenrzzz-mac has quit [Quit: jenrzzz-mac]
lennyks has quit [Ping timeout: 245 seconds]
<bnagy>
you don't usually need explicit return in ruby, methods will return the last evaluation result
kenichi has joined #ruby
havenn has joined #ruby
Poapfel has quit [Ping timeout: 244 seconds]
Poapfel has joined #ruby
kaiwren has joined #ruby
skyjumper has left #ruby [#ruby]
<sec_>
bnagy: attr_accessor is same as constructor def initialize() ?
headius has quit [Quit: headius]
<bnagy>
sec_: no
schovi has quit [Remote host closed the connection]
bglusman has joined #ruby
ericcoleman has quit [Remote host closed the connection]
Araxia_ has joined #ruby
mrsolo has joined #ruby
<bnagy>
ok bedtime
AlbireoX has quit [Read error: Connection reset by peer]
medik has joined #ruby
brianpWins has joined #ruby
jnoob22 has quit [Ping timeout: 260 seconds]
workmad3 has quit [Ping timeout: 245 seconds]
xaq has joined #ruby
carinishead has joined #ruby
dtang_ has quit [Quit: dtang_]
banseljaj is now known as imami|afk
<carinishead>
i know there are several ways to do dynamic method calls in ruby, but is there a way to pass an object (without a to_string method) as an argument to a dynamic call?
<carinishead>
i'm trying to iterate through an array of methods to be called, they're obviously strings… you can call methods dynamically using Object.send(:method_name), or by eval method_name
chico_chicote has joined #ruby
<carinishead>
yeah
<apeiros_>
you usually do not want to use eval.
robdodson has joined #ruby
<carinishead>
apeiros: i originally had used veal because i read that the performance was best with this method, but realized i can't do that now
<dEPy>
when shoul one use static classes and when static methods?
<apeiros_>
carinishead: I seriously doubt that eval is the fastest for that.
<apeiros_>
dEPy: what's a static class? in ruby I mean…
danielvdotcom has joined #ruby
saltnvinegar has quit [Quit: saltnvinegar]
robdodson has quit [Client Quit]
adamkittelson has joined #ruby
<dEPy>
class << self ? or I undestood it wrong?
medik has quit [Quit: ...]
<apeiros_>
I think you did
medik has joined #ruby
liluo has quit [Remote host closed the connection]
<dEPy>
ah.. k
<dEPy>
then just about static methods :D
<apeiros_>
class << self does not create a new class. it opens an existing class, which every object has
horseman has quit [Read error: Connection reset by peer]
GhettoCode has joined #ruby
<dEPy>
oh, ok..
<Hanmac>
apeiros_ not for every objects
<apeiros_>
dEPy: well, with classes, the common use-case is for specific constructors. see e.g. Date.civil(y,m,d), Date.ordinal(year, day_of_year), Date.commercial(year, week, day_of_week)
<apeiros_>
Hanmac: yes, I know. but I don't see a point in confusing dEPy at this point.
luxurymode has joined #ruby
ramblex has quit [Ping timeout: 246 seconds]
<apeiros_>
Hanmac: I also know that they're technically only coming into existence when needed
<carinishead>
apeiros: that worked… i originally hadn't used it because i was trying to call non instance methods, but i totally spaced i could just say self.send(:method, arg)
<carinishead>
thanks
<apeiros_>
carinishead: you can also just use `send(:method, arg)`
<apeiros_>
i.e., leave away the `self.`
<carinishead>
ahh
<carinishead>
did not know that
<carinishead>
thanks!
<dEPy>
but, def self.something ... end is static method then right?
<apeiros_>
dEPy: we don't call it static method
<apeiros_>
but yes, it's a class method
<dEPy>
class method? :)
<shevy>
:)
horseman has joined #ruby
carinishead has left #ruby [#ruby]
<Hanmac>
a= Object.new; def a.something ... end works too :P
<dEPy>
oh, so you can add methods on objects like in javascript
<shevy>
apeiros_ is teaching swiss ruby. it's the strict ruby, in the left hand he has a stick (with thorns), but in the right hand he has Schokli (chocolate)
jnoob22 has joined #ruby
<apeiros_>
oh, carinishead left… eval is *lots* slower than send. about 60x here.
<dEPy>
Hanmac but if you do it that way is it still class method or instance method?
<shevy>
dEPy it is specific to the object that is "a"
hynkle has quit [Read error: Connection reset by peer]
<apeiros_>
dEPy: technically, all methods are instance methods
<dEPy>
am, wait.. so..
<apeiros_>
there really isn't such a thing as a class method. calling a method that is just "convenience"
<Hanmac>
its called singleton method ... an method defined in the eigenclass of a
hadees has quit [Quit: hadees]
neersighted is now known as neersighted|AFK
<shevy>
only a has that
<dEPy>
so it's like prototype in javascript?
<shevy>
garfield = Cat.new; def garfield.fat?; true; end # <-- only garfield is a fat cat!
<jrajav>
ww/graves all day
<jrajav>
<3
<jrajav>
Whoops wrong channel sorry :P
<dEPy>
oh. so it's not like prototype :)
<shevy>
not sure what prototype does in js?
<shevy>
does it add to all classes in javascript?
<dEPy>
after creation you can only add methods to that instance?
<shevy>
does js even have classes... hmmmm
<dEPy>
yes, it adds to all classes with the same prototype
neersighted|AFK is now known as neersighted
<dEPy>
shevy not really, it's prototype based (like io)
<apeiros_>
dEPy: it's just that every object has a "secret" class sitting in front of the objects .class. that is the .singleton_class
<shevy>
ok, not sure I understood it, but it does not sound to be the same at all
jackiechan0 has quit [Quit: Sto andando via]
<shevy>
io is cool
<apeiros_>
dEPy: and in the method lookup chain, that class is considered first
<shevy>
I hate that they use := for assignment though
<dEPy>
shevy :D pascal style
medik has quit [Quit: ...]
<shevy>
pascal committed that atrocity? :(
medik has joined #ruby
<Hanmac>
shevy i hate it too, it looks like vampire teeth
schovi has joined #ruby
<shevy>
lol
<dEPy>
apeiros and this class is eigenclas?
<shevy>
yeah and = means "update Slot"
<apeiros_>
dEPy: ruby 1.9 settled on the term singleton_class
<apeiros_>
but yes, it was/is also called eigenclass
<dEPy>
ok, good to know :)
ruby has joined #ruby
davidpk has joined #ruby
<dEPy>
so.. class << self
<jrajav>
:= is more correct mathematically speaking :P
luckyruby has joined #ruby
<dEPy>
is probably for metaprogrammin then?
zinjacoder has quit [Quit: Peace!]
<apeiros_>
meh, it's for programming
tomb__ has joined #ruby
<dEPy>
nvm then
<dEPy>
must read more :)
<apeiros_>
class Foo; class << self; $x = self; end; end; $x == Foo.singleton_class # => true
<apeiros_>
`class << self`, or rather, `class << obj` just opens the singleton_class of obj
iocor has quit [Quit: Computer has gone to sleep.]
<apeiros_>
all you need to be aware of is that `class Foo; $x = self; end; $x == Foo`
ElitestFX has quit [Ping timeout: 245 seconds]
<apeiros_>
i.e., within the class body, self references the class
<Hanmac>
depy sample: you want ABC.xyz as attr methods on the class, but attr_accessor only works on the instances, but you could do class << ABC; attr_accessor :xyz; end
krz has joined #ruby
<dEPy>
I see, so you can "patch" that class
ruby has quit [Client Quit]
nfluxx has joined #ruby
Joeysface has joined #ruby
hynkle has joined #ruby
<Hanmac>
in ruby you could patch mosty everything
o_proxeneta has joined #ruby
noganex has quit [Ping timeout: 244 seconds]
o_proxeneta has quit [Remote host closed the connection]
o_proxeneta has joined #ruby
chomp has quit [Quit: Leaving]
<dEPy>
I bet people use this for evil things :)
adeponte has quit [Ping timeout: 244 seconds]
<Hanmac>
ruby does not have something like final in C++ :P
v0n has joined #ruby
neersighted is now known as neersighted|AFK
hadees has joined #ruby
neersighted|AFK is now known as neersighted
medik has quit [Quit: ...]
nfluxx has quit [Remote host closed the connection]
medik has joined #ruby
nfluxx has joined #ruby
diegok has quit [Remote host closed the connection]
noganex has joined #ruby
<apeiros_>
Hanmac: but there's freeze
<apeiros_>
applicable to classes…
RubyPanther has quit [Ping timeout: 240 seconds]
<davidcelis>
apeiros_.freeze
adeponte has joined #ruby
<apeiros_>
NoMethodError: undefined method `freeze' for apeiros_
<apeiros_>
NameError: undefined method `freeze' for class `BasicObject'
* apeiros_
snickers
<Hanmac>
:P
medik has quit [Ping timeout: 265 seconds]
mdhopkins has quit [Quit: mdhopkins]
<AlRazi>
I have a general question if you people don't mind
<davidcelis>
yeah freeze is on Object, not BasicObject
<davidcelis>
AlRazi: most of us don't
<shevy>
AlRazi the answer is yes
<AlRazi>
other than rails, why should one invest in ruby ?
<davidcelis>
lol
<AlRazi>
excuse my utter ignorance
<apeiros_>
AlRazi: same answer as to any other programming language
<shevy>
AlRazi as replacement for all those ugly shell scripts. as replacement for perl. as replacement for ... hmm... GUIs insofar when you use ruby-gtk
<davidcelis>
"why not"
Joeysface has quit [Ping timeout: 248 seconds]
<apeiros_>
either because you can use it to pay your bills, or because you can use it to enjoy yourself
<shevy>
AlRazi ruby will fit precisely where perl python and php fit
<davidcelis>
shevy: we do not speak of php in these parts
adeponte has quit [Ping timeout: 244 seconds]
<shevy>
AlRazi ruby won't fit as replacement for C or assembler though :(
<AlRazi>
i do enjoy it a lot
<AlRazi>
but my coworkers keep telling me that demand on php is much higher
<davidcelis>
AlRazi: that is the main reason to use it
<apeiros_>
shevy: depends. there's lots of places that use C where they really shouldn't.
<davidcelis>
AlRazi: use what you enjoy
lxsameer has quit [Quit: Leaving]
<shevy>
AlRazi, a friend is coding PHP for a living. but, there is no real reason I can tell why ruby would be unable to do what php does
<shevy>
apeiros_ yeah ... but I mean all the Unix tradition too... it kinda is a C cult. if they would have had a language like ruby! with the speed of C ...
<shevy>
matz should have created ruby before he was born
<shevy>
hmm I should file a bug called that
<apeiros_>
then it'd have shared the fate of languages like smalltalk and lisp
<shevy>
hehe
<shevy>
yeah, good point
ukwiz has quit [Quit: Leaving]
<shevy>
the surrounding culture, ecosystem and available hardware influenced people heavily
<shevy>
ruby would not have been ruby before perl came along
<apeiros_>
Hanmac: seems you've given up on trying to freeze me :-p
<shevy>
hmmm
<shevy>
Yusuke Endoh confuses me
<Hanmac>
apeiros_ if you remove the method from Kernel there is no way to freeze you .P
Ankhers has joined #ruby
and0 has left #ruby [#ruby]
<davidcelis>
freeze is on Object
<apeiros_>
Kernel < apeiros
<shevy>
lol
<apeiros_>
also that :)
<shevy>
are you guys doing snowball fight again ...
rushed has quit [Quit: rushed]
<davidcelis>
just noticed the channel topic was updated to suggest Gist
<davidcelis>
most excellent....
<dEPy>
again some questions
<sdferfx>
Hello. I am looking at this whenever gem to help manage crons with capistrano. One of the examples shows this: "set :whenever_environment, defer { stage }". I was trying to lookup the meaning of the block with the defer in front of it. I can't seem to find that. Can someone here explain it to me? Thanks.
<Mon_Ouie>
Wasn't it changed when pastie.org had been DDoS'd?
<dEPy>
a = Something.new ; def a.smile ... end; <- adds smile method to instance and if I create b = Something.new , b won't have smile method right?
<shevy>
sdferfx, defer seems to be a method. and the block is passed to the method defer. so the first task would be to find out what the method defer does. especially with blocks in general
<dEPy>
but If i open up Something with class << Something and define smile method here , every new instance will have smile method?
<shevy>
the gem that uses that should have documented it though
<shevy>
dEPy, yes, only a will have the method, b wont have it
<shevy>
dEPy, if you modify any class, all classes will gain that behaviour
Aaton_off is now known as Aaton
<sdferfx>
ok, yeah, I suspected it would be a method and not a language keyword, but I didn't see a definition in the code (though admittedly I just skimmed, didn't ack it) and I found some reference to "deferrable blocks" as a language suggestion
<sdferfx>
thanks for your help.
red-panda has quit [Remote host closed the connection]
<shevy>
sdferfx, just grep -r until you find it :)
<shevy>
also, the value of stage
<sdferfx>
Nope, it doesn't exist in the whenever gem. I guess it's a capistrano method?
ConstantineXVI has joined #ruby
<shevy>
dEPy, try class Foo; def test1; puts 'hi from test1'; end; end; foo = Foo.new; foo.test1; def foo.test2; puts 'hi from test2'; end; foo.test2
<shevy>
and then a new object again, it should not have the test2 method
klaas has joined #ruby
<shevy>
lib/capistrano/configuration.rb: alias defer lambda
red-panda has joined #ruby
<shevy>
sdferfx, seems as if capistrano is being an idiot perhaps
<shevy>
because in that case, it would be the same as lambda {}
<shevy>
and who knows why they found it better to alias defer to lambda.
<shevy>
nice comment though:
<shevy>
"# make the DSL easier to read when using lazy evaluation via lambdas"
Solnse has joined #ruby
jcromartie_ has joined #ruby
flip_digits has joined #ruby
kaiwren has quit [Quit: kaiwren]
jenrzzz-mac has joined #ruby
AlbireoX has joined #ruby
jcromartie has quit [Ping timeout: 256 seconds]
jcromartie_ is now known as jcromartie
AlbireoX`Laptop has joined #ruby
b3nt_pin has joined #ruby
v0n has quit [Remote host closed the connection]
jonathanwallace has quit [Remote host closed the connection]
o_proxeneta has quit [Quit: o_proxeneta]
benatwork has quit [Remote host closed the connection]
<dEPy>
so, specifying methods inside a class inside class << self .... end is the same as defining methods inside a class using def self.method ... end?
jenrzzz-mac has joined #ruby
AlbireoX_ has joined #ruby
AlbireoX has quit [Read error: Connection reset by peer]
<Industrial>
davidcelis: Nice, coming from javascript/coffeescript where ()'s are mandatory for function calls without arguments
<davidcelis>
Industrial: welcome to a better world :)
macmartine has joined #ruby
<Industrial>
;)
EvanR has joined #ruby
icooba has quit [Quit: icooba]
<EvanR>
if i do raise 'foo', what kind of exception should i catch later?
<Industrial>
I kinda like the NodeJS evented world now though. Is Celluloid any good ;o?
wmoxam has joined #ruby
<davidcelis>
Industrial: One more suggestion; you might want to name the method `shuffle!` instead of shuffle, since it seems to be mutating the object instead of returning a new Shuffler with a shuffled list
kirun has joined #ruby
<EvanR>
Industrial: nodejs 'evented' world is really annoying to write synchronous code in (most IO code)
davidcelis has quit [Remote host closed the connection]
blacktulip has quit [Remote host closed the connection]
davidcelis has joined #ruby
o_proxeneta has quit [Remote host closed the connection]
hoelzro|away is now known as hoelzro
<_br_>
wmoxam: Did you ever use dm-redis-adapter with redis? Just asking because I have some weird behavior with it. Tought that you might have some opinion on this?
jfarmer has joined #ruby
kenneth has quit [Read error: Connection reset by peer]
kenneth has joined #ruby
Cpudan80 has joined #ruby
<jfarmer>
Anyone know of a Ruby SQL parser? Perhaps a Treetop grammar?
<Cpudan80>
Hello folks
<dev_>
someone mentioned pp recently
jjjj has joined #ruby
<dev_>
is that like pry?
jackiechan0 has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
No, pp is just to pretty print objects
<Mon_Ouie>
It's in stdlib
jackiechan00 has joined #ruby
<Cpudan80>
I'm pretty new to ruby so sorry if this is a newb question, I've got a ruby script that needs to do some JSON, the json.rb file requires iconv
<Sou|cutter>
awesome_print is cooler
<dev_>
yeah Mon that's what I thought..
<horseman>
Mon_Ouie wrote something even cooler than awesome_print but i forget what it's called, what was it monny?
<Cpudan80>
I have libiconv2.dll sitting alongside json.rb, so "include 'iconv'" should work I think -- but for some reason I get a file not found error when the script runs
<Cpudan80>
Saying that iconv can't be found
<apeiros_>
jfarmer: found one?
<jfarmer>
apeiros_: Did you?
<Cpudan80>
Do I need to do something to register that iconv2.dll ?
o_proxeneta has joined #ruby
kenneth has quit [Client Quit]
<apeiros_>
jfarmer: no, but I'm interested in having one for a side-project of mine
<jfarmer>
apeiros_: There are…half baked ones out there.
<jfarmer>
apeiros_: That cover maybe 10% of the SQL92 grammar
<apeiros_>
hrm
<Mon_Ouie>
colorful_inspect
<apeiros_>
problem with half-baked is, that I'm usually faster doing it on my own…
<horseman>
there we go :)
<apeiros_>
but isn't SQL a non-free standard?
<wmoxam>
_br_: nope
<Mon_Ouie>
(It just overrides #pretty_print method of some classes to add colors there; so it will benefit from the #pretty_print method if some library defines it)
harukomoto has joined #ruby
<jfarmer>
apeiros_: Dunno. It's an ISO standard.
<apeiros_>
jfarmer: I mean as in: have to pay to read the standard
<jfarmer>
apeiros_: No, not at all
genivf has joined #ruby
Ankhers has quit [Remote host closed the connection]
o_proxeneta has quit [Remote host closed the connection]
<horseman>
theRoUS: also, your first approach would raise an exception if debugger is not defined
emperorcezar has left #ruby [#ruby]
<horseman>
so it wasn't really viable without a rescue nil
<horseman>
which is stupid & evil
macmartine has quit [Quit: macmartine]
peterhil has joined #ruby
fayimora has joined #ruby
Morkel has joined #ruby
<bambanx>
evil , damn
<Alantas>
I thought the usual way was: Kernel.respond_to? :debugger
keppy has quit [Ping timeout: 246 seconds]
<Alantas>
(Checking for the quack, not the duck.)
<horseman>
Alantas: nah, respond_to? is for bound methods, method_defined? is for unbound (instance) methods
t0mmyvyo has joined #ruby
<Hanmac>
Alantas: not direcly ... normaly its Kernel.method_defined?(:debugger) ... or without Kernel.
workmad3 has quit [Ping timeout: 246 seconds]
<Alantas>
Hmm. Would 'debugger' be called as "debugger()" or "Kernel.debugger()"?
<horseman>
Alantas: debugger()
<Alantas>
respond_to? would check the latter, but if that's not what needs to be checked...
<theRoUS>
Alantas: that would search up through the inheritance.. come to think of it, so do the others. i think. not sure about #method_defined? of course, Kernel doesn't inherit from anything else..
workmad3_ has quit [Ping timeout: 252 seconds]
dhruvasagar has quit [Quit: Lost terminal]
<horseman>
Alantas: though both would work, actually
gfuggiano has joined #ruby
<horseman>
Alantas: since wait, no it wont
<Hanmac>
Kernel itself is an Module, with is an Object, with includes Kernel
test34- has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
<horseman>
ah good point
<horseman>
it would work
* apeiros_
smacks theRoUS for using .methods.include? instead of respond_to?
test34 has quit [Ping timeout: 250 seconds]
<horseman>
Yeah in this case respond_to? and method_defined? could both be used
<Tasser>
horseman, method_defined? got different semantics
<horseman>
but IMO method_defined? is nicer
<Tasser>
it's just as evil as .methods.include?
Codif has quit [Remote host closed the connection]
<horseman>
Tasser: has is that
<horseman>
how*
<Tasser>
horseman, because people using method_missing for metaprogramming include respond_to? but not method_defined?
<apeiros_>
method_defined? is for instance methods. respond_to? is for its own methods
JohnBat26 has joined #ruby
<Tasser>
oh, nice
<horseman>
Tasser: noob
<horseman>
:P
<apeiros_>
since method_missing is handled at object level, it's fine & correct if Foo.method_defined?(:bar) == false && Foo.new.respond_to?(:bar) == true
<Hanmac>
Tasser: do you heard about Kernel#respond_to_missing?
<apeiros_>
Hanmac: that won't help method_defined?
<bambanx>
hi Hanmac
Asher has joined #ruby
<Hanmac>
no, but respond_to_missing is the little sister of method_missing
AlRazi has quit [Remote host closed the connection]
test34 has joined #ruby
mucker has quit [Quit: leaving]
harukomoto has quit [Ping timeout: 256 seconds]
red-panda has quit [Remote host closed the connection]
test34- has quit [Ping timeout: 244 seconds]
Solnse has quit []
cj3kim has joined #ruby
alindeman has quit [Ping timeout: 240 seconds]
chomp has joined #ruby
jfarmer has quit [Quit: jfarmer]
cbuxton has quit [Quit: Leaving.]
looopy has joined #ruby
stephenjudkins has joined #ruby
fayimora has quit [Ping timeout: 264 seconds]
jrajav has joined #ruby
krusty_ar has quit [Read error: No route to host]
Huis has quit [Read error: Connection reset by peer]
* theRoUS
smarts appreciatively from apeiros_'s smack
cableray has quit [Quit: See you 'round like a donut.]
<Tasser>
horseman, I'd use respond_to? no matter what ;-)
<dEPy>
what should I raise when constructor parameters and not valid (too short names, number ranger not ok)
<theRoUS>
Alantas: because some of the things in the definition are lexically-scoped, and others aren't
<apeiros_>
dEPy: ArgumentError, TypeError or your own class, derived from one of these
zx has joined #ruby
azm has quit [Ping timeout: 245 seconds]
<dEPy>
should I always define my exceptions by deriving from existing ones? what's the downside of: raise "Something" ?
<theRoUS>
apeiros_: class_eval from looking at other code. please explain best practice?
<dEPy>
well for one you can't do exception translation easily
albemuth has joined #ruby
<apeiros_>
dEPy: raise "something" is short for raise RuntimeError, "something"
<Alantas>
theRoUS: Have Kernel#debugger accept an Exception argument.
<Alantas>
Then you can interpolate #{e.class.name} etc at runtime.
<apeiros_>
dEPy: also, since you only can raise classes inheriting from Exception, you're bound to inherit from an existing exception class ;-)
<dEPy>
will raising something else break/stop the running program?
<dEPy>
should I inherit from specific ones like in Java from RuntimeException?
<apeiros_>
theRoUS: two versions, a) store the exception to use it in the message or b) use module_eval with a block
<theRoUS>
Alantas: you're missing the point. the exception is why the normal #debugger method isn't available. it isn't an argument that varies throughout the app
<apeiros_>
(module_eval == class_eval)
azm has joined #ruby
<dEPy>
or does ruby not have checked exception?
<dEPy>
exceptions*
axl_ has quit [Read error: Connection reset by peer]
<apeiros_>
dEPy: an exception that is not rescued will stop your application, yes
Jackneill has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
<apeiros_>
dEPy: unless you're having the exception in a thread other than Thread.main and haven't Thread.abort_on_exception = true (which you should, really, if you have multi-threaded code, that is)
<theRoUS>
dEPy: i think inheriting from RuntimeError is discouraged. if there isn't a better choice, i think best practice is to inherit from StandardError
<dEPy>
oh, so Errors won't break/stop my app then?
<apeiros_>
RuntimeError is fine, but rarely a good fit. inheriting from Exception directly is bad.
<apeiros_>
StandardError is the default choice.
<Alantas>
If it's an error you can handle, and you do so, then it won't break or stop your program.
zx has quit [Ping timeout: 244 seconds]
<dEPy>
ok, got it
<dEPy>
tnx
petercs has quit [Ping timeout: 245 seconds]
<theRoUS>
apeiros_: are you having the same confusion Alantas apparently was? that the exception is variant at runtime? it isn't. it's the exception from trying to load ruby-debug.
nanderoo has quit [Quit: Leaving.]
<apeiros_>
theRoUS: no, I don't :) I'll paste
<theRoUS>
apeiros_: i doubted you would..
ctwiz has joined #ruby
<horseman>
Tasser: respond_to? and method_defined? aren't equivalent, for example to use respond_to? you have to first have an instance
zx has joined #ruby
<horseman>
Tasser: and creating an instance *just* to check for a method is stupid
jackiechan0 has quit [Ping timeout: 245 seconds]
<Alantas>
theRoUS: If it's a one-time thing, why are you incorporating it into your newly-defined #debugger rather than raising an exception (or printing a message) on the spot?
maletor has joined #ruby
<Tasser>
horseman, indeed, it's not that easy to extract stuff from your mental muscle memory ;-)
<Alantas>
With many languages that have it, and especially with Ruby, evaling a string typically means you don't know what you're doing.
CannedCo_ has quit [Quit: Computer has gone to sleep.]
<Alantas>
apeiros_'s last paste looks like it does the last thing I suggested, using a class constant. (Also, missing comma at end of line 16 and vestigial EOC on 25?)
jonathanwallace has quit [Ping timeout: 244 seconds]
<apeiros_>
right & right @ Alantas
<apeiros_>
but, but, but… it aligned!
<Hanmac>
apeiros_ ... didnt const_set may "raise" an warning?
<Alantas>
Yeah. I'll kill it and try something that won't print it.
trend has joined #ruby
<horseman>
Alantas: you can just do: x= 10**1000000; nil
* theRoUS
wrote an article a couple of decades ago about the correct way to copy code onto the stack and then execute it -- on VAX
<Alantas>
Yeah, that's what I'm doing now.
* apeiros_
donates a couple of ()-parens to theRoUS :-p
<Alantas>
And it finished. Heh.
<Tasser>
horseman, or 100**1000000; in pry ;-)
<theRoUS>
apeiros_: ?
<pk1001100011>
I just made: ruby -e 'puts 256**1000000' > bignum & and waited some time. ^^
<apeiros_>
theRoUS: so you don't run out of them. you seem to use them pretty judicious ;-)
<workmad3>
just trying to get ruby to print some big numbers?
<Alantas>
That should print 1000000*log(256)/log(10) digits, I think.
<pk1001100011>
Trying to know how much digits they can have. :P
<workmad3>
I wonder what Gregors Number would look like in ruby
<Alantas>
Which is 2408239.965. ceil() that, I guess.
<horseman>
workmad3: haha
<horseman>
workmad3: that's the number from combinatorics right?
petercs has quit [Ping timeout: 248 seconds]
<apeiros_>
Alantas: iirc floor+1
<theRoUS>
apeiros_: if you're poking fun at my practice of parenthesising expressions and method calls, go right ahead. i do the same thing in perl; i vastly prefer to be able to see what atoms are arguments, boolean expressions, LHS, and RHS
<pk1001100011>
Alantas: Yeah, seems to be like my result. :P
* theRoUS
muses on Mersenne primes
<Alantas>
floor(4) should be 4, ceil(4) should be 4, so one()±1 won't turn it into the other.
<pk1001100011>
When someone is weak in math then he needs to use stupid solutions, like me. -.-
<theRoUS>
Alantas, apeiros_: thanks for your critique and help
<horseman>
workmad3: unicode + method_missing and you can do some really nice stuff: 10.^^^^3 (where ^ would be replaced by a nice unicode arrow symbol)
<apeiros_>
theRoUS: yw
<theRoUS>
apeiros_++
<Alantas>
10.↑3
<Alantas>
10.³
<apeiros_>
krezytalk
<apeiros_>
:)
<Alantas>
√(2)
<workmad3>
we need more unicode method aliases :)
<apeiros_>
union/intersection?
jrajav has quit [Read error: Connection reset by peer]
nirakara has quit [Ping timeout: 252 seconds]
<workmad3>
well, for starters, we rewrite all methods that have _ to use a non-breaking space instead :)
fserb has joined #ruby
<Alantas>
Heh, I could totally rock that with my keyboard layout.
dross_ is now known as dross
<shevy>
workmad3 you wanna steal my _
<Alantas>
Be hard to see, though.
cbuxton has joined #ruby
<shevy>
_ is the king among the characters
<Alantas>
puts "Unicode up in here" if log₂(10) ≈ 3.321928
<workmad3>
shevy: but with a nbsp, you can have method calls like "my variable.this totally rocks!" :)
<theRoUS>
i noticed something on the greaseboards of big bang theory.. something like " q = i² + √1 "
<horseman>
workmad3: the idea of operators both above power-of and below addition, i wonder if it's possible to extend the 3rd argument to non-natural naturals, like fractional or negative
<horseman>
natural numbers*
jrajav has joined #ruby
cdempsey has quit [Quit: Quitting!]
<horseman>
"Ackermann's three-argument function, is defined such that for p = 0, 1, 2, it reproduces the basic operations of addition, multiplication, and exponentiation"
JohnBat26 has quit [Ping timeout: 246 seconds]
fserb has quit [Client Quit]
<horseman>
workmad3: are you familiar with the gamma function
<workmad3>
horseman: well, I'm sure you could, it's just whether you can do so in a way that keeps it consistent :)
francisfish has joined #ruby
sspiff has quit [Ping timeout: 252 seconds]
<horseman>
workmad3: Yeah, i was just going to say the gamma function is an extension of the factorial to complex numbers
<horseman>
so you can do stuff like: 0.5! (0.5 factorial) or even i! (factorial of imaginary number)
<horseman>
so i'm sure it's possible to do something analogous for ackerman
<workmad3>
the hardest thing with that sort of extension is finding a method that makes sense, from my knowledge
fayimora has joined #ruby
elake is now known as etank
jchauncey has joined #ruby
<workmad3>
things like complex logarithms, or real (and complex) exponents... figuring out a way for such things to make sense is half the battle :)
<Alantas>
Ruby has a Complex class in its library somewhere.
<Alantas>
I've never found a use for them, myself, so I haven't really bothered to learn about them.
<workmad3>
they have uses if you're doing maths or physics simulation stuff
<workmad3>
same with things like Matrix and Vector classes
* Alantas
nods.
jgarvey has joined #ruby
digitalcakestudi has quit [Ping timeout: 240 seconds]
francisfish has quit [Remote host closed the connection]
test34- has joined #ruby
ronniy has quit [Remote host closed the connection]
Urthwhyte is now known as Urth|Away
tomb__ has joined #ruby
geekbri has quit [Remote host closed the connection]
vjt has quit [Ping timeout: 272 seconds]
<Cpudan80>
Hello folks
test34 has quit [Ping timeout: 249 seconds]
<Cpudan80>
So I fixed my problem from earlier, but now I'm noticing that sometimes the JSON that is produced is not valid
<Tasser>
workmad3, with ruby? depends on how much you want to simulate...
<Cpudan80>
like its got an extra " or something, does anyone know if this is ehh ... common?
<Cpudan80>
not 100% sure how that's getting there...
<apeiros_>
and how did you generate that output?
davidw is now known as Guest94169
<Cpudan80>
params = attribDict.to_hash.to_json
<Cpudan80>
puts params
Solnse has joined #ruby
test34- has quit [Ping timeout: 240 seconds]
<Cpudan80>
I suppose it's possible that the person who's making the dict is doing it wrong
Urth|Away is now known as Urthwhyte
test34- has joined #ruby
<Cpudan80>
seems somewhat unlikely given how trivial that data is... but... I'll check
jackiechan0 has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
LtHummus has quit [Quit: leaving]
mneorr_ has quit [Remote host closed the connection]
test34 has quit [Ping timeout: 244 seconds]
bbttxu has joined #ruby
mneorr has joined #ruby
dv310p3r has joined #ruby
<apeiros_>
Cpudan80: the to_json comes from the stdlib 'json' lib? if so, a possibility to make it work incorrectly would be to override the to_json on any of those elements
<Cpudan80>
yeah, nobody overrides to_json
ctwiz has quit [Quit: ctwiz]
tewecske has quit [Read error: Connection timed out]
daniel_hinojosa has joined #ruby
tatsuya_o has joined #ruby
<davidcelis>
sure they do
<davidcelis>
i've overridden to_json
<davidcelis>
quite presumptuous of you, sir
fserb has joined #ruby
tuxaddicted has joined #ruby
mneorr has quit [Ping timeout: 260 seconds]
tuxaddicted has quit [Client Quit]
bambanx_ has joined #ruby
davidpk has quit [Quit: Computer has gone to sleep.]
<shevy>
dEPy you mean @first and @last ? instance variables?
<dEPy>
is there any best practice how to validate they are long enough, short enought, ...
<dEPy>
instance variables yes
<heftig>
('a'..'z').to_a.sample(4).join
<dEPy>
like rails has validates_lenght.of ...
<shevy>
yeah, the word attribute was strange. if you use the word instance variables,
ben_alman has joined #ruby
<shevy>
well, rails is using methods to ensure the validity of that
hamfz_ has quit [Ping timeout: 252 seconds]
<shevy>
there is really nothing rails does that you cant do in ruby on your own
<dEPy>
so i just write my own then
amalvagomes has quit [Quit: amalvagomes]
<shevy>
and btw length and not lenght eh? :D
<dEPy>
I just thought some of those were core functionality maybe :)
<shevy>
hmm dont think so
sayem has joined #ruby
<dEPy>
k :) tnx
<shevy>
they would have to be general-purpose enough to warrant to be in core
jgrevich has quit [Read error: Connection reset by peer]
ciopte7 has joined #ruby
jgrevich has joined #ruby
carloslopes has quit [Quit: Leaving]
tvw has quit [Remote host closed the connection]
hakunin has quit [Read error: Connection reset by peer]
kevinbond has joined #ruby
MasterIdler_ has joined #ruby
andrewjf has quit [Ping timeout: 252 seconds]
davidpk has joined #ruby
banseljaj is now known as imami|afk
andrewjf has joined #ruby
MasterIdler_ has quit [Client Quit]
mneorr has joined #ruby
Araxia_ has quit [Read error: No route to host]
Araxia_ has joined #ruby
beneggett has quit [Quit: Computer has gone to sleep.]
zx has quit [Ping timeout: 246 seconds]
MasterIdler has quit [Ping timeout: 260 seconds]
zodiak has quit [Remote host closed the connection]
kevinbond has quit [Client Quit]
bambanx has joined #ruby
Gavilan has joined #ruby
krusty_ar has quit [Read error: Connection reset by peer]
theRoUS has quit [Quit: Leaving]
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
ramblex has quit [Quit: ramblex]
gfuggiano has joined #ruby
Urth|Away is now known as Urthwhyte
kevinbond has joined #ruby
Urthwhyte is now known as Urth|Away
theRoUS has quit [Client Quit]
theRoUS has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
Huis has quit [Quit: Huis]
antillas21 has quit [Remote host closed the connection]
fbernier has quit [Ping timeout: 246 seconds]
Aaton is now known as Aaton_off
<bambanx>
what is the best kick ass awesome ruby debugger?
Progster has joined #ruby
dev_ has quit [Ping timeout: 246 seconds]
dv310p3r has quit [Ping timeout: 246 seconds]
libertyprime has quit [Quit: Lost terminal]
internet_user has quit [Remote host closed the connection]
rasbonics has joined #ruby
Norrin has joined #ruby
hynkle has quit [Quit: hynkle]
gfuggiano has quit [Quit: Sto andando via]
dv310p3r has joined #ruby
cj3kim has quit [Quit: This computer has gone to sleep]
dr_bob has quit [Read error: Connection reset by peer]
<zaargy>
pp, puts etc
tcopp has left #ruby [#ruby]
Norrin_ has quit [Ping timeout: 244 seconds]
<bambanx>
how is that zaargy ? using pry?
kevinbond has quit [Quit: kevinbond]
davidpk has quit [Ping timeout: 246 seconds]
libertyprime has joined #ruby
Guest94169 is now known as davidw
davidw has quit [Changing host]
davidw has joined #ruby
Aristata has joined #ruby
baroquebobcat has joined #ruby
libertyprime has quit [Client Quit]
<Aristata>
If I have an array that looks like this [generate_new_array_method] where generate new arrray returns an array, is there something I can call INSIDE: like [generate_new_array_method.expand] that will insert it into the array? I can't use flatten
libertyprime has joined #ruby
jenrzzz-mac has quit [Quit: jenrzzz-mac]
<burgestrand>
Aristata: you could splat it, [*generate_new_array_method]
Asher has quit [Read error: Connection reset by peer]
<Aristata>
ahh good call
<Aristata>
thank you
mneorr has quit [Remote host closed the connection]
Asher has joined #ruby
<burgestrand>
Aristata: would probably be better to just concatenate it if possible
<fubada>
anyone use supervisord + resque? or any rake task?
<dEPy>
alegacyreborn then 99% of developers do feature driven development i guess :D
davidw has quit [Read error: Operation timed out]
<shevy>
TTilus ok will check out textile
<alegacyreborn>
lol
<alegacyreborn>
So true
g0bl1n has joined #ruby
g0bl1n has quit [Changing host]
g0bl1n has joined #ruby
zemanel has quit [Quit: Remote hottie closed the connection]
zemanel has joined #ruby
zeromodulus has joined #ruby
jrallison has quit [Quit: Computer has gone to sleep.]
jrallison has joined #ruby
ciopte7 has quit [Read error: Connection reset by peer]
ciopte7_ has joined #ruby
<alegacyreborn>
So many people join but few ever talk
<alegacyreborn>
?o.O they are spying on us
ctwiz has quit [Quit: ctwiz]
hadees has quit [Quit: hadees]
fualo has quit [Quit: Lost terminal]
<alegacyreborn>
Oh snap they are leaving because I found our their dirty little secret
blacktulip has quit [Remote host closed the connection]
<davidcelis>
wut
baba_bubba has joined #ruby
raul782 has joined #ruby
raul782 has quit [Remote host closed the connection]
amalvagomes has joined #ruby
celm has joined #ruby
celm has quit [Client Quit]
CombatWombat is now known as Spaceghostc2c
<alegacyreborn>
You know I'm right
Axsuul has quit [Ping timeout: 252 seconds]
<alegacyreborn>
Does anyone else use AptanaStudio as their IDE?
<shevy>
alegacyreborn they idle to power here
GhettoCode has quit [Ping timeout: 244 seconds]
<shevy>
I think I tried aptana studio once
<shevy>
not sure why I stopped it, there was something I hated
<alegacyreborn>
I am trying to find the right one but I don't mind using just text editors
<davidcelis>
vim
<alegacyreborn>
Is that only for Rails?
<shevy>
vim is a general purpose text editor, it tends to be usually used in consoles only though
<alegacyreborn>
Ah
<shevy>
you use ruby only because of rails? :(
MasterIdler_ has joined #ruby
MasterIdler_ has quit [Client Quit]
<alegacyreborn>
I use TextMate on my Mac and Notepad ++ on my Windows comp
<alegacyreborn>
no
<shevy>
textmate seems nice
<alegacyreborn>
I was making sure it wasn't only for rails
<havenn>
I like TextMate 2, Sublime Text 2, and Chocolate.
<havenn>
Or MacVim =P
<alegacyreborn>
I am actually learning Ruby and then I will work on RoR but I just want to focus on Ruby for now
<alegacyreborn>
Some people suggested that I learn Rails first but that just doesn't make sense
<shevy>
hehe
<bricker88>
Can someone explain to me how "initialize" is different from "new"? I get that when you call "new", "initialize" actually gets run… is "new" just a wrapper for "initialize" that makes the initialized object return itself?
MasterIdler has quit [Read error: Operation timed out]
fayimora_ has joined #ruby
Axsuul has joined #ruby
<shevy>
bricker88 I think new not only invokes initialize... but also allocate or something
<havenn>
bricker88: ThisClass.new is a new instance of the class ThisClass, so if you defined #new to initialize it would be ThisClass.new.new, which seems unseemly.
mrck has quit [Remote host closed the connection]
mrck has joined #ruby
apeiros_ has quit [Ping timeout: 256 seconds]
NodoLomas has left #ruby [#ruby]
C0deMaver1ck has quit [Remote host closed the connection]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
<bricker88>
havenn: I see
fudanchii has quit [Quit: WeeChat 0.3.8-rc2]
tomb__ has joined #ruby
booginga has quit [Quit: Leaving]
<bricker88>
While I'm here… When you see something like ::Base64.strict_encode… is the "missing" class at the beginning assumed to be the current class?
<workmad3>
bricker88, no
<bricker88>
I figured that was way off
<heftig>
no, it's the top namespace
<workmad3>
bricker88, it's the opposite... it refers to the global scope for constant lookup
<bricker88>
I see - So it really is just "nothing"
<heftig>
it's like starting a path with /
<bricker88>
right
pen has joined #ruby
<bricker88>
thank you
<workmad3>
bricker88, 'root' is better
<bricker88>
yes
niklasb has quit [Ping timeout: 252 seconds]
pen has quit [Remote host closed the connection]
<bricker88>
okay one last noob question:If a class inherits from another, but the child class has no "initialize" method, will it uses its parent class's?
<heftig>
yes.
<bricker88>
rad
<heftig>
it's inherited like any other method
<bricker88>
I figured that was the case. Thank you.
billiamii|work has quit []
carlyle has joined #ruby
ciopte7 has joined #ruby
WikiPack has joined #ruby
tomb__ has quit [Quit: Computer has gone to sleep.]
xaq has quit [Remote host closed the connection]
dnyy has quit [Remote host closed the connection]
mrsolo has left #ruby ["Leaving"]
test34 has joined #ruby
uris_ has quit [Quit: leaving]
test34 has quit [Changing host]
test34 has joined #ruby
dnyy has joined #ruby
keppy has joined #ruby
test34- has quit [Ping timeout: 250 seconds]
kenichi has quit [Remote host closed the connection]
awarner has quit [Remote host closed the connection]
keithcelt has quit [Remote host closed the connection]
cableray has joined #ruby
mdhopkins has joined #ruby
xnm has quit [Disconnected by services]
C0deMaver1ck has joined #ruby
plasticover has joined #ruby
rmascarenhas has joined #ruby
rasbonics has quit [Quit: rasbonics]
workmad3 has quit [Ping timeout: 246 seconds]
Axsuul has joined #ruby
dv310p3r has quit [Ping timeout: 246 seconds]
nlc has joined #ruby
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby
td123 has joined #ruby
mvangala_mac has joined #ruby
dv310p3r has joined #ruby
jenrzzz-mac has joined #ruby
jrallison has quit [Quit: Computer has gone to sleep.]
jenrzzz-mac has quit [Client Quit]
jimeh has joined #ruby
blazed has quit []
ken_barber1 has quit [Remote host closed the connection]
binaryplease has quit [Ping timeout: 245 seconds]
hero has quit [Quit: leaving]
akem has quit [Read error: Connection reset by peer]
pdtpatrick has quit [Quit: pdtpatrick]
binaryplease has joined #ruby
<dekz>
Within pry, in the screen cast when showing doc or rendering some information it looks like it is shown in something similar to 'less'. Whereas when I run it I get something more primitive where you can only press enter to continue and q<enter> to break. How do I get the other display?