<iosctr>
whitequark: I think you'll need to write your own "success?" method; creating an array of status codes or classes, then checking that the response.code or #is_a? class is included.
<whitequark>
iosctr: when Net::HTTPSuccess works fine
<whitequark>
`when Net::HTTPSuccess', that is.
<zzak>
response.is_a? Net::HTTPSuccess
<iosctr>
that would be true for status codes 2xx - so, it just depends on your request and what you'll accept as "successful" :)
<whitequark>
iosctr: well, in this particular case I'm making a request to a RESTful API
<whitequark>
so 3xx is quite definitely not success
<iosctr>
then you just need to be aware of what their API will return under specific circumstances.
<iosctr>
and some don't away document the response for all edge cases ;)
<iosctr>
you could go with that, but be sure to log any failures with some response info, so you'll know.
charliesome has joined #ruby-lang
<whitequark>
yeah, that's what I do
<iosctr>
you might also look at some other http libraries, like faraday. Been working with that recently - I like it.
<whitequark>
iosctr: I'm posting to twitter
<whitequark>
it's 300 LOC complete with some app-specific logic, so I'm satisfied with that
<whitequark>
I'm unlikely to ever need more than the 3 requests I do now
srbaker has quit [Quit: Computer has gone to sleep.]
Hakon has quit [Quit: Leaving...]
srbaker has joined #ruby-lang
mwjcomputing has joined #ruby-lang
io_syl has quit [Quit: Computer has gone to sleep.]
<iosctr>
well, I should say that faraday is a wrapper around Net::HTTP, Excon (used by Fog), etc...
<iosctr>
be aware, however, that faraday-middleware (mentioned by many blog posts) is behind/not-compatible-with the current master (0.9.0-pre) branch of faraday - FYI.
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
<matti>
Eh.
<whitequark>
iosctr: thanks
leopard_me has joined #ruby-lang
<zzak>
3xx is HTTPRedirection
<zzak>
they are separate
<theoros>
i'm getting reset connections trying to push a newly built gem. adding credentials seems to have worked fine
sepp2k1 has quit [Remote host closed the connection]
faustman has quit [Ping timeout: 245 seconds]
<havenn>
theoros: I was having problems pushing a gem earlier today then I realized I had installed RubyGems 2.0.0.preview2.2
<theoros>
still on 1.8.24 here
guns has quit [Ping timeout: 250 seconds]
briantrust has joined #ruby-lang
<theoros>
hm, rbx-head :)
<theoros>
drbrain: for what it's worth, rubinius 2.0.0rc1 hangs at this line when `gem push`ing: POST https://rubygems.org/api/v1/gems
<whitequark>
theoros: just fyi, I never was able to successfully push a gem with rbx for some reason
<zzak>
theoros: i would file a ticket
marr has quit [Ping timeout: 265 seconds]
seanstickle has joined #ruby-lang
guns has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
wallerdev has joined #ruby-lang
lcdhoffman has joined #ruby-lang
postmodern has quit [Quit: Leaving]
srbaker has quit [Quit: Computer has gone to sleep.]
srbaker has joined #ruby-lang
jcr has quit [Quit: Leaving]
crazyhorse has joined #ruby-lang
crazyhorse has left #ruby-lang ["Leaving..."]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
mwjcomputing has quit [Ping timeout: 264 seconds]
apeiros_ has joined #ruby-lang
Bosox20051 has joined #ruby-lang
synaesthetik has joined #ruby-lang
havenn has quit [Ping timeout: 264 seconds]
apeiros_ has quit [Ping timeout: 260 seconds]
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
BigO_ has joined #ruby-lang
BigO_ has quit [Remote host closed the connection]
jsilver has joined #ruby-lang
glebm has joined #ruby-lang
wycats has quit [Ping timeout: 246 seconds]
robotmay has quit [Ping timeout: 245 seconds]
andrewhl has quit [Remote host closed the connection]
wycats has joined #ruby-lang
banisterfiend has joined #ruby-lang
gsav has quit [Read error: Connection reset by peer]
iosctr has quit [Quit: Konversation terminated!]
<drbrain>
theoros: yes, please file one including --debug output
jackhammer2022 has quit [Ping timeout: 245 seconds]
io_syl has joined #ruby-lang
coliflor_ has joined #ruby-lang
synaesthetik has left #ruby-lang [#ruby-lang]
coliflor has quit [Ping timeout: 245 seconds]
havenn has joined #ruby-lang
kurko_ has quit [Ping timeout: 264 seconds]
havenn has quit [Ping timeout: 255 seconds]
mercwithamouth has joined #ruby-lang
guns has quit [Quit: guns]
jackhammer2022 has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
jackhammer2022 has quit [Ping timeout: 245 seconds]
lcdhoffman has quit [Quit: lcdhoffman]
havenn has joined #ruby-lang
havenn has quit [Read error: Connection reset by peer]
havenn has joined #ruby-lang
gsav has joined #ruby-lang
guns has joined #ruby-lang
lcdhoffman has joined #ruby-lang
madish has quit [Quit: ChatZilla 0.9.89 [Firefox 16.0.1/20121026125834]]
mwjcomputing has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
lcdhoffman has quit [Client Quit]
leopard_me has quit [Quit: Computer has gone to sleep.]
srbaker has joined #ruby-lang
kennyvb has quit [Ping timeout: 255 seconds]
mwjcomputing has quit [Ping timeout: 245 seconds]
io_syl has quit [Quit: Computer has gone to sleep.]
jackhammer2022 has joined #ruby-lang
faces has joined #ruby-lang
kennyvb has joined #ruby-lang
reppard has joined #ruby-lang
seanstickle has quit [Quit: seanstickle]
imajes has quit [Remote host closed the connection]
jackhammer2022 has quit [Ping timeout: 264 seconds]
jackhammer2022 has joined #ruby-lang
imperator has quit [Ping timeout: 260 seconds]
havenn has quit [Read error: No route to host]
havenn has joined #ruby-lang
S1kx has quit [Ping timeout: 248 seconds]
guns has quit [Ping timeout: 265 seconds]
io_syl has joined #ruby-lang
banisterfiend has quit [Ping timeout: 264 seconds]
imajes has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
guns has joined #ruby-lang
swaits has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 264 seconds]
Mon_Ouie has joined #ruby-lang
manveru has quit [Ping timeout: 244 seconds]
andrewhl has joined #ruby-lang
setmeaway2 has joined #ruby-lang
io_syl has quit [Quit: Computer has gone to sleep.]
setmeaway has quit [Ping timeout: 265 seconds]
postmodern has joined #ruby-lang
aef has quit [Remote host closed the connection]
aef has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 265 seconds]
reppard has quit [Quit: leaving]
havenn has quit [Remote host closed the connection]
<rue>
gjaldon: You may want to ask on #rubyonrails, too. Doesn’t actionmailer have some kind of a mock thing?
faustman has joined #ruby-lang
robotmay has joined #ruby-lang
<ryanf>
gjaldon: that seems like not the way to set up what you're trying to do
<ryanf>
at the moment you're inheriting from ActionMailer and not using any of its capabilities whatsoever
<ryanf>
(the reason your spec isn't working though is that let(:mail) is lazy, so you would need to actually call "mail" in your spec in order for anything to happen)
xalei has quit [Quit: Leaving]
xalei has joined #ruby-lang
dzhulk has joined #ruby-lang
chendo_ has joined #ruby-lang
voker57 has quit [Ping timeout: 250 seconds]
mercwithamouth has quit [Ping timeout: 248 seconds]
stardiviner has joined #ruby-lang
faustman has quit [Ping timeout: 248 seconds]
mistym has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
Bosox20051 has quit [Ping timeout: 264 seconds]
<zenspider>
gjaldon: there was the last time I measured... but it has been a while
robotmay has quit [Remote host closed the connection]
marr has joined #ruby-lang
faces has quit [Ping timeout: 244 seconds]
faces has joined #ruby-lang
Nisstyre has quit [Read error: Connection reset by peer]
Croms has quit [Quit: Croms]
faces has quit [Ping timeout: 248 seconds]
xalei has quit [Remote host closed the connection]
sepp2k has joined #ruby-lang
<gjaldon>
thanks for the responses ryanf and zenspider. zenspider: which was faster? minitest?
<zenspider>
gjaldon: last time I measured minitest by a long shot.
<gjaldon>
zenspider: thanks a lot! will try out minitest then
kurko_ has joined #ruby-lang
<zenspider>
gjaldon: enjoy
<gjaldon>
ryanf: how do I call "mail" inside my spec? i tried removing the inheritance from ActionMailer but when I do that, I can't call the registration_confirmation method from my controller. What's the work-around for that?
<charliesome>
is there a good way to express multiple 'overloads' with rdoc?
<zenspider>
charliesome: overloads?
tockitj_ has joined #ruby-lang
<charliesome>
zenspider: so if i have a method that does different things based on whether it's passed a symbol, string or proc
<charliesome>
i know i can have multiple call-seqs, but i'd like to write a different bit of documentation for each call-seq
<zenspider>
not sure about that. I just use good english doco so I'd describe all the uses for a given argument in a single paragraph that spells them all out
<zenspider>
there are ul and dl markups too if you'd rather it be more structured
<zenspider>
you said call-seqs... are you writing this in C?
<zenspider>
oh interesting... I've only used call-seq for C ... didn't know you could do it for ruby too.
<zenspider>
but they don't produce separate doco entries ... just augment the summary at the top of the doco block... so it'd still be the english side that you'd do this in
<charliesome>
alright, so i may as well just focus on writing nice english docos
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
toretore has joined #ruby-lang
<zenspider>
charliesome: sorry I couldn't be more help
qwerxy has joined #ruby-lang
<charliesome>
no worries
ebouchut has joined #ruby-lang
kurko_ has quit [Ping timeout: 265 seconds]
ebouchut has quit [Quit: This computer has gone to sleep]
adambeynon has joined #ruby-lang
imperator has joined #ruby-lang
tdy has quit [Remote host closed the connection]
thone has joined #ruby-lang
kiritoSAO has joined #ruby-lang
kiritoSAO has quit [Client Quit]
thone_ has quit [Ping timeout: 245 seconds]
sush24 has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
kirin` has quit [Ping timeout: 246 seconds]
Boohbah has quit [Ping timeout: 246 seconds]
apeiros_ has joined #ruby-lang
kirin` has joined #ruby-lang
MaddinXx_ has joined #ruby-lang
leopard_me has joined #ruby-lang
spike|spiegel has joined #ruby-lang
qwerxy has quit [Quit: offski]
io_syl has quit [Quit: Computer has gone to sleep.]
stonerfish has quit [Ping timeout: 276 seconds]
dzhulk has quit [Quit: Leaving.]
jxie has quit [Quit: leaving]
stonerfish has joined #ruby-lang
stonerfish has quit [Client Quit]
coliflor has joined #ruby-lang
coliflor_ has quit [Ping timeout: 245 seconds]
faustman has joined #ruby-lang
beiter has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
madish has joined #ruby-lang
nXqd has joined #ruby-lang
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
qwerxy has joined #ruby-lang
qwerxy has quit [Client Quit]
faces has joined #ruby-lang
qwerxy has joined #ruby-lang
qwerxy has quit [Client Quit]
<whitequark>
ok, now I have this moronic social network whose API does not allow web applications to post stuff via OAuth unless they can violate same-origin policy somehow
<whitequark>
what's the best headless browser to install on a production server?
nXqd has quit [Ping timeout: 252 seconds]
ebouchut has joined #ruby-lang
lcdhoffman has joined #ruby-lang
beiter has quit [Quit: beiter]
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
Nisstyre-laptop has quit [Ping timeout: 250 seconds]
agarie has quit [Remote host closed the connection]
ebouchut has quit [Quit: This computer has gone to sleep]
sush24 has quit [Ping timeout: 264 seconds]
meatballhat has joined #ruby-lang
meatballhat has quit [Changing host]
meatballhat has joined #ruby-lang
sush24 has joined #ruby-lang
<yorickpeterse>
Fuck yeah, my parser parses stdlib again
bjensen has joined #ruby-lang
gaveen has joined #ruby-lang
gaveen has quit [Changing host]
gaveen has joined #ruby-lang
rsl has joined #ruby-lang
imperator has quit [Read error: Connection reset by peer]
meatballhat has quit [Ping timeout: 246 seconds]
mwjcomputing has joined #ruby-lang
methods has joined #ruby-lang
methods has left #ruby-lang [#ruby-lang]
powershellyoda has joined #ruby-lang
gaveen has quit [Remote host closed the connection]
powershellyoda has quit [Quit: Leaving]
JohnBat26 has joined #ruby-lang
<manveru>
whitequark: i think phantomjs maybe
qwerxy has joined #ruby-lang
<manveru>
but depends on what you mean with "best" :)
<manveru>
sometimes you need selenium, but that requires xvfb
meatballhat has joined #ruby-lang
meatballhat has joined #ruby-lang
meatballhat has quit [Changing host]
burge has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
qwerxy has quit [Quit: offski]
<gjaldon>
hi all. any idea on how to fix my spec? I'm using mailgun api to send an email and email is being sent and test should pass. Something wrong with my spec though
<gjaldon>
I was advised by ryanf earlier that I need to call "mail" in my spec. How do I do that?
<rue>
gjaldon: When you use let, it’s basically def mail(); stuff you put inside the definition; end
<gjaldon>
Also, I'm not using any functions of ActionMailer but have my RegistrationMailer class inherit from "ActionMailer". I tried removing that before but then I couldn't call RegistrationMailer.registration_confirmation from a controller
qwerxy has quit [Client Quit]
srbaker has joined #ruby-lang
<gjaldon>
rue: I see. So I need to call the mail method inside my spec? I tried adding a line with just "mail" but didn't work
jtoy has joined #ruby-lang
<rue>
If you wish to actually use whatever you do in it, yes
<rue>
You don’t *need* to use a let
MrWibbles has joined #ruby-lang
MrWibbles has quit [Quit: Leaving...]
MrWibbles has joined #ruby-lang
<MrWibbles>
hey.. erm
swav has quit [Remote host closed the connection]
<MrWibbles>
find a * in an array of string
<MrWibbles>
![].grep(/*/).empty?
<gjaldon>
rue: tried removing let and I still get the same error
<MrWibbles>
works.. but not that pretty
<apeiros_>
/*/ does not raise?
<apeiros_>
for me, /*/ raises, because it's not a valid regexp
vlad_sta_ has quit [Remote host closed the connection]
krohrbaugh has joined #ruby-lang
sent-hil has joined #ruby-lang
leopard_me has joined #ruby-lang
Guest____ has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 264 seconds]
<Guest____>
what's the easiest way to launch a long running process in the background, and retain the pid? if i use IO.popen, it runs the cmd in a shell, and returns the pid of the shellm which is not what i want
<Guest____>
i tried using 'exec <cmd>', but this doesn't seems to work on linux ubuntu
<apeiros_>
I think the modern way to launch subprocesses is Kernel#spawn
sent-hil has quit [Remote host closed the connection]
<Guest____>
Process.spawn?
lcdhoffman has joined #ruby-lang
<Guest____>
it's not available on 1.8.7, right?
CaptainJet has joined #ruby-lang
dzhulk has quit [Quit: Leaving.]
<apeiros_>
Guest____: no, if you're still on 1.8, you should really move up to 1.9
<apeiros_>
Kernel#spawn is the same as Process::spawn btw.
dzhulk has joined #ruby-lang
<Guest____>
thanks
vlad_starkov has joined #ruby-lang
<Guest____>
it seems Process.spawn is also running the cmd in a shell. ps shows tow process, one one is a 'sh', and the pid of this shell is what spawn returns
<Guest____>
*two processes
imperator2 has quit [Ping timeout: 264 seconds]
leopard_me has quit [Quit: Computer has gone to sleep.]
qwerxy has quit [Quit: offski]
sepp2k has quit [Ping timeout: 245 seconds]
rsl has quit [Quit: Computer has gone to sleep.]
<apeiros_>
Guest____: you called it with a single string or with an array?
<apeiros_>
with an array should bypass the shell
<apeiros_>
with a string it must use a shell
<Guest____>
yes i was just looking into the docs
sepp2k has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
meatballhat has quit [Ping timeout: 245 seconds]
srbaker has quit [Quit: Computer has gone to sleep.]
vlad_starkov has quit [Remote host closed the connection]
meatballhat has joined #ruby-lang
bentis has quit [Quit: Lost terminal]
stonerfish has joined #ruby-lang
briantrust has joined #ruby-lang
S1kx has quit [Read error: Connection reset by peer]
Nisstyre has joined #ruby-lang
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
adambeynon has joined #ruby-lang
KA__ has joined #ruby-lang
headius has joined #ruby-lang
stonerfish has quit [Quit: Leaving.]
KA__ has quit [Client Quit]
schaerli has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
lcdhoffman has quit [Quit: lcdhoffman]
lcdhoffman has joined #ruby-lang
wyhaines has joined #ruby-lang
sn0wb1rd has quit [Quit: sn0wb1rd]
sn0wb1rd has joined #ruby-lang
wmoxam has quit [Quit: leaving]
Mon_Ouie has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
stonerfish has joined #ruby-lang
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
jaimef has joined #ruby-lang
stonerfish has quit [Client Quit]
srbaker has joined #ruby-lang
dzhulk has quit [Quit: Leaving.]
robotmay_ has joined #ruby-lang
robotmay has quit [Read error: Connection reset by peer]
robotmay_ has quit [Read error: Connection reset by peer]
robotmay has joined #ruby-lang
kurko_ has joined #ruby-lang
faustman has joined #ruby-lang
rippa has quit [Ping timeout: 248 seconds]
rippa has joined #ruby-lang
bampersand has joined #ruby-lang
<bampersand>
Hey guys. i'm trying to use the example from http://www.ruby-doc.org/stdlib-1.9.3/libdoc/rss/rdoc/RSS.html .. however when I use a different URL i'm getting an error: incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
<bampersand>
I tried googling but can't find anything specific. or where I should be forcing an encoding
<apeiros_>
bampersand: by "the example", I assume you mean the first one?
<bampersand>
Yeah, sorry about that.
<apeiros_>
care to paste the *precise* error you get?
<bampersand>
the only thing I changed was the url rss feed
<apeiros_>
seems to be utf-8, but the data looks odd
abstr4ct has joined #ruby-lang
<injekt>
:)
<bampersand>
so what exactly is the problem here? it's wanting ASCII-8BIT but instead it's getting UTF-8?
<abstr4ct>
messin with nokogiri, and ive got this terrible thing..... seems it could be much simpler, any ideas? $texas = '//*[text()="Sunday:"]/following::div[1] | //*[text()="Sunday:"]/following::div[2]'
<abstr4ct>
i want to just list multiple divs instead of piping the entire shit over and over. ugh
schaerli has quit [Remote host closed the connection]
<apeiros_>
bampersand: no, the problem is worse, that website gives broken data
<apeiros_>
it says its contents were utf-8
<apeiros_>
but what it returns is not valid utf-8
<apeiros_>
(or net/http and/or open-uri is horribly broken)
intellitech has quit [Quit: intellitech]
<bampersand>
apeiros_: oh that's a shame.
<bampersand>
I was in a creative mood and had a decent idea, alas back to nothing.
<apeiros_>
bampersand: does the feed work with a normal feed reader?
sent-hil has joined #ruby-lang
<injekt>
abstr4ct: xpath doesn't support what you'd like to do
<abstr4ct>
hehe
<injekt>
abstr4ct: which of course would be something like [1..2] or [1-2] [1,2]
<abstr4ct>
yes, ive not had any luck
<injekt>
abstr4ct: write the expression once and store it in a var instead? "#{v}[1] | #{v}[2]"
<bampersand>
apeiros_: it worked when I tried it with firefox
<injekt>
abstr4ct: might be a good question to ask stack overflow, though
dzhulk has joined #ruby-lang
<apeiros_>
so we're at net/http and/or open-uri being horribly broken. that's bad.
<apeiros_>
and yes, works here too in firefox.
<apeiros_>
and reports utf-8.
<apeiros_>
bampersand: I'd report it on the ruby mailing list
<apeiros_>
I might be able to figure out what's going on, but that'd most likely cost me much much more time than what I'm willing to spend
<bampersand>
apeiros_: if you're feeling generous that'd be great, if not thanks for the help.
<apeiros_>
no, sorry, I've got some things to do today and am already running out of time
<bampersand>
okay thanks.
Mon_Ouie has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 255 seconds]
<abstr4ct>
that p should be a div to be consistant with my example
sent-hil has quit [Remote host closed the connection]
[Cupcakes] has quit [Read error: Connection reset by peer]
[Cupcakes] has joined #ruby-lang
[Cupcakes] has quit [Max SendQ exceeded]
meatballhat has quit [Ping timeout: 272 seconds]
[Cupcakes] has joined #ruby-lang
[Cupcakes] has quit [Max SendQ exceeded]
[Cupcakes] has joined #ruby-lang
[Cupcakes] has quit [Max SendQ exceeded]
[Cupcakes] has joined #ruby-lang
[Cupcakes] has quit [Max SendQ exceeded]
MaddinXx has joined #ruby-lang
meatballhat has joined #ruby-lang
charliesome has joined #ruby-lang
apeiros_ has quit [Remote host closed the connection]
S1kx has quit [Remote host closed the connection]
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
zmack has quit [Remote host closed the connection]
My_Hearing has joined #ruby-lang
bjensen has quit [Quit: bjensen]
AndChat| has quit [Ping timeout: 272 seconds]
KA_ has quit [Read error: Connection reset by peer]
KA_ has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 272 seconds]
mistym has quit [Remote host closed the connection]
KA_ has quit [Quit: KA_]
srbaker has quit [Quit: Computer has gone to sleep.]
KA_ has joined #ruby-lang
tjadc has quit [Ping timeout: 256 seconds]
robotmay has joined #ruby-lang
seanstickle has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
KA__ has joined #ruby-lang
KA_ has quit [Ping timeout: 250 seconds]
KA__ is now known as KA_
_Mon_Ouie_ has joined #ruby-lang
stonerfish has joined #ruby-lang
My_Hearing has quit [Ping timeout: 272 seconds]
MaddinXx has quit [Remote host closed the connection]
Mon_Ouie has joined #ruby-lang
_Mon_Ouie_ has quit [Ping timeout: 244 seconds]
abstr4ct has quit [Ping timeout: 272 seconds]
mjio has joined #ruby-lang
nXqd has quit [Ping timeout: 244 seconds]
kurko_ has quit [Ping timeout: 255 seconds]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
havenn has quit [Read error: Connection reset by peer]
Mon_Ouie has quit [Ping timeout: 272 seconds]
wyhaines has quit [Remote host closed the connection]
cirenyc has joined #ruby-lang
tockitj_ has quit [Ping timeout: 264 seconds]
nertzy2 has quit [Quit: Leaving]
tockitj_ has joined #ruby-lang
nertzy has joined #ruby-lang
KA_ has quit [Quit: KA_]
KA_ has joined #ruby-lang
heftig has quit [Quit: leaving]
tbuehlmann has quit [Remote host closed the connection]
nXqd has joined #ruby-lang
toretore has quit [Quit: Leaving]
meatballhat has quit [Ping timeout: 272 seconds]
dzhulk has quit [Quit: Leaving.]
dzhulk has joined #ruby-lang
nXqd has quit [Ping timeout: 272 seconds]
joevandyk_ has joined #ruby-lang
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
benanne has quit [Quit: kbai]
lcdhoffman has joined #ruby-lang
CaptainJet has quit []
<soahccc>
Does anybody know if I can colorize CLI output "interpolation safe" somehow? As you cannot undo a color change in a terminal (just set a new color) there is no direct way to do something like "foo #{"bar".red} baz".yellow
methods has joined #ruby-lang
<soahccc>
But I don't think this is possible with ruby, is it? Sort of knowing the future
<charliesome>
soahccc: perhaps look into the paint gem
methods has left #ruby-lang [#ruby-lang]
<charliesome>
not sure off the top of my head if it supports sanitising ansi escapes from strings
<badeball>
soahccc: it is possible. you can write your own class that acts as a string, but you override the + (which concatenates them)
<soahccc>
Hmm didn't know that interpolations will call #+
<badeball>
well, at least it sounds possible in my head
<badeball>
i have no idea if it does
<charliesome>
interpolation does not call +
reppard has joined #ruby-lang
<soahccc>
alternatively I could do a fake hacky sort of "foo %r{#{some_var}} bar".yellow
<drbrain>
class String; def +(other) raise "no" end end; "a#{1}"
sn0wb1rd has quit [Quit: sn0wb1rd]
heftig has joined #ruby-lang
<charliesome>
an #interpolated method would be handy
<charliesome>
the rails guys could use it to extend safe buffer support into interpolation
<heftig>
interpolated method?
<badeball>
hmm, it does not seem like one can override rb_str_append, which makes it impossible to mess with the behavior of string interpolation.
<charliesome>
badeball: load a c extension that overwrites rb_str_append with a trampoline into a patched version
faustman has quit [Read error: Operation timed out]
robotmay has quit [Remote host closed the connection]