m3nd3s has quit [Remote host closed the connection]
Rarrikins_s has joined #ruby-lang
marr has quit [Ping timeout: 260 seconds]
Rarrikins has quit [Ping timeout: 260 seconds]
seanstickle has joined #ruby-lang
meatballhat has joined #ruby-lang
meatballhat has joined #ruby-lang
spuk has joined #ruby-lang
kurko_ has joined #ruby-lang
spuk has quit [Client Quit]
Asher has joined #ruby-lang
chekcmate has quit [Ping timeout: 245 seconds]
xalei has quit [Remote host closed the connection]
ap4y has joined #ruby-lang
<naquad>
is there something like Hash#detect but returning only value not array with key and value?
srbaker has quit [Quit: Computer has gone to sleep.]
Rarrikins_s has quit [Ping timeout: 260 seconds]
Rarrikins has joined #ruby-lang
<darix>
naquad: values_at
sailias has quit [Ping timeout: 255 seconds]
<naquad>
docs say it doesn't take block
<naquad>
forgot to mention, that i need block
s1n4 has quit [Quit: leaving]
mercwithamouth has quit [Ping timeout: 276 seconds]
<darix>
so just add a .map {} block after it that drops the keys
kain__ has left #ruby-lang [#ruby-lang]
<micaeked>
not #map, since #detect returns `[k, v]`... just #last after #detect is enough
<micaeked>
hmm... actually, `#try(:last)` because it might be nil
andrewhl has quit [Remote host closed the connection]
drbrain has joined #ruby-lang
srbaker has joined #ruby-lang
emocakes has quit [Quit: emocakes]
<darix>
try() requires active support if i recall correctly
<micaeked>
it's a simple method and i find it very useful. i think there is a gem with just a few of these really useful core extensions, but i forget what it was called
drbrain has quit [Ping timeout: 252 seconds]
mistym has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
<yfeldblum>
micaeked, activesupport has the really useful core extensions
<naquad>
in the end i've defined Object#try as in ActiveSupport
<naquad>
thanks everyone
mercwithamouth has joined #ruby-lang
Nisstyre-laptop has quit [Quit: Leaving]
<naquad>
i need a singleton class. i did it with Singleton module, but i have a question: maybe i should better use a module + module_function + forbid extend/include?
neocoin has joined #ruby-lang
sepp2k has quit [Remote host closed the connection]
Rarrikins has quit [Remote host closed the connection]
s1n4 has joined #ruby-lang
Rarrikins has joined #ruby-lang
megharsh has joined #ruby-lang
davidbalbert is now known as davidbalber|away
davidbalber|away is now known as davidbalbert
kurko_ has quit [Ping timeout: 252 seconds]
aef has joined #ruby-lang
<naquad>
is there any way to validate hierarchical structure (gem or something in stdlib)? i mean that for example hash contains specified keys, their values have specified type and match regexp or predicate
<agarie>
for specified keys, depending on your use case, you might prefer to use a Struct
<agarie>
for the specified type/matching of regexp or predicate I don't know, you might need to implement it yourself
<naquad>
i don't have a struct, i have a hash parsed from yaml file
tdy_ has quit [Read error: Connection reset by peer]
kain has joined #ruby-lang
blahwoop has joined #ruby-lang
rebelcan has quit [Remote host closed the connection]
rebelcan has joined #ruby-lang
megharsh has quit [Ping timeout: 255 seconds]
blahwoop has quit [Ping timeout: 276 seconds]
bryno has joined #ruby-lang
megharsh has joined #ruby-lang
jbsan has joined #ruby-lang
Rarrikins_p has joined #ruby-lang
dkannan has quit [Read error: Connection reset by peer]
Rarrikins has quit [Ping timeout: 276 seconds]
Asher2 has joined #ruby-lang
methods has joined #ruby-lang
methods has left #ruby-lang [#ruby-lang]
dkannan has joined #ruby-lang
Asher2 has quit [Quit: Leaving.]
postmodern has joined #ruby-lang
stonerfish has quit [Quit: Leaving.]
sagar_junnu has joined #ruby-lang
<ryanf>
zenspider: hey, is minitest/bacon a thing that's actually going to happen?
<ryanf>
if so, that's pretty cool
charliesome has joined #ruby-lang
Rarrikins_p_b has joined #ruby-lang
Rarrikins_p has quit [Ping timeout: 255 seconds]
Rarrikins_p_b has quit [Ping timeout: 255 seconds]
drbrain has joined #ruby-lang
gnufied1 has joined #ruby-lang
drbrain has quit [Ping timeout: 276 seconds]
megharsh has quit [Ping timeout: 264 seconds]
micaeked has quit [Quit: WeeChat 0.3.9.2]
Glass_saga has quit [Remote host closed the connection]
<charliesome>
ruby pop quiz
dmwuw has joined #ruby-lang
<charliesome>
why does Thread.start { eval "exit!" } work, but Thread.start("exit!", &method(:eval)) not
gsav has joined #ruby-lang
<ryanf>
charliesome: I just spent a pretty long time thinking about it
<ryanf>
before trying it out
<ryanf>
to find that it does actually work
<ryanf>
fu
<charliesome>
what ruby version?
<ryanf>
oh, 1.8.7 by accident, as usual
<charliesome>
rvm --default would like a word with you
<ryanf>
hmm. so it's something specific to Method#to_proc I guess
<ryanf>
something about arity? that doesn't seem right though
faces has joined #ruby-lang
<charliesome>
vm_eval.c:1190
<charliesome>
rb_raise(rb_eRuntimeError, "Can't eval on top of Fiber or Thread");
<ryanf>
what
<charliesome>
haha
<charliesome>
pretty obscure
<ryanf>
wow, that is quite a function
setmeaway has quit [Read error: Connection reset by peer]
setmeaway2 has joined #ruby-lang
facest has quit [Ping timeout: 265 seconds]
MrWGW- has joined #ruby-lang
<MrWGW->
hey there
<MrWGW->
is there an easy way to pipe the contents of an array into more, and then when more exits have control return to your program?
<MrWGW->
I can't do myprogram | more from the shell, because when more was finished in that manner, control would return to shell, and I want it to just return to my program
<MrWGW->
and I want to control the output, i.e. just output a specific array
<Paradox>
MrWGW-, i believe pry does something similar with less
<MrWGW->
because I'm targeting this app for embedded busybox systems
<MrWGW->
which generally have more, but not less
<ryanf>
how ironic
<MrWGW->
also for that reason, I'm trying to avoid any external rubygems
<MrWGW->
so that all that's needed in the embedded image is just a barebones ruby interpreter
<MrWGW->
I'm specifically writing this program to scratch my own itch by the way
<ddfreyne>
I need to process a multi-GB file in Ruby, kB per kB. How would I go on doing that? My GC starts thrashing…
<MrWGW->
its a line oriented text editor kind of like ed
<MrWGW->
I have these busybox appliances that have ruby for their web UI, but no ed
<MrWGW->
so I'm exploiting it by writing a text editor for them
<MrWGW->
but I figure there are other similiar systems where it might be applicable
<ryanf>
that's funny. what is the web ui written in?
<MrWGW->
for example, Mandriva Linux historically omitted ed from their single-CD distro, and I would assume Mageia is the same way
<MrWGW->
ryanf: the web UI is written in vanilla ruby with a custom, poorly implemented webserver
<MrWGW->
its complete crap
<ryanf>
nice
<MrWGW->
these are shitty Asian-made network managmenet appliances from an obscure vendor
<ryanf>
do they build it on TCPServer or something?
<ryanf>
or even lower-level than that?
<MrWGW->
but they're cheap and I've repurposed them into DNS servers
<MrWGW->
for my branch offices
<MrWGW->
ryanf: think of it as being like netcat, only in ruby
gsav has quit [Ping timeout: 276 seconds]
emocakes has joined #ruby-lang
<MrWGW->
so ryanf, looking at the above method call you posted
<MrWGW->
would that work with more in lieu of less, and the various less-specific arugments omitted?
<Paradox>
should
<MrWGW->
IO.popen("more") { |io| io.write @text }
<ryanf>
I'm sure it can be made to work. you probably want to look at less's manpage to make sure none of those arguments are doing things you care about
<ryanf>
I think it's probably mostly stuff related to color escapes
<MrWGW->
more by default does what I want, in its default mode of execution
<MrWGW->
also more doesn't mess with color escapes
<MrWGW->
if its fed text containing them, it preserves them
<MrWGW->
whereas less by default doesn't IIRC
<MrWGW->
oh btw fun fact, one guy wrote a fairly popular less alternative called most, which I've played with
<ryanf>
yeah, I actually just switched from most back to less
<Paradox>
-F terminates if the contents can be shown on one screen
<Paradox>
and just echos it
<Paradox>
-R doesnt escape ansii color codes
<Paradox>
-S chops long lines
<Paradox>
-X disables termcap init and deinit
<Paradox>
less always did what i wanted
<Paradox>
so i've never felt the need to switch
<Paradox>
unlike tmux or zsh
<Paradox>
which fix flaws in screen and bash
<MrWGW->
more automatically terminates if th econtents can be shown on one screen
<MrWGW->
more is really very nice; its only downside is it doesn't allow backscrolling
<Paradox>
replace @text with something that turns your array to a string
<Paradox>
probably want to use join
<Paradox>
but to_s works too
<MrWGW->
ok
<MrWGW->
hmm for some reason, it just hangs if I go IO.popen("more") { |io| io.write text.to_s }
<MrWGW->
note that i'm in irb
<MrWGW->
all I did was create a dummy array called text, manually, via text = [ '1','2','3' ]
<MrWGW->
and then entered in that line
<MrWGW->
I figured I'd test this out in irb before attempting to bolt it into my program
<Paradox>
you need 'w'
<Paradox>
IO.popen("less", 'w')
<MrWGW->
success
<MrWGW->
so by the way, one amusing thing/annoyance
<MrWGW->
these devices have /sbin set with 0777 permissions for some reason
<MrWGW->
I fear to change it, lest I brick them
<MrWGW->
but ruby complaints about it every time I run the program
<MrWGW->
with some justification
<MrWGW->
but is there any way I can suppress that?
<MrWGW->
if it was for any reason other than the demented nature of these nasty little appliances, rest assured tha tI would not
leopard_me has joined #ruby-lang
<emocakes>
omg
<emocakes>
kim and kanye!!
<emocakes>
isn't that like, so cray?
adambeynon has joined #ruby-lang
solars has joined #ruby-lang
<Paradox>
ruby doesnt make very good turkey sandwiches
<Paradox>
they're too dry
jxie has quit [Quit: leaving]
marr has joined #ruby-lang
<MrWGW->
so it works, somewhat
<MrWGW->
the only problem is that its not passing the /n characters to more i na fashion more can understand
<MrWGW->
I suspect this is a problem wit hthe .to_s
drbrain has joined #ruby-lang
drbrain has quit [Ping timeout: 265 seconds]
Elico1 has joined #ruby-lang
dkannan has quit [Quit: dkannan]
Nisstyre-laptop has quit [Quit: Leaving]
Nisstyre-laptop has joined #ruby-lang
MrWGW- has quit [Quit: "Great Scot, you're right, it IS a sea serpent!"]
rindolf has joined #ruby-lang
jbsan has quit [Quit: jbsan]
<rindolf>
Hi all. Is there anything like http://wiki.cpantesters.org/ - CPAN smoke testers, where they test new uploads to the CPAN repository on many systems to see if the tests pass - only for Ruby gems?
jonahR has quit [Quit: jonahR]
<rindolf>
Happy new year too.
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
ttilley has joined #ruby-lang
unsymbol has joined #ruby-lang
unsymbol has joined #ruby-lang
unsymbol has quit [Changing host]
Caius has joined #ruby-lang
tbuehlmann has joined #ruby-lang
DefV has quit [Quit: leaving]
Jan_ has joined #ruby-lang
Jan_ is now known as Guest39927
Guest39927 is now known as DefV
m3nd3s has joined #ruby-lang
Nisstyre-laptop has quit [Quit: Leaving]
vlad_starkov has joined #ruby-lang
<injekt>
rindolf: there was test.rubygems.org but it looks like it's down
<rindolf>
injekt: ah, sucks.
<rindolf>
injekt: thanks for your reply.
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
rebelcan has quit [Ping timeout: 244 seconds]
m3nd3s has quit []
m3nd3s has joined #ruby-lang
msch has joined #ruby-lang
Glass_saga has joined #ruby-lang
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
gnufied1 has quit [Quit: Leaving.]
io_syl has quit [Quit: Computer has gone to sleep.]
<zzak>
rindolf: freezing, decided to go for a jog this morning at 10F.. you?
<rindolf>
zzak: it's not so cold here.
<rindolf>
zzak: but I live in Tel Aviv.
<zzak>
oh, cool!
<rindolf>
zzak: I've been working on http://vim.begin-site.org/ - I think I'll create pages for editing files of different types (XML , C, Ruby, Perl, Lisp, Scheme, Python etc.)
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
davidbalber|away is now known as davidbalbert
<zzak>
nice
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
meatballhat has joined #ruby-lang
meatballhat has joined #ruby-lang
meatballhat has quit [Changing host]
vlad_starkov has joined #ruby-lang
matip has joined #ruby-lang
__BigO__ has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
__BigO__ has quit [Remote host closed the connection]
<yfeldblum>
llaskin, @my_ivar is an instance var; @@my_ivar is not
briantrust has joined #ruby-lang
<kurko_>
Guys, I have a segfault that's 3000+ lines long. I can't copy the stacktrace because my terminal won't scroll that far (I have to research on this ) and using > and &> file won't output the trace to a file.
<kurko_>
The failures happens on bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile &> segfault.txt
<kurko_>
is there a ruby log somewhere with this segfault stack trace?
<yfeldblum>
kurko_, segfaults are probably printed to stderr, which is FD 2
wyhaines has quit [Remote host closed the connection]
<llaskin>
yfeldblum: so given this new gist: https://gist.github.com/e79fbcb5f45ae7b6b6ac which method1 definition will line 26 call? Or do method names have to be unique between classes?
<Ridders24>
is it possible to write a script that expands all tweets and then saves the webpage?
mistym has quit [Remote host closed the connection]
<yfeldblum>
llaskin, the one declared in B
sailias has quit [Quit: Leaving.]
<darix>
Ridders24: it would be much more useful to use the twitter API for that.
<llaskin>
yfeldblum: why does B take precedence? Is the only solution to this to have unique method names?
<darix>
there are various gems and tools to work with it.
<Ridders24>
darix: yh already done that, and have a script that dumps out the time line, but I also wanted to see if it could be possible to save the html page with exactly how it looks