<bnagy>
because the first curly is a literal curly, not an 'interpolate this' for the interpreter
<Gatling>
I mean how can I do somthing like string formatting, but using global context, like compiler does... I don't want to populate map and pass it in String#%
<Gatling>
I have variable of class String, which holds some string with placeholders... i need to use this as a format, and substitute placeholders with values from context variables
<bnagy>
gsub or look at one of the templating engines
rh1n0 has quit [Quit: Hopefully you don't see this...]
yubrew has joined #ruby-lang
yubrew has quit [Ping timeout: 268 seconds]
jason___ has quit [Remote host closed the connection]
guns has quit [Quit: guns]
jason___ has joined #ruby-lang
ryez has joined #ruby-lang
jason___ has quit [Ping timeout: 240 seconds]
Cakey has joined #ruby-lang
ianm_ has quit [Ping timeout: 240 seconds]
nathanstitt has quit [Quit: I growing sleepy]
mr-foobar has joined #ruby-lang
ianm_ has joined #ruby-lang
ianm_ has left #ruby-lang [#ruby-lang]
epitron has quit [Remote host closed the connection]
nisstyre_ has quit [Quit: WeeChat 0.4.3]
epitron has joined #ruby-lang
nisstyre has quit [Remote host closed the connection]
woollyams has quit [Ping timeout: 252 seconds]
ledestin has quit [Ping timeout: 252 seconds]
Coincidental has joined #ruby-lang
agrinb has joined #ruby-lang
michaeldeol has joined #ruby-lang
creede has quit [Ping timeout: 264 seconds]
Voker57 has quit [Read error: Connection reset by peer]
agrinb has quit [Ping timeout: 240 seconds]
woollyams has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
yubrew has joined #ruby-lang
yubrew has quit [Ping timeout: 246 seconds]
mykoweb has joined #ruby-lang
marcdel has joined #ruby-lang
jsutt has quit [Ping timeout: 268 seconds]
woollyams has quit [Read error: Connection reset by peer]
rahul_j has joined #ruby-lang
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
marcdel has quit [Ping timeout: 240 seconds]
creede has joined #ruby-lang
marcdel has joined #ruby-lang
r0bby is now known as robbyoconnor
ur5us has quit [Remote host closed the connection]
|jemc| has quit [Quit: WeeChat 0.4.3]
woollyams has joined #ruby-lang
gix has quit [Ping timeout: 246 seconds]
gix has joined #ruby-lang
creede has quit [Ping timeout: 268 seconds]
woollyams has quit [Read error: Connection reset by peer]
bahar has quit [Ping timeout: 264 seconds]
yfeldblu_ has joined #ruby-lang
woollyams has joined #ruby-lang
yfeldblum has quit [Read error: Connection reset by peer]
bahar has joined #ruby-lang
willmarshall has quit [Ping timeout: 268 seconds]
jsutt has joined #ruby-lang
vlad_starkov has joined #ruby-lang
fragamus has joined #ruby-lang
mdub has joined #ruby-lang
woollyams has quit [Read error: Connection reset by peer]
saarinen has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
vlad_starkov has quit [Remote host closed the connection]
willmarshall has joined #ruby-lang
mistym has joined #ruby-lang
jsutt has quit [Ping timeout: 240 seconds]
marcdel has quit []
sdouglas has quit [Remote host closed the connection]
sdouglas has joined #ruby-lang
Coincidental has quit [Remote host closed the connection]
yubrew has joined #ruby-lang
sdouglas_ has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
Coincidental has joined #ruby-lang
creede has joined #ruby-lang
sdouglas has quit [Ping timeout: 265 seconds]
araujo has quit [Quit: Leaving]
yubrew has quit [Ping timeout: 240 seconds]
Coincidental has quit [Remote host closed the connection]
nisstyre has joined #ruby-lang
Coincidental has joined #ruby-lang
_ht has joined #ruby-lang
marcdel has joined #ruby-lang
fezziwig has joined #ruby-lang
phansch has joined #ruby-lang
Lewix has joined #ruby-lang
vlad_starkov has joined #ruby-lang
knu has quit [Ping timeout: 252 seconds]
vlad_starkov has quit [Remote host closed the connection]
mehlah has joined #ruby-lang
knu has joined #ruby-lang
fezziwig has quit [Remote host closed the connection]
fezziwig has joined #ruby-lang
Cakey has quit [Ping timeout: 240 seconds]
hahuang65 has joined #ruby-lang
kro__ is now known as kro_
jackhammer2022 has quit [Quit: Computer has gone to sleep.]
Cakey has joined #ruby-lang
fezziwig has quit [Ping timeout: 240 seconds]
phansch has quit [Quit: WeeChat 0.4.2]
LMity has joined #ruby-lang
sdouglas_ has quit [Remote host closed the connection]
saarinen has quit [Quit: saarinen]
marcdel has quit []
dgaffney has quit [Remote host closed the connection]
dgaffney has joined #ruby-lang
knu has quit [Ping timeout: 252 seconds]
agrinb has joined #ruby-lang
rahul_j has joined #ruby-lang
amclain_ has quit [Quit: Leaving]
vlad_starkov has joined #ruby-lang
dgaffney has quit [Ping timeout: 264 seconds]
knu has joined #ruby-lang
agrinb has quit [Ping timeout: 252 seconds]
toretore has joined #ruby-lang
renzhi has joined #ruby-lang
Coincidental has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 240 seconds]
Cakey has quit [Ping timeout: 246 seconds]
knu has quit [Ping timeout: 252 seconds]
robbyoconnor has quit [Excess Flood]
LMity has quit [Ping timeout: 246 seconds]
robbyoconnor has joined #ruby-lang
robbyoconnor has quit [Client Quit]
<renzhi>
hi, this might now be a pure ruby question, but I can't find any response, so I'll just ask here. I use the Net::HTTP client to upload a file with PUT, but the server detects a certain header is not properly, it just sends back a response (error information in the response body) and disconnect. Using http client in any other language, I can receive the response correctly, but the ruby client just detects a connection reset, and no response.
<renzhi>
is there a way to read the response?
mykoweb has quit [Remote host closed the connection]
Barrin6 has quit [Quit: Leaving]
Lewix has quit [Remote host closed the connection]
<renzhi>
centrx: I don't get a chance to that, when calling http.request(req), it already throws the error
<renzhi>
/usr/lib/ruby/1.9.1/net/protocol.rb:199:in `write': Connection reset by peer (Errno::ECONNRESET)
<centrx>
hmm
<renzhi>
I'm pretty ignorant on ruby, I'm using to write an automated test script for a project.
<centrx>
Maybe there is something in the exception you can use?
<centrx>
I am not so familiar with the Net::HTTP
<centrx>
I would recommend using OpenURI
<centrx>
That is in the standard library
<centrx>
not sure if it meets your needs
knu has quit [Ping timeout: 252 seconds]
<renzhi>
Using any other http client (or in another language), I got {"status":401,"code":"Unauthorized","message":"Invalid token"}, but with ruby Net::HTTP library, I don't seem to have a chance to read the response body.
<centrx>
Try #ruby there are more people in there right now
<centrx>
Also look through the Net::HTTP docs, they are pretty good
knu has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
<renzhi>
centrx: thanks, I'll probably need to dig further in Net::HTTP code to see how it handles it
rahul_j has joined #ruby-lang
bahar has quit [Ping timeout: 264 seconds]
Cakey has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
wallerdev has joined #ruby-lang
bahar has joined #ruby-lang
skade has joined #ruby-lang
tonni_ has quit [Remote host closed the connection]
x0f has joined #ruby-lang
x0f_ has quit [Ping timeout: 240 seconds]
rahul_j has quit [Quit: rahul_j]
heftig has quit [Quit: Quitting]
mistym has quit [Remote host closed the connection]
robbyoconnor has joined #ruby-lang
mr-foobar has joined #ruby-lang
rahul_j has joined #ruby-lang
bahar has quit [Ping timeout: 264 seconds]
ur5us has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
nisstyre has quit [Quit: WeeChat 0.4.3]
arubin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
skammer_ has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
bahar has joined #ruby-lang
tonni has joined #ruby-lang
phansch has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
nibbo has quit [Read error: Operation timed out]
[spoiler] has joined #ruby-lang
knu has quit [Ping timeout: 252 seconds]
Mon_Ouie has joined #ruby-lang
yubrew has joined #ruby-lang
nibbo has joined #ruby-lang
knu has joined #ruby-lang
apeiros has quit [Ping timeout: 240 seconds]
relix has joined #ruby-lang
yubrew has quit [Ping timeout: 240 seconds]
tectonic has quit []
bahar has quit [Ping timeout: 240 seconds]
Mon_Ouie has quit [Ping timeout: 264 seconds]
bahar has joined #ruby-lang
sdouglas has joined #ruby-lang
eugmill_ has joined #ruby-lang
alexju_ has joined #ruby-lang
dc5ala has joined #ruby-lang
hakunin_ has joined #ruby-lang
knu has quit [Ping timeout: 252 seconds]
knu has joined #ruby-lang
mehlah_ has joined #ruby-lang
hackeron_ has joined #ruby-lang
pabs__ has quit [Ping timeout: 268 seconds]
msch has joined #ruby-lang
drbrain has quit [Ping timeout: 240 seconds]
eugmill has quit [Ping timeout: 240 seconds]
Veejay has quit [Ping timeout: 240 seconds]
hackeron has quit [Ping timeout: 240 seconds]
mehlah has quit [Ping timeout: 240 seconds]
alexju has quit [Ping timeout: 268 seconds]
robbyoconnor has quit [Ping timeout: 240 seconds]
r0bby has joined #ruby-lang
r0bby has quit [Changing host]
r0bby has joined #ruby-lang
r0bby has quit [Client Quit]
hakunin has quit [Ping timeout: 268 seconds]
Veejay has joined #ruby-lang
pabs has joined #ruby-lang
drbrain has joined #ruby-lang
tonni has quit [Ping timeout: 240 seconds]
nisstyre has joined #ruby-lang
robbyoconnor has joined #ruby-lang
tonni has joined #ruby-lang
mdub has quit [Ping timeout: 252 seconds]
dagobah has joined #ruby-lang
nisstyre has quit [Quit: WeeChat 0.4.3]
sdouglas has quit [Remote host closed the connection]
tonni has quit [Ping timeout: 240 seconds]
sdouglas has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
knu has quit [Ping timeout: 252 seconds]
knu has joined #ruby-lang
bahar has quit [Ping timeout: 264 seconds]
rahul_j_ has joined #ruby-lang
rahul_j has quit [Ping timeout: 264 seconds]
rahul_j_ is now known as rahul_j
bahar has joined #ruby-lang
vlad_starkov has joined #ruby-lang
hahuang65 has quit [Ping timeout: 246 seconds]
vlad_starkov has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
tonni has joined #ruby-lang
<ddfreyne>
yorickpeterse: oga looks cool!
<ddfreyne>
yorickpeterse: Interesting commit and nice analysis too :)
<ddfreyne>
How ready is it?
<ddfreyne>
yorickpeterse: I'm super interested in using it.
knu has quit [Ping timeout: 264 seconds]
mehlah_ has quit [Quit: Leaving...]
yubrew has joined #ruby-lang
yann_ck has joined #ruby-lang
yubrew has quit [Ping timeout: 252 seconds]
elliotec has joined #ruby-lang
apeiros has joined #ruby-lang
bahar has quit [Ping timeout: 240 seconds]
agrinb has joined #ruby-lang
Jeticus has quit []
bahar has joined #ruby-lang
tbuehlmann has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
rahul_j has joined #ruby-lang
tbuehlmann has quit [Client Quit]
yann_ck has quit [Ping timeout: 246 seconds]
agrinb has quit [Ping timeout: 264 seconds]
yann_ck has joined #ruby-lang
fowl has left #ruby-lang ["bye faggots"]
tonni has quit [Remote host closed the connection]
sdouglas has quit [Remote host closed the connection]
elliotec_ has joined #ruby-lang
tbuehlmann has joined #ruby-lang
elliotec has quit [Ping timeout: 265 seconds]
vondruch has joined #ruby-lang
dragonkh has quit [Quit: Bye!]
jhass|off is now known as jhass
Cakey has quit [Ping timeout: 252 seconds]
elliotec_ has quit [Remote host closed the connection]
bahar has quit [Ping timeout: 252 seconds]
elliotec has joined #ruby-lang
bahar has joined #ruby-lang
centrx has quit [Quit: All this computer hacking is making me thirsty]
elliotec has quit [Ping timeout: 246 seconds]
tonni has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
rahul_j has joined #ruby-lang
fragamus has quit [Quit: Computer has gone to sleep.]
mechan1c has joined #ruby-lang
bahar has quit [Ping timeout: 252 seconds]
michd is now known as MichD
bahar has joined #ruby-lang
mbj has joined #ruby-lang
mechan1c_ has quit [Ping timeout: 240 seconds]
<yorickpeterse>
morning
<yorickpeterse>
ddfreyne: re: ready, not yet at all
mehlah has joined #ruby-lang
<yorickpeterse>
currently it's just a lexer and AST parser
mikecmpbll has joined #ruby-lang
woollyams has joined #ruby-lang
alexju_ has quit [Remote host closed the connection]
solars has joined #ruby-lang
retro|cz has joined #ruby-lang
carraroj has joined #ruby-lang
jsrn has joined #ruby-lang
workmad3 has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
dilated_dinosaur has joined #ruby-lang
elliotec has joined #ruby-lang
elia has joined #ruby-lang
mr-foobar has quit [Remote host closed the connection]
<yorickpeterse>
ddfreyne: hopefully I can have a somewhat usable Gem late April
bahar has joined #ruby-lang
<yorickpeterse>
I'll begin working on the DOM API this week
heftig has joined #ruby-lang
ur5us has joined #ruby-lang
benlovell has joined #ruby-lang
Ca11yWally has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
wallerdev has quit [Quit: wallerdev]
phansch has quit [Quit: WeeChat 0.4.2]
<yorickpeterse>
I should probably set up a Doge coin donation button
sdouglas has joined #ruby-lang
robmiller has joined #ruby-lang
robmiller1 has joined #ruby-lang
robmiller has quit [Read error: Connection reset by peer]
sdouglas has quit [Ping timeout: 265 seconds]
DouweM has joined #ruby-lang
jds has joined #ruby-lang
victorbjelkholm has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
yubrew has joined #ruby-lang
m0s has joined #ruby-lang
skade has joined #ruby-lang
yubrew has quit [Ping timeout: 265 seconds]
Pupeno has joined #ruby-lang
knu has joined #ruby-lang
mr-foobar has joined #ruby-lang
jsutt has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
mbj has left #ruby-lang [#ruby-lang]
arBmind1 has quit [Quit: Leaving.]
ruby_newb has joined #ruby-lang
<ruby_newb>
hello, are there ways to dump singleton with Marshal?
jsutt has quit [Ping timeout: 240 seconds]
<ruby_newb>
currently when i'm trying to dump my object i'm getting "TypeError: singleton can't be dumped"
Mon_Ouie has joined #ruby-lang
<yorickpeterse>
ruby_newb: probably not
skade has joined #ruby-lang
<ruby_newb>
:(
<jhass>
why do you want to? do you have to dump it using marshal? what about writing to_/from_json methods or things like that?
agrinb has joined #ruby-lang
yfeldblu_ has quit [Remote host closed the connection]
<ruby_newb>
jhass: for mocking/testing purposes. I'm using library which makes HTTP request and resturns singleton object so i want to dump that object and stub gem's remote method with my own which will return that dumped object
<jhass>
just record an expect answer your library should parse (or two or three) and save them as fixtures
<ruby_newb>
jhass: that's what i'm trying to do - saving expected answer into fixtures as marshalled object
<jhass>
oh, you try to save a ruby object you do not own as fixture. Okay don't do that. Pass your library doubles instead that behave the same way as that object
agrinb has quit [Ping timeout: 240 seconds]
devgiant has joined #ruby-lang
<jhass>
or use something like webmock to actually use the http response as fixture, though you might end up testing the library you depend upon with that
<ruby_newb>
jhass: why not dumping ruby objects as fixtures?
<jhass>
there's no benefit
<jhass>
if the API of the object you dump changes you have to adapt it anyway so you can use doubles straight away
<yorickpeterse>
ruby_newb: you should not use Marhsal for that crap
<yorickpeterse>
In fact, you probably should not use Marshal unless you know what you're doing
<yorickpeterse>
if you start dumping Ruby objects you'll end up with a crapton of fixture files clogging your repositories
<whitequark>
ruby_newb: answering your original question: no, dumping objects with singleton classes is impossible.
<yorickpeterse>
In particular Marshal is not really compact unless you compress it
<whitequark>
(also, dumping lambdas)
<yorickpeterse>
Even then it's pretty bloated
<ruby_newb>
got it, thanks guys!
phansch has joined #ruby-lang
arBmind has joined #ruby-lang
phansch has quit [Client Quit]
cout_ is now known as cout
sdouglas has joined #ruby-lang
yubrew has joined #ruby-lang
sdouglas has quit [Ping timeout: 240 seconds]
yubrew has quit [Ping timeout: 240 seconds]
yfeldblum has joined #ruby-lang
cored has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
Speed has joined #ruby-lang
cored_ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 252 seconds]
rahul_j has joined #ruby-lang
ruby_newb has quit [Quit: leaving]
vlad_starkov has quit [Remote host closed the connection]
skade has quit [Quit: Computer has gone to sleep.]
pabloh has joined #ruby-lang
LMity has joined #ruby-lang
tkuchiki has joined #ruby-lang
skade has joined #ruby-lang
benlovell has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
momomomomo has joined #ruby-lang
yubrew has joined #ruby-lang
jsutt has joined #ruby-lang
yubrew has quit [Ping timeout: 268 seconds]
diegoviola has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kitak has quit [Remote host closed the connection]
jsutt has quit [Ping timeout: 246 seconds]
jgpawletko has joined #ruby-lang
luiz_lha has quit [Remote host closed the connection]
luiz_lha has joined #ruby-lang
LMity has quit [Ping timeout: 268 seconds]
yfeldblum has joined #ruby-lang
eugmill has joined #ruby-lang
cored_ has quit [Remote host closed the connection]
cored has quit [Remote host closed the connection]
arubin has joined #ruby-lang
cored has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
rofel has joined #ruby-lang
yfeldblum has quit [Ping timeout: 268 seconds]
eugmill has quit [Quit: Leaving...]
miqui has joined #ruby-lang
carraroj has quit [Remote host closed the connection]
pabloh has quit [Remote host closed the connection]
alekst has joined #ruby-lang
vpretzel has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
thmzlt has quit []
rahul_j has joined #ruby-lang
cnivolle has joined #ruby-lang
fusillicode has joined #ruby-lang
<fusillicode>
:)
<fusillicode>
hi guys :)
<yorickpeterse>
( ¯3¯)
<fusillicode>
:3
fusillicode has left #ruby-lang [#ruby-lang]
elia has quit [Quit: Computer has gone to sleep.]
achal has joined #ruby-lang
<benlovell>
doge funding
<benlovell>
kickdoge
<yorickpeterse>
do you check my fucking Twitter live or what?
<benlovell>
I am your twitter
<yorickpeterse>
Dogestarter
<benlovell>
twisted dogestarter
RoxasShadowRS has joined #ruby-lang
<benlovell>
how's oga
<yorickpeterse>
The other day I was thinking of doing motherfuckingstartup.com
<benlovell>
heh
<yorickpeterse>
Coming along nicely, starting on the DOM API this week
enebo has joined #ruby-lang
<benlovell>
cool, this work will save many lives
<benlovell>
I for one will tip you doge
<yorickpeterse>
I'm amazed how very few people openly complain about Nokogiri (that I know of)
<yorickpeterse>
I'm also amazed by how it apparently "works" on MRI
<benlovell>
because the maintainer is just the best guy
<benlovell>
guy(s)
elia has joined #ruby-lang
<yorickpeterse>
Well yeah, Tender & friends are good people
<yorickpeterse>
I see Nokogiri as a monster gone rogue
<yorickpeterse>
not the work of a sadist
<benlovell>
minswan which means matz is nice so we suffer shit if the maintainer is a nice guy/gal
<benlovell>
but anyway, oss etc
<yorickpeterse>
also have some ideas on making it possible parse omg-scale input, but I'll have to experiment with that
<benlovell>
pff, not zomg-scale, not interested
<benlovell>
:)
<yorickpeterse>
well yeah, I'm not doing this in Node
<benlovell>
heh
<benlovell>
so rubyc still seems to be going down
<yorickpeterse>
I withdrew my proposal
<benlovell>
withdraw the troops
<yorickpeterse>
tl;dr no response for two weeks after I had some questions, next Email is "So we checked and Rubinius is not in trend lately. Could you perhaps do it about [literally 20 buzzwords]?"
<benlovell>
'not in trend' such lol.
yubrew has joined #ruby-lang
<yorickpeterse>
I can't blame the person themselves because they were probably just an office manager of some sort
<benlovell>
they have a pretty good lineup of speakers
<yorickpeterse>
"My colleagues send their regards and are wondering if you can change your topic. We have made some research and it seems that rubinius is not in trend lately."
<yorickpeterse>
^ step one to piss me off
<yorickpeterse>
"We have made a short list of topics to guide you about our interests. Can you make a presentation about following: ruby, object-oriented design in ruby and ruby on rails, RoR highload, RoR tips and tricks, RoR supportive technologies and frameworks (RoR + Node.js, RoR + JS, RoR + SQL, RoR + NoSQL, RoR + WebServices), refactoring in Rails, Rails guides and secrets?"
<yorickpeterse>
step 2 - 100
<benlovell>
phahahaha
<yorickpeterse>
I wasn't lying when I said "literally 20 buzzwords"
<benlovell>
you should have just replied "BINGO!"
renzhi has quit [Read error: Connection timed out]
<yorickpeterse>
kindly explained them I wasn't a fan of this
<benlovell>
such buzzwords
<benlovell>
i'm pretty sure that email crashed every server it passed through
<yorickpeterse>
Gives me some extra time to come up with stuff for Arrrrcamp though
<benlovell>
i'm off to manila on wednesday for three days, this is going to hurt.
<yorickpeterse>
heh
<benlovell>
then home for a day and off to florida. hihi jetlag
<yorickpeterse>
I've yet to plan any holidays this year, probably going back to South Korea some time in June/July
<benlovell>
oh this is for confs.
<yorickpeterse>
pfff
<benlovell>
conpfffs
yubrew has quit [Ping timeout: 240 seconds]
tonni has quit [Remote host closed the connection]
Mon_Ouie has quit [Ping timeout: 246 seconds]
<yorickpeterse>
ugh, require_dependency
<yorickpeterse>
surely putting that everywhere will solve your autoloading hell
brettweavnet has quit [Read error: Connection reset by peer]
__butch__ has joined #ruby-lang
elliotec has joined #ruby-lang
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
wallerdev has joined #ruby-lang
johnny_rugger has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
phansch has quit [Quit: WeeChat 0.4.2]
apeiros has quit [Remote host closed the connection]
vsorlov has joined #ruby-lang
elliotec has quit [Ping timeout: 268 seconds]
agrinb has joined #ruby-lang
alexju has quit [Remote host closed the connection]
rippa has joined #ruby-lang
mistym has quit [Remote host closed the connection]
agrinb has quit [Ping timeout: 240 seconds]
retro|cz has joined #ruby-lang
michaeldeol has joined #ruby-lang
<retro|cz>
Hello. Anyone using stomp gem here? I have problem with auto reconnect. Maybe someone did it already...
shaman42 has quit [Quit: Näihin sanoihin, näihin pelkotiloihin lopetamme lähetyksen Supon arkistoihin laittamalla foliohatun päähämme.]
tylersmith has joined #ruby-lang
Coincidental has joined #ruby-lang
jeer has quit [Ping timeout: 264 seconds]
Coincidental has quit [Client Quit]
jcs222 has joined #ruby-lang
shaman42 has joined #ruby-lang
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jgpawletko is now known as jgpawletko_away
luiz_lha has quit [Ping timeout: 240 seconds]
michaeldeol has joined #ruby-lang
khaase has quit [Remote host closed the connection]
khaase has joined #ruby-lang
mistym has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
wallerdev has quit [Quit: wallerdev]
agrinb has joined #ruby-lang
tkuchiki has joined #ruby-lang
khaase has quit [Ping timeout: 252 seconds]
tbuehlmann has quit [Quit: Leaving]
Speed has joined #ruby-lang
marcostoledo has joined #ruby-lang
bantic has joined #ruby-lang
yfeldblum has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
loincloth has quit [Remote host closed the connection]
inkblots has left #ruby-lang [#ruby-lang]
wallerdev has joined #ruby-lang
chouhoul_ has joined #ruby-lang
chouhoul_ has quit [Remote host closed the connection]
AncientAmateur has quit [Remote host closed the connection]
sdouglas has quit [Remote host closed the connection]
alexju has joined #ruby-lang
sdouglas has joined #ruby-lang
jsrn has quit [Quit: Leaving]
chouhoulis has quit [Ping timeout: 240 seconds]
heftig has quit [Quit: Quitting]
Pupeno has joined #ruby-lang
fragamus has quit [Quit: Computer has gone to sleep.]
hahuang65 has joined #ruby-lang
Ins_ has joined #ruby-lang
<Ins_>
Hi
dagobah has quit [Quit: Leaving...]
<wallerdev>
hi
sdouglas has quit [Ping timeout: 265 seconds]
<yorickpeterse>
( ¯3¯)
<wallerdev>
haha
<wallerdev>
true love
<Ins_>
how does one force a subclass to declare a certain method?
<Ins_>
if that makes any sense
<yorickpeterse>
Ins_: You can't, Ruby has no interfaces
<yorickpeterse>
You can mimic it, but you can't force it
<yorickpeterse>
e.g. you can do
<Ins_>
can you elaborate on what you mean by 'mimic' it?
bjh13 has joined #ruby-lang
<yorickpeterse>
class Base; def some_method; raise NotImplementedError; end; end; class Child < Base; end
<yorickpeterse>
Then if you call some_method on an instance of Child it will raise
<yorickpeterse>
but it will not happen until you actually call the method
<wallerdev>
it would raise that anyway wouldnt it haha
<yorickpeterse>
wallerdev: yes, but typically you'd provide a better error other than "not implemented"
<wallerdev>
idk, most libraries seem to just raise whatever error happens, usually not standard to check things and raise specific errors to help people out
<yorickpeterse>
Ins_: in short, the concept of interfaces doesn't exist in Ruby
<Ins_>
would that work if the Base class is abstract? and by abstract I mean def initialize(blah) puts "Error: This is an abstract class, you fool!" end
<Ins_>
I see
<wallerdev>
abstract lol
<yorickpeterse>
Ins_: no
<Ins_>
Hey man be kind, I'm new to the language
<yorickpeterse>
not unless the sub class overrides the #initialize of the parent
<Ins_>
ruby is so different
<wallerdev>
stop trying to turn this into java :p
<yorickpeterse>
In general you don't need interfaces in Ruby
<Ins_>
JAVA IS ALL I KNOW
<Ins_>
the subclass does override initialize
<yorickpeterse>
Then you can't initialize it
<yorickpeterse>
because it will still raise
<Ins_>
wait, so i can't initialize the subclass?
<yorickpeterse>
if the parent constructor method raises and is not overwritten then no, you can't
<yorickpeterse>
(that is, you can't initialize the child)
<yorickpeterse>
Constructor methods aren't overwritten unless you explicitly declare them
<yorickpeterse>
I think Ruby stdlib has some mixin that lets you create abstract classes, but I've yet to see a use case for it
<Ins_>
tried to change it based on the example posted
<jhass>
Ins_: also in ruby we wouldn't do such a thing as a TreeItem for every type, a variable can hold any type so it's just one class
<Ins_>
Yeah, but I'm required to make subclasses in this case
<jhass>
who says that?
<Ins_>
I noticed the variables in ruby works like 'auto' in cpp
<Ins_>
kinda
<wallerdev>
kinda
<wallerdev>
except you can do x = 5; x = "something else"
<jhass>
you still have the stray class level instance variables there
johnny_rugger has joined #ruby-lang
<Ins_>
so right now, i want to make sure that an instance of TreeItem can't be declared (throw an exception, etc)
<jhass>
your example really is class TreeItem; def initialize value; @value = value; end; def display; print @value; end; end;
<Ins_>
basically 'pseudo-abstract' if you will
<jhass>
just strip that class
<jhass>
it has no use
<Ins_>
TreeItem class?
<jhass>
yes
<jhass>
and as a side effect of removing it, you can't instantiate it
<jhass>
;)
<Ins_>
Dude, this is an assignment. I know what you are suggesting is probably the best answer but there are guidelines and stuff
<jhass>
these don't seem to be written for ruby
<Ins_>
well, that's because i wrote it :p
<Ins_>
never touched ruby in my life, it scares me
<jhass>
so you can't change your own guidelines?
dc5ala has joined #ruby-lang
<Ins_>
maybe it will grow on me
<Ins_>
No, have to follow assignment guidelines
<Ins_>
i meant i wrote the code
<Ins_>
that you see there
<jhass>
that's clear
<jhass>
but the guidelines don't seem to be written for ruby
<Ins_>
yes yes, we've already established i'm terrible
<jhass>
but java or c++ or so
<Ins_>
well, it has to be done in ruby
<Ins_>
that's the point of this
<Ins_>
we're 'converting' code to ruby to see how it does things differently
<jhass>
give your tutor or whatever a slap form me for that
<Ins_>
I'm sure you guys would tear him apart if you could
<Ins_>
but for now lets help me learn and not get a 0 on this
<jhass>
so as said your current example reduces to class TreeItem; def initialize value; @value = value; end; def display; print @value; end; end; in ruby
<Ins_>
Yes
<Ins_>
wait, what do you mean by 'reduces'
<jhass>
equal functionality if the other one would be, dunno, java
<Ins_>
uh i guess
bantic has quit [Quit: bantic]
<Ins_>
TreeItem has two children, numeric and string
<Ins_>
TreeItem needs to throw some sort of error if someone tried to create an instance of it
<jhass>
see, that's java thinking still
<Ins_>
What part
<wallerdev>
throwing an error if someone tries to create a treeitem
Lewix has joined #ruby-lang
<Ins_>
Well, it's what we need to do in this case. I know what I'm trying to do here defeats the purpose of this language and will probably make you guys hate me but it needs to be done
<wallerdev>
create a setup method and call that from initialize
<jhass>
but okay, let's make it verbose for the sake of demonstration: module TreeItem; def initialize value; @value = value; end; def display; print @value; end; end; class NumericTreeItem; include TreeItem; end; class StringTreeItem; include TreeItem; end; NumericTreeItem.new(5).is_a? TreeItem #=> true
<wallerdev>
and fill that out in the child classes
<Ins_>
So treeitem is a module now?
<jhass>
yes
<jhass>
which is the closest equivalent to a abstract class
victorbjelkholm has quit [Quit: Leaving]
<Ins_>
I see
<Ins_>
And it contains initialize and dispay functions
<jhass>
methods
<jhass>
ruby has no functions
<Ins_>
ok ok
<Ins_>
methods
<jhass>
and you can include more than one module into a class
<Ins_>
(they are synonyms in my mind >.>)
<Ins_>
Yeah, he said something about that being the closest way of using multiple inheritance in ruby
<jhass>
a method has a receiver, a place where it lives and can access. A function don't
<Ins_>
now when i create the stringtreeitem and include the module treeitem, does stringtreeitem have to write their own definitions for the methods in the module?
<jhass>
no
<Ins_>
rewrite their own 'versions'*
<jhass>
it's not an interface, it's more an abstract class, a way to share functionality
centrx has joined #ruby-lang
<Ins_>
Yeah, interfaces force the classes that implement them to include their own versions of the methods
<Ins_>
I guess I can't really make ruby do the same with modules
<jhass>
ruby intentionally doesn't have such a concept
<jhass>
an interface is defined by its existence. A great example are IO and StringIO in core ruby
<jhass>
they have the same interface
<jhass>
yet they share nothing but the same method names (basically)
<jhass>
so whatever expects an IO object, you can pass it a StringIO
<Ins_>
I see
sdouglas has joined #ruby-lang
<Ins_>
but this won't work
<Ins_>
Tree needs to hold an instance of treeitem
<jhass>
no it doesn't
<Ins_>
In this it needs to
<jhass>
it needs to hold something _that looks_ like a TreeItem
<Ins_>
Ok
<Ins_>
How does it work then?
<Ins_>
they aren't children of treeitem anymore
<jhass>
yes
<Ins_>
is there someway to have them check if they implement treeitem?
<jhass>
you just assume the right methods are there
<Ins_>
or rather, 'include'
<Ins_>
Wait, say again?
mikecmpbll has quit [Ping timeout: 252 seconds]
<jhass>
just call them, ruby will complain to the caller with a NoMethodError if he passes you something unexpected
yfeldblum has joined #ruby-lang
<Ins_>
But how do I declare an instance of 'StringTreeItem' or 'NumericTreeItem' inside of the 'Tree' class?
<jhass>
if you do want to be explicit and don't call too many methods, you can do something like def add tree_item; raise ArgumentError unless tree_item.respond_to? :eql?; @tree << tree_item; end
<jhass>
what do you mean by declare in the tree class?
<Ins_>
I'm just going to quote the assignment
jsutt has joined #ruby-lang
jsutt has quit [Max SendQ exceeded]
<Ins_>
"You must define a class TreeItem. Any object belonging to any subclass of TreeItem (you will never make instances of TreeItem itself) may be stored AS DATA in a node of your trees. TreeItem should have a subclasses NumericTreeItem and StringTreeItem, and you will also need a class Tree, placed appropriately to this hierarchy to deal with the fact that trees can be stored as data as well"
<jhass>
I mean in ruby you could probably get rid of the TreeItem class altogether
|jemc| has quit [Ping timeout: 246 seconds]
sdouglas has quit [Ping timeout: 265 seconds]
mikecmpbll has joined #ruby-lang
<Ins_>
In ruby I can do a lot of things that'll make my life easier, but they also invalidate this assignment's requirements
mr-foobar has quit [Remote host closed the connection]
<wallerdev>
is it one of those pick your own language assignments
<Ins_>
nope
<Ins_>
that's the next one
<wallerdev>
does your teacher not know ruby or something? i dont know why this would be a ruby assignment
wallerdev has left #ruby-lang [#ruby-lang]
mr-foobar has joined #ruby-lang
wallerdev has joined #ruby-lang
<Ins_>
I dont know man
<Ins_>
So, I'll revert the changes I made to treeitem, as it NEEDS to be a class
chouhoulis has joined #ruby-lang
<Ins_>
will add initialize(data) puts "Abstract class!" end inside of that treeitem
<jhass>
this is a really stupid assignment for ruby, it's teaching you the wrong way to do it. Anyway, that's what it results in: http://paste.mrzyx.de/p6ca2ff26/
<chris2>
raise NotImplementedError
<chris2>
(and yes)
|jemc| has joined #ruby-lang
<Ins_>
I won't copy/paste that code. I need to see if i understand it
<Ins_>
so, what does << self do
<jhass>
class << someobj opens the singleton class of someobj
mr-fooba_ has joined #ruby-lang
<jhass>
a class definition in ruby is an instance of the class Class
<wallerdev>
loll
<jhass>
and self at the class level is pointing to that instance
<Ins_>
and when i create initialize(data) methods for the subclass, but don't add the line 'super()' will the subclass still call the parent 'initialize' method?
<wallerdev>
i dont think the teacher is gonna understand that code
<jhass>
so we open up the singleton class of the class, where the new method lives, and make it private
solars has quit [Ping timeout: 265 seconds]
<jhass>
wallerdev: the better, makes him realize his... I should stop
<wallerdev>
:p
mr-foobar has quit [Ping timeout: 240 seconds]
<jhass>
Ins_: no,
khaase has joined #ruby-lang
<Ins_>
Ok I think i'm beginning to get what you are explaining
<jhass>
I should explain singleton classes
rahul_j has quit [Quit: rahul_j]
<jhass>
every object in ruby has class that's unique to it (technically they are created on demand, but oh well)
elia has quit [Quit: Computer has gone to sleep.]
<jhass>
so you can define or override a method on an instance without affecting any other instance
<Ins_>
I remember a bit of singleton.
<Ins_>
Yeah, yeah just like that
<Ins_>
and you can add a method to a single instance of a class right?
<Ins_>
or modify it
<jhass>
a = "string a"; b = "string b"; class String; def both; end; end; def a.only_a; end; a.both # works; b.both # works; a.only_a #works, b.only_a # doesn't work
<Ins_>
I understand
<jhass>
yes, to single instance of a class, also called an object
<jhass>
see, these things just make no sense in ruby. I'm repeating myself, sorry
<Ins_>
I see
simono has joined #ruby-lang
<Ins_>
is placing 'attr_accessor :value' in a module legal?
<jhass>
yes, since it just generates methods
<whitequark>
but pointless
<whitequark>
oh. no
jsutt has quit [Ping timeout: 246 seconds]
<Ins_>
pointless how?
<whitequark>
you can include that module somewhere
<jhass>
yep
AncientAmateur has joined #ruby-lang
<Ins_>
Ok, i'm out then
<Ins_>
thanks for the help, will probably return again tonight
Ins_ has quit [Quit: Page closed]
Mon_Ouie has joined #ruby-lang
loincloth has joined #ruby-lang
hahuang61 has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yfeldblu_ has joined #ruby-lang
havenwood has joined #ruby-lang
rahul_j has joined #ruby-lang
yfeldblum has quit [Ping timeout: 265 seconds]
CaptainJet has joined #ruby-lang
|jemc| has joined #ruby-lang
yann_ck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
momomomomo has quit [Quit: momomomomo]
shennyg__ has quit [Quit: Updating details, brb]
shennyg has joined #ruby-lang
cored has quit [Quit: leaving]
cored has joined #ruby-lang
futilegames has joined #ruby-lang
tharindu has joined #ruby-lang
apeiros has joined #ruby-lang
mehlah has quit [Quit: Leaving...]
sdegutis has joined #ruby-lang
sdouglas has quit [Remote host closed the connection]
futilegames has quit [Client Quit]
futilegames has joined #ruby-lang
<sdegutis>
What tools do you use to switch between projects with different versions of the same gem?
dc5ala has quit [Quit: Ex-Chat]
<sdegutis>
I was using RVM, then I started using rbenv and was considering using rbenv-gemsets, now I'm looking into chruby with gst, and it all makes me want to go back to RVM.
<jhass>
bundler
<sdegutis>
Just "bundler exec"?
<jhass>
yeah
postmodern has joined #ruby-lang
<sdegutis>
Hmm I may do that.
<jhass>
or have the project require 'bundler/setup'
darix has quit [Quit: may the packets be with you...]
<sdegutis>
One of my hopes was that I'd be able to find a solution that let me have per-project versions of gems installed, but also be able to use it in eshell.
<sdegutis>
I guess 'bundler exec' would probably work, but I remember it being slow.
<sdegutis>
I also heard about using `gem install --install-user <some-gem>`, I wonder if that would play nicely here...
havenwood has quit [Remote host closed the connection]
<jhass>
--user-install and that just changes your GEM_HOME to ~/.gems/ruby/ABI_VERSION/ (iirc)
<sdegutis>
Ah, hmm.
<sdegutis>
There's got to be a way to tell gems to install and use a local ./.gem/
<jhass>
you could manually manage $GEM_HOME, but you'd probably just end up writing a custom gemset implementation
LMity has joined #ruby-lang
<jhass>
the benefit of using bundler is that I don't have to reinstall the commen gems all the time
<sdegutis>
Ah good point.
benanne has joined #ruby-lang
havenwood has joined #ruby-lang
AncientAmateur has quit [Remote host closed the connection]
tbuehlmann has joined #ruby-lang
<|jemc|>
does anyone know of a list of strings to use for testing encoding/decoding strings of various encodings to/from byte arrays in a unit test?
AncientAmateur has joined #ruby-lang
sdouglas has joined #ruby-lang
centrx has quit [Remote host closed the connection]
<|jemc|>
some common set of strings with known encoded byte sequences that covers the range of some of the problems you might run into
centrx has joined #ruby-lang
<|jemc|>
I could obviously select some strings at random and run them through a known good encoder/decoder, but I may not be able to successfully highlight some of the edge cases
havenwood has quit [Ping timeout: 268 seconds]
<yorickpeterse>
back
LMity has quit [Ping timeout: 268 seconds]
darix has joined #ruby-lang
sepp2k has joined #ruby-lang
arBmind has quit [Quit: Leaving.]
Cakey has joined #ruby-lang
robmiller has quit [Quit: Leaving.]
Cakey has quit [Ping timeout: 264 seconds]
jsutt has joined #ruby-lang
jsutt has quit [Max SendQ exceeded]
jsutt has joined #ruby-lang
elliotec has joined #ruby-lang
bantic has joined #ruby-lang
elliotec_ has joined #ruby-lang
dstynchula has joined #ruby-lang
arubin has joined #ruby-lang
tonni has joined #ruby-lang
* yorickpeterse
is compiling dogecoint-qt
<yorickpeterse>
time to get on the Dogetrain
elliotec_ has quit [Remote host closed the connection]
elliotec_ has joined #ruby-lang
ivan_ has quit [Read error: Operation timed out]
Lewix has quit [Remote host closed the connection]
rahul_j has quit [Quit: rahul_j]
<yorickpeterse>
haha, this GUI is amazing
<yorickpeterse>
Fucking comic sans too
elliotec has quit [Ping timeout: 265 seconds]
yfeldblu_ has quit [Remote host closed the connection]
MichD is now known as michd
marcostoledo has joined #ruby-lang
retro|cz has quit [Read error: Operation timed out]
luiz_lha has joined #ruby-lang
rahul_j has joined #ruby-lang
sdouglas has quit [Remote host closed the connection]
sdouglas has joined #ruby-lang
robmiller has joined #ruby-lang
devgiant has quit [Quit: Leaving]
rahul_j has quit [Quit: rahul_j]
elliotec_ has quit [Remote host closed the connection]
elliotec has joined #ruby-lang
devgiant has joined #ruby-lang
priodev has quit [Ping timeout: 265 seconds]
yfeldblum has joined #ruby-lang
loincloth has quit [Remote host closed the connection]
rahul_j has joined #ruby-lang
linc01n has quit [Ping timeout: 240 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
sdouglas has quit [Ping timeout: 265 seconds]
loincloth has joined #ruby-lang
<FastJack>
yorickpeterse: such money
LMity has joined #ruby-lang
benjamin-patch has joined #ruby-lang
linc01n has joined #ruby-lang
robmiller has quit [Quit: Leaving.]
cnivolle_ has joined #ruby-lang
cnivolle_ has quit [Remote host closed the connection]
woollyams has joined #ruby-lang
cnivolle has quit [Ping timeout: 240 seconds]
priodev has joined #ruby-lang
elliotec has quit [Remote host closed the connection]