<finch>
Hey folks, quick question - if I have a class defined like class Sub < Super; def self.foo; end; end and I want to invoke Super.foo from Sub.foo, what's the best way to do this?
<finch>
That is, how should inheritance work with class level methods?
dagobah_ has joined #ruby
<eph3meral>
just call super
<eph3meral>
you don't need anything special
<eph3meral>
finch, when you call super, it will call, the method, of the same name as the one you're in, but on the parent class
<finch>
You're kidding. If it's that simple I will be both thrilled and humiliated because FUCK YEAH RUBY but I sould have tested it myself
<finch>
I assumed it would only operate on the instance level methods
<eph3meral>
oh, well hmm, yeah I guess I don't know for 100% sure
<eph3meral>
re: class methods
<eph3meral>
but, I would imagine it works the same
<finch>
yeah, that gets a bit weird. Might as well test, but nothing sounds too insane about my plan, right?
<eph3meral>
although, if it's a class method, essentially, you can call MyParentClassName.foo
<eph3meral>
finch, lol, actually I don't know what your "plan" is, give us a pastebin with a test scenario
<eph3meral>
that is a good question though, whether super works on class methods, I've never had a real need to use that
<eph3meral>
finch, that's not a test case, that's domain specific application code
<finch>
Straight up copy/paste, but I would rather use something akin to super instead of hardcoding another class name. Not sure if it's justified, but something itches at me by doing Parent.foo
<eph3meral>
finch, yeah testcase != "straight up copy and paste"
<eph3meral>
at least not 99% of the time
<finch>
Erm, pardon, you're meaning like a unit test as opposed to an implementation
<finch>
correct?
<eph3meral>
finch, i'm saying I'm too lazy to decipher your code :P
<eph3meral>
finch, I'm saying make a test case, a generic one
liluo has quit [Remote host closed the connection]
peterhil` has joined #ruby
jeff_sebring has quit [Remote host closed the connection]
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
baroquebobcat has joined #ruby
igotnolegs has joined #ruby
ZachBeta has joined #ruby
jeff_sebring has joined #ruby
sbanwart has joined #ruby
wallerdev has quit [Quit: wallerdev]
<eph3meral>
is there a way to concurrently map/each/iterate two arrays side by side?
<eph3meral>
like if I had an array of keys, and an array of values
<eph3meral>
and the indexes of one array correspond to the items in another
<eph3meral>
I mean, like a "functional" way to do this, ideally without using, e.g. counters or indexes
<eph3meral>
i have a list of inputs, and a list of multipliers
<eph3meral>
well, no actually I have a list of objects, and then I have a list of multipliers, each multiplier needs to be assigned to the object with the same/corresponding index
micsha has joined #ruby
looopy has quit [Remote host closed the connection]
baroquebobcat has quit [Quit: baroquebobcat]
<micsha>
Does anyone know if it's possible for the core ruby (1.9.3) language to work with, i.e. manipulate and/or write, raw binary data?
jeff_sebring has quit [Remote host closed the connection]
<eph3meral>
micsha, sure
<micsha>
ok, how?
<eph3meral>
micsha, what do you want to do to it? ruby has bitwise operators, Files I believe can also be opened in binary
<micsha>
I need to receive a binary blob of data from a tcp stream and process the data as a binary blob and write it to a file
<akem>
you need 2 plugins for that, one for the 0 and the other for the 1 (:
looopy has joined #ruby
<micsha>
thus far, ruby has been nothing but a nightmare to try to solve this problem due to it's almost arbitrary data type changes and restrictions
<eph3meral>
micsha, too bad for you, ruby's been a dream come true for me - well, with the exception of many of the inhabitants of this channel :P
<eph3meral>
micsha, I manipulate binary with ruby, not from a TCP stream, but still, ruby has pretty decent binary manipulation features
<micsha>
I'm seriously trying to like ruby but right now the only thing I feel when I code ruby is rage
<micsha>
well, I need to entirely cut parts of the binary blob out, reading it into an array can't do that for me, dropping parts of the binary blob and writing others causes problems.
liluo has joined #ruby
baniseterfiend` has joined #ruby
stephenjudkins has quit [Read error: Connection reset by peer]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
phantasm66 has quit [Quit: *poof*]
mikepack has quit [Remote host closed the connection]
ten00 has joined #ruby
Banistergalaxy has quit [Ping timeout: 244 seconds]
ten00 has left #ruby [#ruby]
gmci has quit [Read error: Connection reset by peer]
olrrai has joined #ruby
jenrzzz-mac has joined #ruby
Banistergalaxy has joined #ruby
D4rkM4s73r777 has quit [Remote host closed the connection]
ciopte7 has quit [Quit: ciopte7]
micsha has left #ruby [#ruby]
gmci has joined #ruby
ciopte7 has joined #ruby
stephenjudkins has joined #ruby
jenrzzz-mac has quit [Client Quit]
ciopte7 has quit [Client Quit]
Banistergalaxy has quit [Ping timeout: 256 seconds]
carloslopes has quit [Quit: Leaving]
jenrzzz-mac has joined #ruby
jenrzzz-mac has quit [Read error: Connection reset by peer]
jeff_sebring has quit [Remote host closed the connection]
jenrzzz-mac has joined #ruby
noganex has quit [Quit: Eagles may fly, but a weasel will never be sucked into a jet engine.]
graspee has quit [Quit: too late!]
replore_ has joined #ruby
<Synthead>
Thought I would share something I just wrote :) This script controls those USB dart launchers with libusb, enjoy http://codepad.org/v9h3ziYw
hemanth__ has quit [Read error: Connection reset by peer]
hemanth__ has joined #ruby
hashset has quit [Remote host closed the connection]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
chessguy has quit [Remote host closed the connection]
hashset has joined #ruby
Juul has quit [Ping timeout: 245 seconds]
rizzylt has quit [Ping timeout: 244 seconds]
jenrzzz-mac has joined #ruby
seanstickle has quit [Quit: seanstickle]
mrdtt has joined #ruby
wallerdev has joined #ruby
minijupe has quit [Quit: minijupe]
adeponte has joined #ruby
macgregor_ has joined #ruby
shtirlic has quit [Read error: Connection reset by peer]
shtirlic has joined #ruby
iori has joined #ruby
adeponte has quit [Remote host closed the connection]
yoklov has quit [Quit: bye!]
<eph3meral>
ok, is it just me, or is this an anomaly/bug?
gloomer has quit [Ping timeout: 260 seconds]
ten00 has joined #ruby
gloomer has joined #ruby
Dreamer3 has quit [Quit: Leaving...]
<eph3meral>
oh, wait
ten00 has left #ruby [#ruby]
<eph3meral>
er, wait, nope it was just my pebcak :P
<baniseterfiend`>
eph3meral: what's a pegcak
Hanmac1 has joined #ruby
Hanmac has quit [Ping timeout: 245 seconds]
jimeh has quit [Ping timeout: 245 seconds]
<Synthead>
baniseterfiend`: problem exists between computer and keyboard
sleetdrop has joined #ruby
<baniseterfiend`>
Synthead: oh ok th
<Synthead>
baniseterfiend`: or, problem exists between chair and keyboard, rather
shevy2 has joined #ruby
<Synthead>
baniseterfiend`: hah. same as an id-ten-t error
sleetdrop has quit [Read error: Connection reset by peer]
Tricks has quit [Ping timeout: 244 seconds]
friskd has quit [Quit: friskd]
Tricks has joined #ruby
yonggu has joined #ruby
yonggu has quit [Remote host closed the connection]
shtirlic_ has joined #ruby
yonggu has joined #ruby
kah_ has quit [Remote host closed the connection]
MrGando has joined #ruby
looopy has quit [Remote host closed the connection]
Tricks_ has joined #ruby
shtirlic has quit [Ping timeout: 244 seconds]
ciopte7 has joined #ruby
Tricks has quit [Ping timeout: 244 seconds]
dbgster has joined #ruby
jenrzzz-mac has quit [Quit: jenrzzz-mac]
yonggu_ has joined #ruby
ken_barber1 has joined #ruby
cj3kim has joined #ruby
Tricks_ has quit [Read error: Connection reset by peer]
<MrGando>
hey guys, I've been using ruby for a while now, but I feel like I'm just scratching the language surface... I never followed a book on thesubject. Could anyone recommend a good book?
ken_barber has quit [Ping timeout: 240 seconds]
<deryl>
The Well Grounded Rubyists and work it end to end
<offby1>
and simulating macros with eval "some_#{thing}"
moosya has joined #ruby
<GeekOnCoffee>
I'm reading through metaprogramming ruby right now, it's great
<offby1>
yeah, but you're a geek, and you're on coffee.
<offby1>
in #git there's a frog, on wheels.
wvdschel has joined #ruby
Bosma has quit [Ping timeout: 244 seconds]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
* Enekoos
se despide
Enekoos has quit [Remote host closed the connection]
seanstickle has joined #ruby
palmfrond has quit [Read error: Connection reset by peer]
sspiff has quit [Ping timeout: 260 seconds]
jenrzzz-mac has joined #ruby
<baniseterfiend`>
offby1: no it's not
<baniseterfiend`>
offby1: metaprogramming in ruby is hardly ever about eval
<baniseterfiend`>
offby1: eval is a last resort and easily avoided in 99% cases
<offby1>
huh
<offby1>
as is the case in Lisp-land
walterheck has joined #ruby
<seanstickle>
And not the case in Python land
<baniseterfiend`>
offby1: most metaprogramming stuff can be achived with: define_method, instance_eval, class_eval (these are not string-based evals), method_missing, and so on
<seanstickle>
metaprogramming in Python is the suck
<seanstickle>
Enjoy the beauty of Ruby!
<eph3meral>
offby1, send
<offby1>
eph3meral, receive
<offby1>
baniseterfiend`: so how many variants of your nick do you use? Or do you just randomly change 'em as the impulse strikes you?
<baniseterfiend`>
offby1: pry uses eval though, but the more exotic Binding#eval variant, u like it
itnomad_ has joined #ruby
<baniseterfiend`>
offby1: i connect via about 4 differnet machines, so whichever one i am on that needs to join registered chans uses the canonical nick, other connections get changed to random variants
ipoval has joined #ruby
<offby1>
*gasp* you don't use screen! tsk tsk tsk
* offby1
waggles a finger
itnomad_ has quit [Client Quit]
<baniseterfiend`>
offby1: why dont you use tmux
itnomad has quit [Quit: Leaving]
palmfrond has joined #ruby
<offby1>
not enough better than screen to warrant the effort it'd take to learn
Limb has joined #ruby
frishi has joined #ruby
itnomad has joined #ruby
sbanwart has quit [Ping timeout: 245 seconds]
emmanuelux has quit [Ping timeout: 264 seconds]
<baniseterfiend`>
offby1: did u know that the ruby stack frame can be accessed as an object
<offby1>
I suspected.
<offby1>
I've meant to poke around inside "caller"
<offby1>
and "binding"
<baniseterfiend`>
offby1: no, caller is nothing
<baniseterfiend`>
caller is just a backtrace
<baniseterfiend`>
yeah, binding is the dude
<baniseterfiend`>
offby1: so u can save a stackframe whenever u want, and introspect on it later
<baniseterfiend`>
it's pretty powerful
<baniseterfiend`>
offby1: in fact that's what pry is, pry just allows interactive introspection of stack frames
stefanp_ has joined #ruby
<baniseterfiend`>
any stack frame at all, u can capture then with a call to 'binding'
<offby1>
I was rendering some stuff using ERB, and I realized that I wanted every "nil" value to render as "N.A." (rather than the default, which is the empty string). I considered adding a to_s method on the nil object, but that seemed too horrible. Then I considered somehow whopping the bindings, to insert such a method (the advantage being that my to_s method would have no effect outside of the call to ERB). But I couldn't figure out how
<offby1>
to do it; "binding" seems to have no API.
foo-bar- has joined #ruby
<baniseterfiend`>
and then just invoke pry on that binding at your leisure to see what thwas going on in that frame at the time
foo-bar- has quit [Remote host closed the connection]
<baniseterfiend`>
offby1: it doesn't, u just eval() in the context of the binding to find out what u want
<baniseterfiend`>
offby1: an API would be too limiting :P 'eval' gives you access to absolutely everything
<offby1>
hmm
<offby1>
food for thought indeed.
<baniseterfiend`>
offby1: in fact, if u call 'binding' on the callers of a method then u can interactively walk up and down the entire call stack
<baniseterfiend`>
well, i have about 2 or 3 users anyway
foo-bar-_ has quit [Ping timeout: 244 seconds]
tty0pts has quit [Ping timeout: 240 seconds]
stefanp has quit [Ping timeout: 265 seconds]
stephenjudkins has quit [Quit: stephenjudkins]
ZachBeta has quit [Read error: Connection reset by peer]
wvdschel has quit [Ping timeout: 260 seconds]
ZachBeta has joined #ruby
frishi has quit [Quit: Leaving...]
ZeroModulus_ is now known as ZeroModulus
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
<[Neurotic]>
hey guys - pretty new to Ruby (coming from JVM based langauges) so the whole 'Gem' think is messing with my head. Question is - say I want to connect to mysql to do some basic SQL queries. I see I can do a 'gem install mysql' - then how do I deploy this? (it's just a process that will be called via cron most likely) - do I make a rake file to install the required gems? how does that work?
<[Neurotic]>
Sorry - I should say, i write my code to do the SQL with the mySQL gem - how them do I deploy this? I can deploy the code up to my machine, but how does the gem get there? do I need to manually install that as well?
Bosma has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
looopy has quit [Remote host closed the connection]
azm has joined #ruby
azm has quit [Changing host]
azm has joined #ruby
looopy has joined #ruby
codezombie has joined #ruby
<seanstickle>
[Neurotic]: it's like a jar file.
<seanstickle>
[Neurotic]: deployment is not undifferent
<seanstickle>
But somewhat similar
<[Neurotic]>
but with a .jar file I can just copy it
<[Neurotic]>
From my reading - seems like people use Bundler to define gem dependencies
<[Neurotic]>
and that automates much of the process?
<[Neurotic]>
and that will install / update control which gems are installed?
<[Neurotic]>
Would that be correct?
<seanstickle>
Bundler is a popular way, yes.
<seanstickle>
You still need to run "bundle" on the target server
minijupe has joined #ruby
<[Neurotic]>
yah, that makes sense
cj3kim has joined #ruby
<[Neurotic]>
I assume the other way would be with Rake or some other tool?
bradhe_ has joined #ruby
Banistergalaxy has joined #ruby
bradhe has quit [Ping timeout: 248 seconds]
vitoravelino is now known as vitoravelino`afk
DesiJat has joined #ruby
Tricks_ has joined #ruby
Tricks has quit [Read error: Connection reset by peer]
nilg` has joined #ruby
bradhe has joined #ruby
bradhe_ has quit [Ping timeout: 244 seconds]
Juul has quit [Read error: Operation timed out]
bradhe_ has joined #ruby
kstephens has quit [Quit: PredictTheFuture]
bradhe has quit [Ping timeout: 265 seconds]
emdub has quit [Quit: new kernel]
seanstickle has quit [Quit: Nihil sub sole novum]
AlbireoX`Laptop has joined #ruby
emdub has joined #ruby
<[Neurotic]>
So correct me if I'm wrong (please) - but for deployment, i could just use a gemspec and bundle up my code in a gem, and all should be well in the world. However, for doing development and passing code around to other developers, Bundler makes life easier, because it allows other devs to just do 'bundle install' and they are up and moving - whereas they would have to do manual gem installation to get up and running with just a gemspec, yes?
azm has quit [Ping timeout: 248 seconds]
kstephens has joined #ruby
ZachBeta has quit [Quit: Computer has gone to sleep.]
fayimora has quit [Quit: Busy…..zzzzz]
Targen has joined #ruby
fayimora has joined #ruby
eywu has quit [Quit: Leaving.]
emdub has quit [Quit: .]
emdub has joined #ruby
khakimov has joined #ruby
dbgster has quit [Quit: dbgster]
davidokner has joined #ruby
davidokner has left #ruby [#ruby]
AlbireoX`Laptop has quit [Ping timeout: 245 seconds]
maletor has joined #ruby
hemanth__ has quit [Read error: Connection reset by peer]
hemanth__ has joined #ruby
Markvilla has quit [Quit: Markvilla]
gloomer has quit []
nowthatsamatt has joined #ruby
nowthatsamatt has left #ruby [#ruby]
<eph3meral>
[Neurotic], bundler
savage- has joined #ruby
<eph3meral>
[Neurotic], all you need to do for any project, is you add a file called Gemfile to your project root folder, run `bundle install` on the command line and then add: require 'bundler/setup' to your app at some point
yonggu_ has quit [Remote host closed the connection]
yonggu has joined #ruby
<[Neurotic]>
eph3meral, thanks. That looks like what I am starting to do here. Bundler looks like it should make it easy. I don't see a reference to needing 'bundler/setup' though, I will look that up
<[Neurotic]>
eph3meral, oh I see it!
<eph3meral>
[Neurotic], one nice thing about the Gemfile, is you can tell it to pull the gems from various places other than a standard packaged/distributed gem from rubygems.org
<eph3meral>
[Neurotic], i.e. you could point it at your own git repo on a private server
<eph3meral>
[Neurotic], where you've written a gem
<[Neurotic]>
ah that is nice
<eph3meral>
[Neurotic], or you could point it to a location on disk
<eph3meral>
where you have a gem that you're writing
<eph3meral>
[Neurotic], look in to the :path => "", and :git => "" options in gemfile
<eph3meral>
Gemfile (capitalization matters)
<eph3meral>
[Neurotic], if you come from the JVM world you should check out jruby and rbj
<eph3meral>
blerp... rjb
<[Neurotic]>
yah, I did a bundle gem projectname to get a basic skeleton happening
<[Neurotic]>
eph3meral, yeah, we are running jruby for exactly that reason
<eph3meral>
ah, ok cool
<eph3meral>
yeah, so you probably are aware, you can only run pure-ruby gems
<eph3meral>
as in, no C based extensions
<eph3meral>
if that's the reason you're using it though, i doubt you'll come across that as being a problem :)
<[Neurotic]>
aah - good point. That will influence how I do this mysql stuff
<[Neurotic]>
I think the default mysql driver is c based
<eph3meral>
[Neurotic], yeah you basically have to do that with jdbc
<eph3meral>
[Neurotic], yeah it is
<eph3meral>
postgres as well
<[Neurotic]>
whereas there is a pure ruby version, so I'll use that one instead
<[Neurotic]>
good point - thanks for the heads up
<eph3meral>
oh really? hmm, i didn't know there was a "pure ruby" mysql gem?
<[Neurotic]>
(sorry - trail of thoughts flowing out my head)
<[Neurotic]>
Thanks for your help eph3meral
frishi has joined #ruby
frishi has quit [Client Quit]
elico has quit [Read error: Connection reset by peer]
Guest1343 has quit [Quit: Leaving]
hemanth__ is now known as hemanth
elico has joined #ruby
nlc has quit [Remote host closed the connection]
elico has quit [Read error: Connection reset by peer]
elico has joined #ruby
elico has quit [Client Quit]
elico has joined #ruby
<eph3meral>
[Neurotic], well
<eph3meral>
[Neurotic], to be sure, you could just download the one from the mysql site
<eph3meral>
[Neurotic], if it comes packaged as a .gem already, you can just: gem install special-mysql-1.2.3.gem
<eph3meral>
[Neurotic], then subsequently, it will be available for bundler to use when you do require 'bundler/setup'; require 'mysql'
elico has quit [Read error: Connection reset by peer]
<eph3meral>
[Neurotic], or, similarly, if you have the source for that mysql distribute pure native gem, then you could just point your gem file to where you downloaded and extracted the source, such as :path => "~/Downloads/ruby-mysql/"
trend has quit [Disconnected by services]
vitor-br has quit [Quit: Saindo]
<[Neurotic]>
from the page - I can just do: 'gem install ruby-mysql' so couldn't I just include it in my Gemfile as 'gem ruby-mysql' ?
hemanth has quit [Read error: Connection reset by peer]
roolo has joined #ruby
mockra_ has quit [Remote host closed the connection]
<cek>
Nitrodist, i guess it manipulates Exception#backtrace somewhere
hemanth has joined #ruby
<Nitrodist>
got it
akem has joined #ruby
akem has joined #ruby
akem has quit [Changing host]
<Nitrodist>
updated rspec :)
Banistergalaxy has joined #ruby
<cek>
to java?
berserkr has joined #ruby
tatsuya_o has joined #ruby
<Nitrodist>
cek: no, then I would say I updated to JMock :P
<cek>
Exception#set_backtrace, too.
<Hanmac>
i would never use jruby for my projects :P
<cek>
it has thread implementation backed by years of enterprise usage
<cek>
and a garbage collection policy that's enterprise ready, too
user__ has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby
davidcelis has joined #ruby
binaryplease has quit [Quit: WeeChat 0.3.8]
schickung has joined #ruby
nipra has quit [Ping timeout: 244 seconds]
urbann has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 240 seconds]
schickung has quit [Read error: Connection reset by peer]
dhruvasagar has joined #ruby
jeff_sebring has joined #ruby
schickung has joined #ruby
schickung has quit [Client Quit]
d3c has quit [Quit: Quit]
cyong has quit [Quit: Leaving.]
ephemerian has joined #ruby
workmad3 has quit [Ping timeout: 260 seconds]
a_a_g has joined #ruby
yannis has joined #ruby
iori has joined #ruby
Guest20110 has joined #ruby
bambanx_ has quit [Read error: Connection reset by peer]
bambanx_ has joined #ruby
akem has quit [Read error: Connection timed out]
arturaz has joined #ruby
nipra has joined #ruby
kjellski has joined #ruby
iori has quit [Ping timeout: 245 seconds]
demian`_ has quit [Quit: demian`_]
<chaotic_good>
enterprise lol
<chaotic_good>
enterprise = sucks so bad we gota try n intimidate wit titles
<chaotic_good>
bsd or linux far better than solaris
<chaotic_good>
postgresql replaces oracle
<chaotic_good>
done
<bnagy>
linux better than solaris?
<bnagy>
XD
<bnagy>
you fuuuny
<chaotic_good>
far far better
<chaotic_good>
zfs who needs it?
<chaotic_good>
softraid and reiser
<chaotic_good>
zfs eats all your ram so your app gets nuked
<chaotic_good>
for 3% better performance?
<chaotic_good>
bleh
<chaotic_good>
dedup means your arent using db or mogileFS right
<chaotic_good>
linux has openvz and lxp zones
<chaotic_good>
hek virtualization is a fraud anyhow
<chaotic_good>
jsut like SAN
<chaotic_good>
softraid and let app multitask or GASP fork
<chaotic_good>
the whole continuations thing helps there
borkman has joined #ruby
<bnagy>
is it warm on your planet?
<chaotic_good>
but I am off on a rant
<chaotic_good>
ok I stop
<bambanx_>
hey bnagy
<chaotic_good>
earth yes
<chaotic_good>
los angeles
<chaotic_good>
prime material plane
<bambanx_>
guys i have a class with two methods , in one method i declare a variable but this variable i need use in other method, how i can scope this variable to my oother method? using a class variable like this @@myvariable ?
<matled>
banisterfiend: when using pry the inspect takes very long sometimes. it would be nice if there would be a message while the pretty print is computed (e.g. "Preparing inspect, ^C to abort.") or even if it would be possible to start printing before the processing is complete. what do you think about that?
<bnagy>
bambanx_: @@classvars are never correct, ever
gokul has joined #ruby
<chaotic_good>
Solaris/x86 is a joke, last I heard. (It has) very little support for any kind of strange hardware. If you thought Linux had issues with driver availability for some things, let's see you try Solaris/x86. (Editors' note: Drivers enable an operating system to communicate with specific hardware such as a video card or network adapter.)
<bambanx_>
i know bnagy
<chaotic_good>
-linus torvalds
<bambanx_>
bnagy, what i can do?
<bambanx_>
make instance a object and declare it like a object variable? bnagy
<chaotic_good>
is there a mogileFS in ruby?
<bnagy>
bambanx_: if they're both instance methods ('normal' class methods) then just an @ivar will work
<bambanx_>
i am using class methods bnagy
Shahor has joined #ruby
Shahor has quit [Client Quit]
Shahor has joined #ruby
<bnagy>
why? :)
<bnagy>
anyway, then use class ivars
<bambanx_>
i dont know ivars class
iori has joined #ruby
<baniseterfiend`>
matled: we just use pretty_inspect currently; but we could consider customizing it to add features like that, cool. Can you file an issue?
pygospa has quit [Disconnected by services]
jamesaxl has quit [Ping timeout: 265 seconds]
pygospa has joined #ruby
<matled>
baniseterfiend`: yeah, I'll do that later. at least adding the message would be nice (i.e. print it and then use kill line to remove it), sometimes I'm not sure if I abort the code I entered or the inspect
Prz has joined #ruby
<baniseterfiend`>
matled: sure thing
ramblex has joined #ruby
<_br_>
Anyone have an idea why when I trap a kill signal and even define a objectspace finalizer to kill a child process before the parent object gets killed, doesn't kill it?
<bambanx_>
nn guys
bambanx_ has quit [Quit: Saliendo]
<Hanmac>
_br_ maybe you need the other the term signal?
MrGando has quit [Read error: Connection reset by peer]
Shrink has quit [Ping timeout: 252 seconds]
<Hanmac>
i never used finalizer in ruby itself, because i can not trust them
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
Paradox has joined #ruby
Ammar01 has joined #ruby
<_br_>
Hanmac: I thought so too, but doesn't do either... hmpf.
wvdschel has quit [Ping timeout: 260 seconds]
<Paradox>
im having a problem installing termios
<_br_>
Hanmac: Yes, it seems you were right to not trust them :|
kjellski has quit [Quit: This computer has gone to sleep]
<bnagy>
and other hilarities, such as 'virtualization is a fraud, so is SAN'
Shrink has joined #ruby
<bnagy>
hahah yay screen
chaotic_good has quit [Remote host closed the connection]
<baniseterfiend`>
bnagy: i trust your opinion on such matters, your nerdiness seems focussed in those areas
<corenumb>
anyone ?
<_br_>
corenumb: simple, if you call it that way the path is not setup for you I assume. Also, this is case sensitive. Substitute "RUBY" with e.g. "/usr/bin/ruby"
<bnagy>
corenumb: because you didn't initialize the constant?
<_br_>
corenumb: don't forget the quotation marks
ramblex has quit [Quit: ramblex]
<bnagy>
I'd imagine you'll get another error for THIS_FILE, once you fix the first one
Prz has quit [Remote host closed the connection]
vlad_starkov has joined #ruby
qwerxy has joined #ruby
<_br_>
corenumb: possible you want to use the ENV[""] hash to find the right path to your ruby interpreter...
iori has quit [Ping timeout: 245 seconds]
pawdro has joined #ruby
dhruvasagar has quit [Ping timeout: 252 seconds]
dhruvasagar has joined #ruby
lilin has quit [Ping timeout: 244 seconds]
heftig has quit [Quit: leaving]
tatsuya_o has quit [Read error: Connection reset by peer]
tatsuya_o has joined #ruby
Boohbah has quit [Remote host closed the connection]
Boohbah has joined #ruby
dcorbin has quit [Quit: This computer has gone to sleep]
foofoobar has joined #ruby
cheater_ has joined #ruby
nfk has joined #ruby
cheater has quit [Ping timeout: 260 seconds]
flype has joined #ruby
snearch has quit [Quit: Verlassend]
corenumb has left #ruby ["Leaving"]
gcds has joined #ruby
<gcds>
Hello
zz_chrismcg is now known as chrismcg
schickung has joined #ruby
<gcds>
I have very silly question :D Now I am working with 10,000 records and need somehow to keep them now I am working with hash based storage but its really messy… I thinking how major of gems and stuff in ruby returns something like <Item #23213123213 name="aaaa" … >
<gcds>
how to make something like this? :D
mneorr has quit [Read error: Connection reset by peer]
prtksxna has quit [Remote host closed the connection]
cantonic_ has joined #ruby
banisterfiend has quit [Remote host closed the connection]
cantonic has quit [Ping timeout: 245 seconds]
cantonic_ is now known as cantonic
tdubz has joined #ruby
tdubz has quit [Client Quit]
Criztian_ has joined #ruby
Criztian has quit [Read error: Connection reset by peer]
dhruvasagar has quit [Ping timeout: 245 seconds]
schaerli has joined #ruby
tdubz has joined #ruby
dhruvasagar has joined #ruby
tdubz is now known as tdubellz
mdstunthamster has joined #ruby
pradeepto has quit [Quit: No Ping reply in 180 seconds.]
pradeepto has joined #ruby
<_br_>
gcds: Not sure I understand what you want. Do you mean, building an Abstract Data Type (ADT)? e.g. like you show there, create a ... class Item ; attr_accessor :name, :id ; end ; storage = []; 10000.times { storage << Item.new( ...); }
ciopte7 has quit [Quit: ciopte7]
federic has joined #ruby
schovi has quit [Remote host closed the connection]
pedrocarrico has joined #ruby
Foxandxss has joined #ruby
mikekelly has quit [Ping timeout: 252 seconds]
si14 has quit [Read error: Operation timed out]
jrgifford has quit [Read error: Operation timed out]
DavidTiger has quit [Read error: Operation timed out]
amar_key has quit [Read error: Operation timed out]
aquaranto has quit [Read error: Operation timed out]
ramblex has joined #ruby
jhowarth has quit [Ping timeout: 246 seconds]
moeSeth has quit [Ping timeout: 244 seconds]
ctevie has quit [Ping timeout: 245 seconds]
dekz has quit [Ping timeout: 240 seconds]
lectrick has quit [Ping timeout: 252 seconds]
_marvin has quit [Ping timeout: 260 seconds]
randym has quit [Ping timeout: 260 seconds]
kapowaz has quit [Ping timeout: 260 seconds]
denysonique has quit [Ping timeout: 245 seconds]
cesario has quit [Ping timeout: 245 seconds]
NimeshNeema has quit [Ping timeout: 245 seconds]
ziyadb has quit [Ping timeout: 245 seconds]
pooja has quit [Ping timeout: 244 seconds]
BrianE has quit [Ping timeout: 252 seconds]
Spaceghostc2c has quit [Ping timeout: 245 seconds]
SeanTAllen has quit [Ping timeout: 244 seconds]
relix has quit [Ping timeout: 260 seconds]
Dr4g has quit [Ping timeout: 260 seconds]
MetaCosm has quit [Ping timeout: 260 seconds]
avandendorpe has quit [Ping timeout: 260 seconds]
d3vic3 has quit [Ping timeout: 252 seconds]
mikekelly has joined #ruby
schovi has joined #ruby
dhruvasagar has quit [Ping timeout: 244 seconds]
d3vic3 has joined #ruby
zinjacoder has joined #ruby
dhruvasagar has joined #ruby
pawdro has quit [Quit: Konversation terminated!]
freeayu has joined #ruby
Beoran4 has quit [Ping timeout: 252 seconds]
fermion has joined #ruby
zastav has joined #ruby
liluo has quit [Remote host closed the connection]
indian has joined #ruby
indian has quit [Changing host]
indian has joined #ruby
pedrocarrico has left #ruby [#ruby]
tonini has quit [Ping timeout: 260 seconds]
federic has quit [Ping timeout: 245 seconds]
eph3meral has quit [Quit: Leaving]
tdubellz has quit [Quit: leaving]
tdubz has joined #ruby
schaerli has quit [Remote host closed the connection]
Vert has quit [Ping timeout: 252 seconds]
francisfish has quit [Remote host closed the connection]
tonini has joined #ruby
foofoobar has quit [Quit: bb]
Beoran4 has joined #ruby
Guedes_out is now known as Guedes
zastav has quit [Ping timeout: 245 seconds]
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
dekroning has joined #ruby
jbw_ has quit [Ping timeout: 248 seconds]
Dl33ter has joined #ruby
<Dl33ter>
Hi!
hidek46 is now known as acotie_
acotie_ is now known as acotie
davidcelis has quit [Read error: Connection reset by peer]
francisfish has joined #ruby
<zii>
Would you be in peace with lead dev's desire to enforce use of Enumerable#map instead of Enumerable#collect?
federic has joined #ruby
<Nitrodist>
zii: who cares
<Dl33ter>
How could I choose the first and the last record of a collection_select ? (for exemple, put " Other " at the end of the list, but keep all ordered by name ASC?)
davidcelis has joined #ruby
<zii>
Nitrodist: I do.
<Nitrodist>
Dl33ter: whatever_thing << "other"
<Nitrodist>
zii: it's such a minor point, I wouldn't care
<Nitrodist>
I'm wondering why you're spending valuable time on petty stuff such as that
<matled>
Dl33ter: what do you want to do?
iocor has quit [Quit: Computer has gone to sleep.]
<Dl33ter>
matled: I want to choose the first and the last record of a collection_select. ("ALL" for the first, and "OTHER" for the last)
mdw has quit [Remote host closed the connection]
<matled>
what is a collection_select?
aeufemio has joined #ruby
<Dl33ter>
<%= f.collection_select :mark_id (A combobox ^^)
vlad_starkov has quit [Remote host closed the connection]
werdnativ has quit [Quit: werdnativ]
<Dl33ter>
Like in the Railscasts #88 (Dynamic Select Menus)
rizzylt has joined #ruby
<matled>
oh, I haven't used rails in a while
frishi has joined #ruby
<Dl33ter>
Oh, sorry, I didn't say that I was taling about rails...
starburst has quit [Remote host closed the connection]
<Dl33ter>
talkink*
<Dl33ter>
TALKING* -_-
<Dl33ter>
Nitrodist: you sayed " whatever_thing << "other" ", but where should I put that? Model, View or Controller?
jbw_ has joined #ruby
dhruvasa1ar has joined #ruby
dhruvasagar has quit [Ping timeout: 245 seconds]
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
<Nitrodist>
Dl33ter: view, me thinks. not sure if that'll work the way you want it to
<Nitrodist>
or if it will at all
ramblex has quit [Remote host closed the connection]
nirakara has joined #ruby
jenrzzz-mac has joined #ruby
ramblex has joined #ruby
<Dl33ter>
I'll try, thanks
vlad_starkov has joined #ruby
user__ has joined #ruby
akem has quit [Max SendQ exceeded]
nooodl has joined #ruby
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
Shrink has quit [Ping timeout: 256 seconds]
user__ has quit [Ping timeout: 246 seconds]
Kunda has joined #ruby
lxsameer has joined #ruby
<csmrfx>
What kind of syntax would you prefer for a ruby scraper to make sure site "Foo.com" has the "<title>" tag with contents "Bar"?
<zii>
You're asking a design?
iocor has joined #ruby
fearoffish has joined #ruby
<zii>
csmrfx: title == "bar"
<csmrfx>
need to tell the thing which site or url to look at first
<csmrfx>
how about: inquire("foo.com") { make sure <title> equals "Bar" }
<zii>
make sure? overkill
nanderoo has joined #ruby
<csmrfx>
well I think there are going to be a couple of different verbs like that
<zii>
What's your target? Development or ingenious tool?
<csmrfx>
it's a tool for ppl working with websites
banseljaj is now known as imami|afk
dhruvasa1ar has quit [Ping timeout: 256 seconds]
mdw has joined #ruby
<csmrfx>
I also need to figure out the syntax for "scrape all pages behind this url" vs "on this url contents" and things like how far along the links to scrape
danielferguson has joined #ruby
dhruvasagar has joined #ruby
akem has quit [Ping timeout: 245 seconds]
fayimora has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
Shrink has joined #ruby
<csmrfx>
Who knows, maybe there are already 10s of scraper-test-runners made with ruby
hemanth has joined #ruby
<cek>
zii, map is when you map things, collect is when you gather things
<zii>
cek: I know.
<cek>
for ex., .map(&:to_i)
sleetdrop has quit [Remote host closed the connection]
akem has joined #ruby
<cek>
.collect {|e| e[1] }
`gregorg` has quit [Changing host]
`gregorg` has joined #ruby
`gregorg` is now known as gregorg
<Mon_Ouie>
map to an integer, map each element to its second element
roams has joined #ruby
maesbn has quit [Remote host closed the connection]
iocor has quit [Quit: Computer has gone to sleep.]
<csmrfx>
Do you use parenthesis around the method def's arguments?
<csmrfx>
also, do you use a space between method name and arguments in def, or not?
tk has joined #ruby
<Mon_Ouie>
I do even in cases where I would always omit them when calling the method
<shevy2>
csmrfx I use parens around method def arguments, yes, but only if there are arguments
<shevy2>
def foo
tk is now known as Guest40995
<shevy2>
def foo(i)
maesbn has joined #ruby
<Mon_Ouie>
def foo=(val); end
iocor has joined #ruby
dhruvasagar has quit [Ping timeout: 245 seconds]
iocor has quit [Client Quit]
<csmrfx>
ok
<Dl33ter>
How can I insert " include_blank " or " prompt " in each subcategory of a grouped_collection_select?
<csmrfx>
def foo ( strarg ) OR def foo(strarg) iyo?
shevy2 is now known as shevy
<Mon_Ouie>
latter
dhruvasagar has joined #ruby
gokul has quit [Quit: Leaving]
<csmrfx>
I think I will call this site scraper "The Spanish Inquisition"
user__ has joined #ruby
<shevy>
csmrfx no space is better
t0mmyvyo has joined #ruby
niklasb has joined #ruby
<shevy>
there are quite a few ruby hackers who omit the () in method definitions
<shevy>
but I always found this harder to understand at first glance
<csmrfx>
or whats it called when the spanish inquisition is interrogating the subject 8P
cjs226 has quit []
mengu has joined #ruby
mengu has quit [Changing host]
mengu has joined #ruby
<shevy>
quite verbose
geekbri has joined #ruby
jamesaxl has joined #ruby
<shevy>
almost sounds like a natural english version for "if string.include? '<body>'"
<shevy>
well the inquisition would torture until any fake confession was achieved :)
<csmrfx>
uh, persecute
<csmrfx>
hm, maybe 'confess' instead of 'try'
user__ has quit [Ping timeout: 245 seconds]
<cek>
not MVC
<shevy>
man... confess... try... with try I have to think of java
<shevy>
or python...
<shevy>
catch try throw
<shevy>
confess reminds me more of inquisition
<shevy>
but what should I confess
akem has joined #ruby
fayimora has quit [Quit: Be back in a gifii]
fayimora has joined #ruby
macmartine_ has joined #ruby
<csmrfx>
the inquisitor asks the page to confess, right
locriani_ has joined #ruby
<cek>
yes, java is enterprise inquisitor ready
<csmrfx>
not sure if aiming for fun suntax is going to be worthwhile
<shevy>
cek haha I like that
<csmrfx>
now that I look at it, I bet xpath is going to have to be used sooner or later
cek has quit [Quit: жопа диридай диридиридай]
a_a_g1 has joined #ruby
a_a_g1 has quit [Ping timeout: 245 seconds]
tommyvyo has quit [Ping timeout: 244 seconds]
t0mmyvyo is now known as tommyvyo
<shevy>
ewww... sounds like XML attack
flype has quit [Quit: Computer has gone to sleep.]
nirakara has quit [Read error: No route to host]
macmartine has quit [Ping timeout: 240 seconds]
Asher1 has joined #ruby
krz has quit [Ping timeout: 244 seconds]
sirecote has quit [Ping timeout: 244 seconds]
<csmrfx>
well true, if I want xpath the pages need to be parsed with nogogiri I think
nirakara has joined #ruby
locriani has quit [Ping timeout: 244 seconds]
hemanth has quit [Ping timeout: 244 seconds]
devdazed has quit [Ping timeout: 244 seconds]
<csmrfx>
not quite xml but xpath syntax nontheless
tarside has joined #ruby
williamherry has quit [Ping timeout: 244 seconds]
Dratir has quit [Ping timeout: 244 seconds]
nw has quit [Ping timeout: 240 seconds]
a_a_g1 has joined #ruby
ABK has quit [Ping timeout: 244 seconds]
macmartine_ is now known as macmartine
a_a_g1 has quit [Read error: Connection reset by peer]
otters has quit [Ping timeout: 240 seconds]
dross has quit [Ping timeout: 240 seconds]
flagg0205 has quit [Ping timeout: 240 seconds]
dphase has quit [Ping timeout: 240 seconds]
a_a_g has quit [Ping timeout: 265 seconds]
SeySayux has quit [Ping timeout: 244 seconds]
nw has joined #ruby
dross has joined #ruby
tommyvyo_ has joined #ruby
Asher has quit [Ping timeout: 240 seconds]
dhruvasagar has quit [Ping timeout: 265 seconds]
ABK has joined #ruby
dhruvasagar has joined #ruby
epochwolf|vps2 has quit [Ping timeout: 240 seconds]
krz has joined #ruby
epochwolf|vps has joined #ruby
dphase has joined #ruby
nirakara has quit [Client Quit]
any-key has joined #ruby
williamherry has joined #ruby
any-key has quit [Ping timeout: 240 seconds]
alienvenom has joined #ruby
ping-pong has quit [Ping timeout: 240 seconds]
ben_alman has quit [Ping timeout: 244 seconds]
alienvenom has quit [Ping timeout: 244 seconds]
lxsameer has quit [Quit: Leaving]
sirecote has joined #ruby
williamherry has quit [Max SendQ exceeded]
mmercer has quit [Ping timeout: 244 seconds]
BeLucid_ has joined #ruby
dv310p3r has quit [Ping timeout: 260 seconds]
devdazed has joined #ruby
flagg0204 has joined #ruby
dross has quit [Read error: Connection reset by peer]
SeySayux_ has joined #ruby
a_a_g has joined #ruby
william_ has joined #ruby
jamesaxl has quit [Write error: Connection reset by peer]
hemanth has joined #ruby
BeLucid has quit [Ping timeout: 244 seconds]
jamesaxl has joined #ruby
ping-pong has joined #ruby
Jck_true has quit [Ping timeout: 240 seconds]
Jck_true has joined #ruby
krusty_ar has joined #ruby
akem has quit [Ping timeout: 244 seconds]
Bartzy has joined #ruby
<Bartzy>
Hey
a_a_g1 has joined #ruby
Dratir has joined #ruby
test34 has joined #ruby
a_a_g1 has quit [Read error: Connection reset by peer]
<Bartzy>
I'm using Capistrano, hope you can help with this. I am trying to assign a value to a variable in one task and read it in another task. How do I do that ?
a_a_g has quit [Read error: Connection reset by peer]
a_a_g1 has joined #ruby
`brendan has joined #ruby
ben_alman has joined #ruby
nirakara has joined #ruby
<kalleth__>
globals baby, yeah
tarside has quit [Ping timeout: 245 seconds]
kalleth__ is now known as kalleth
tarside has joined #ruby
Dl33ter has quit [Ping timeout: 252 seconds]
indian has quit [Ping timeout: 265 seconds]
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
tonini has quit [Remote host closed the connection]
iocor has joined #ruby
vitoravelino`afk is now known as vitoravelino
test34 has left #ruby [#ruby]
mneorr has joined #ruby
CannedCorn has joined #ruby
akem has joined #ruby
kjellski has joined #ruby
<CannedCorn>
guys i've got what is probably a simple question, when i call to_json on something its escaping the string, how do i get it to not do that
<_br_>
CannedCorn: Hm, probably if its not escape it would be invalid json.
<_br_>
CannedCorn: Can't you just unescape on the receiving end?
<CannedCorn>
hrm
senny has joined #ruby
<CannedCorn>
well im writing a sinatra app, and i have a bunch of routes that use the json render method from sinatra::contrib
<CannedCorn>
they all work fine
<CannedCorn>
on hashes etc
<CannedCorn>
but this one route has an array of mongodb documents, when i try to output that as json, it barfs
rizzylt has quit [Ping timeout: 244 seconds]
alexander-- has joined #ruby
peterhil` has quit [Ping timeout: 260 seconds]
<CannedCorn>
says it can't convert nil to string
d3c has joined #ruby
<CannedCorn>
but i don't understand why it would be trying to convert nil, when i call to_json on it, i see the output just fiine
<CannedCorn>
and i think that is what the json helper is doing
alexander-- has quit [Remote host closed the connection]
A124 has joined #ruby
<_br_>
Well, that means that at some point you try to do some manipulation on a nil object, but that method doesn't exist. Try run the thing with the debugger attached maybe you can track it down with that
<CannedCorn>
what debugger do you recommend?
vectorshelve has quit [Ping timeout: 245 seconds]
<csmrfx>
CannedCorn: use pry
<CannedCorn>
im using that :-)
peterhil` has joined #ruby
<CannedCorn>
but wait, why does to_json work...
<CannedCorn>
very odd
<csmrfx>
I believe it is all the debugger you need
frishi has quit [Quit: Leaving...]
akem has quit [Ping timeout: 245 seconds]
<CannedCorn>
interesting
<CannedCorn>
not quite sure how to attach it, but i guess i'll do some digging
timonv_ has joined #ruby
<CannedCorn>
just doesn't make sense that i can see the output via to_json just fine though
<csmrfx>
it's just something small you've overlooked, probably
<csmrfx>
~as these nil probs usually are
kjellski has quit [Quit: Leaving]
niklasb has quit [Ping timeout: 244 seconds]
timonv has quit [Ping timeout: 248 seconds]
bosphorus has quit [Read error: Connection reset by peer]
bosphorus has joined #ruby
cjs226 has joined #ruby
nw has quit [Quit: leaving]
nw has joined #ruby
SimSala has joined #ruby
TheHunter_1039 has joined #ruby
lxsameer has quit [Ping timeout: 252 seconds]
nw has quit [Client Quit]
Markvilla has joined #ruby
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
nw has joined #ruby
Dl33ter has joined #ruby
lxsameer has quit [Max SendQ exceeded]
<_br_>
Hm.. everyone at sleep at #zeromq. Anyone here who is a bit familar with it?
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
ryannielson has joined #ruby
<Dl33ter>
On my grouped_collection_select, (RAILS) can I add a field in each subcategories, and define that "First" ? But I want to keep everything ordering by "name ASC".
ZachBeta has joined #ruby
nw has quit [Client Quit]
ryannielson is now known as twixmix
<Tasser>
Dl33ter, #rubyonrails
nw has joined #ruby
<csmrfx>
ok, next up: handle block arguments to a method
<Dl33ter>
Tasser: Ok thanks :)
<csmrfx>
Is it possible to handle a block argument as data or a string?
<Nitrodist>
csmrfx: why
<csmrfx>
ie. lisp stylee
<Tasser>
csmrfx, as data, yes, as string, no
<csmrfx>
Nitrodist: well if I want to actually parse the block contents myself
<Nitrodist>
csmrfx: yes you can parse it line by line if you want
<csmrfx>
ok, so what would be a good place to look to learn more?
Dl33ter has quit [Client Quit]
andrewhl has joined #ruby
ZachBeta has quit [Client Quit]
iocor has quit [Quit: Computer has gone to sleep.]
<_br_>
csmrfx: probably the *multi gem's. e.g. smulti.
wangr has joined #ruby
<_br_>
csmrfx: Quite slow though.
<_br_>
csmrfx: Alternatively, you could use the 1.9 sourcify gem with ParseTree and manipulate the AST directly
<csmrfx>
ok this is nowhere nearly as complicated
<_br_>
What do you want to do anyway?
<csmrfx>
the parse tree has 3 branches, 2 levels of nodes
<csmrfx>
just be able to parse sentences like: (make sure this url) contains <tag> with "string" contents
<csmrfx>
split is fine atm
<Nitrodist>
like writing your own dsl
<csmrfx>
almost
<_br_>
yeah, there are two ways for this. Either you leverage ruby syntax and build a simple dsl ontop of it. Or you go full out with smulti.
<csmrfx>
I'm more interested in learning how to coax a block argument into something splittable
<csmrfx>
simple as that 8)
<_br_>
alternatively, you could shoot with regex'es at it
xaxisx has joined #ruby
rizzylt has joined #ruby
<_br_>
csmrfx: blocks are proc's. Not sure if that is splitable. The only way i have found was over sourcify gem. let me show you, just a sec
jeff_sebring has quit [Remote host closed the connection]
<csmrfx>
ah well, I am sure I'll get this working with method missing and yield with args... gotta yield now
<maploin``>
hi. Is there any way to get the path of a ruby module? i.e. use require just to check that a file exists somewhere on the path, but without actually loading it?
<shevy>
that is really weird to see, code that tries to type check in ruby in different ways :D
dubios has quit [Quit: I was never here]
fantazo has joined #ruby
<_br_>
csmrfx: A Block is a Proc. The only way I know to get the code from a proc object at the moment is via sourcify. As I said.
akem has joined #ruby
dubios has joined #ruby
bglusman has joined #ruby
hynkle has joined #ruby
Jackneill has joined #ruby
Jackneill has quit [Changing host]
Jackneill has joined #ruby
<csmrfx>
maybe no need to parse this simple stuff
<shevy>
maploin`` hmm there is __FILE__ and $LOAD_PATH
<shevy>
via require or load, I think the file will be appended to $LOAD_PATH
<maploin``>
shevy: I know, but I'd rather not loop through LOAD_PATH myself
jenrzzz-mac has quit [Quit: jenrzzz-mac]
<csmrfx>
oh yeah, thats right
<shevy>
Don't think it is possible to find out without tapping into the $LOAD_PATH array
emmanuelux has joined #ruby
chson has quit [Remote host closed the connection]
<shevy>
anyone has a simpler way to convert $FOO variables to ENV['FOO'], in a string, but only if $FOO was defined? I came up with this here: http://pastie.org/4067260
dekroning has quit [Ping timeout: 244 seconds]
lorandi has joined #ruby
niklasb has joined #ruby
dross has joined #ruby
abionic has joined #ruby
<Mon_Ouie>
gsub accepts a block
<Mon_Ouie>
gsub(YourEnvRegex) { |match| ENV[$1] || match }
andrewhl has quit [Remote host closed the connection]
ABK has quit [Ping timeout: 240 seconds]
Konboi has quit [Remote host closed the connection]
jeff_sebring has quit [Remote host closed the connection]
nricciar_ has joined #ruby
mdhopkins has quit [Quit: mdhopkins]
Facefox has joined #ruby
jeff_sebring has joined #ruby
chson has joined #ruby
tuxaddicted has joined #ruby
jeff_sebring has quit [Remote host closed the connection]
imami|afk is now known as banseljaj
indian has joined #ruby
carloslopes has joined #ruby
relix has joined #ruby
relix is now known as relix2
jeff_sebring has joined #ruby
d3c has quit [Quit: Sleep]
noganex has joined #ruby
<relix2>
hey guys
nowthatsamatt has joined #ruby
d3c has joined #ruby
<relix2>
I have a centralized Rails app, and an independent ruby app ("node") that needs to interact with the Rails app (but sparsely, just requesting the email address for a user given the username)
<relix2>
right now I'm using ActiveResource in the ruby node app to retrieve that data, but I was wondering if there is a better REST gem out there for ruby
<relix2>
since I'm not using Rails in the small ruby app I'm not attached to ActiveResource
nricciar has quit [Quit: Leaving]
nowthatsamatt has quit [Client Quit]
Dl33ter has joined #ruby
boodle has joined #ruby
<Dl33ter>
Hi!
theRoUS has joined #ruby
tdelam_ has joined #ruby
zinjacoder has quit [Read error: Connection reset by peer]
tdelam_ has quit [Client Quit]
<shevy>
relix2 usually the rails users are on #rubyonrails, many people here on #ruby dont even know rails
zinjacoder has joined #ruby
<relix2>
shevy yes, but it's not a rails question
<relix2>
shevy and the people on #rubyonrails are mostly unfriendly in my (limited) experience
<shevy>
:)
<relix2>
unlike the #ruby people :)
<relix2>
so forget I talked about rails
fermion has joined #ruby
boodle has quit [Quit: boodle]
<relix2>
I'll rephrase the question: what's the best Ruby REST client library?
khyron320 has joined #ruby
tdelam has joined #ruby
<relix2>
I wouldn't be surprised if it actually is activeresource :)
<shevy>
sorry no idea. the very little thing i did with ruby + www was mostly using ruby .cgi :D
t-mart has joined #ruby
mdhopkins has joined #ruby
<relix2>
ah ok :)
axl_ has joined #ruby
afallows has joined #ruby
nlc has joined #ruby
otters has joined #ruby
adambeynon has joined #ruby
dekz has joined #ruby
EvanR has joined #ruby
irrationalfab has quit []
EvanR is now known as Guest77270
mmercer has joined #ruby
sleetdrop has quit [Remote host closed the connection]
irrationalfab has joined #ruby
dhruvasagar has quit [Ping timeout: 248 seconds]
brngardner has quit [Remote host closed the connection]
<relix2>
_br_: I was wondering if there's something more high level out there like activeresource
CannedCorn has joined #ruby
<CannedCorn>
hey guys
llaskin has joined #ruby
<zeroXten>
hi all, i'm having problems installing ruby-graphviz gem. Seems to install ok, but I get the following error when trying to require it: /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- graphviz (LoadError)
mxweas has quit [Ping timeout: 252 seconds]
<llaskin>
anyone here have experience with testunit?
<_br_>
relix2: hm not sure about that
<CannedCorn>
im working on building something and was wondering what the best process is for spawning, checking, killing processes is
jeff_sebring has quit [Read error: Connection reset by peer]
schovi has quit [Read error: Connection reset by peer]
<CannedCorn>
ensuring that they die, etc
<CannedCorn>
and ensuring that they are up
<CannedCorn>
that sort of thing
<_br_>
zeroXten: Did you install the graphviz library via the system package manager? Seems you are missing libgraph* ?
schovi has joined #ruby
jeff_sebring has joined #ruby
<_br_>
CannedCorn: Ensuing that they are up? Hm e.g. the god gem ?
<CannedCorn>
hrm
irrationalfab has left #ruby [#ruby]
mxweas has joined #ruby
<zeroXten>
_br_: i think so, graphviz is installed as is libgv-ruby
<_br_>
ahhhhh... anyone here played ever with ffi-rzmq ?
<zeroXten>
(ubuntu 12.04)
irrationalfab has joined #ruby
shellox has joined #ruby
Guest77270 is now known as EvanR
EvanR has quit [Changing host]
EvanR has joined #ruby
tdelam has quit [Quit: tdelam]
ananthakumaran has quit [Quit: Leaving.]
tdelam has joined #ruby
<_br_>
zeroXten: hm, please paste the following into gist; dpkg -l | egrep -i graphviz ; gem env ; gem list | egrep -i graphviz ;
<shevy>
CannedCorn I think a common pattern is to use the block form. like File.open('bla') {}, and inside the block ensure that this is closed properly. that could work for the spawning/killing you are trying to do as well
<_br_>
zeroXten: could also be a permission issue. If you require it as root user does it work?
<shevy>
also have a look at the ruby daemons project. even if you dont use it, they must have solved similar problems
<CannedCorn>
ok great shevy, God gem looks amazing but I think i want to use popen
<zeroXten>
_br_: doesn't work as root
jrgifford has joined #ruby
<zeroXten>
ah, i think I spotted the problem
<zeroXten>
my gem version doesn't match ruby
<zeroXten>
hmm, I seem to have 1.9 and 1.8 installed :(
ph^_ has quit [Remote host closed the connection]
si14 has joined #ruby
ph^ has joined #ruby
jprovazn_away is now known as jprovazn
jrgifford has quit [Client Quit]
fbernier has joined #ruby
hashpuppy has joined #ruby
Morkel has joined #ruby
<zeroXten>
cool, that was simple. Although update-alternatives doesn't seem to be playing nicely
DavidTiger has joined #ruby
Sheehan has joined #ruby
maploin`` has quit [Remote host closed the connection]
albemuth has joined #ruby
<shevy>
zeroXten hehehe
<shevy>
sounds like fun on debian!
<shevy>
Hanmac here is a heavy debian user
ph^ has quit [Ping timeout: 256 seconds]
<shevy>
he knows how to solve every ruby-related problem on debian
jrist-afk is now known as jrist-mtg
<ekaleido>
im such a scrub. ive been fighting with rails for a few weeks and today i realize it had cgi builtin
Spaceghostc2c has joined #ruby
<shevy>
rails? or you mean ruby
carloslopes_ has joined #ruby
rodasc is now known as crodas
<ekaleido>
ruby had cgi builtin
<ekaleido>
sorry
ddls-devbox has joined #ruby
saidin_ has joined #ruby
<ekaleido>
i could be doing what im working on with that instead of rails
carloslopes has quit [Ping timeout: 245 seconds]
<ekaleido>
cause i want to choke the creators of rails
Sou|cutter has joined #ruby
nricciar_ has quit [Quit: Leaving]
<_br_>
ekaleido: Try Sinatra. Its quite fun.
hakunin has joined #ruby
Jackneill has quit [Remote host closed the connection]
<ddls-devbox>
Pls help. Im going crazy. I have the string "Study Type\302\240 ICMJE" and just want the part from [0] to index of \. But since its a backslash everything fails hard.. ideas?
nilg` has quit [Remote host closed the connection]
<_br_>
ddls-devbox: Hm, that output is actually a "=" sign in UTF-8
<hashpuppy>
there's a function: "def after_commit(*args, &block); set_callback(:commit, :after, *args, &block); end". is there a way to do something like "after_commit :my_func("blah")", where i want it to execute my_func with "blah" passed to it
<_br_>
ddls-devbox: seems you are working on a multi-byte string using the wrong encoding.
dhruvasagar has quit [Ping timeout: 246 seconds]
<ddls-devbox>
_br_: might be. thx, Ill check the encoding in the source.
<ddls-devbox>
:)
aquaranto has joined #ruby
sbanwart has joined #ruby
luxurymode has joined #ruby
<_br_>
hashpuppy: Not sure I can clearly understand. Are you looking for instance_eval( &block ) ?
hoelzro|away is now known as hoelzro
billiamii has joined #ruby
<llaskin>
anyone using TestUnit?
uris has quit [Read error: Connection reset by peer]
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
PaciFisT has joined #ruby
gtuckerkellogg has joined #ruby
lectrick has joined #ruby
nipra has quit [Ping timeout: 245 seconds]
jeff_sebring has quit [Remote host closed the connection]
balki_ is now known as balki
nu7hatch has joined #ruby
jeff_sebring has joined #ruby
workmad3 has joined #ruby
peterhil` has quit [Ping timeout: 260 seconds]
hunglin has joined #ruby
<lectrick>
so I finally set up a free amazon ec2 instance to mess around with. Pretty awesome. Might move my domain over to it.
CheeToS has joined #ruby
virunga has joined #ruby
axl_ has quit [Read error: Connection reset by peer]
<_br_>
lectrick: Free?
brngardner has joined #ruby
axl_ has joined #ruby
walterheck has joined #ruby
<hashpuppy>
i guess my question is when something takes in a &block, how can i pass it a method name w/ some arguments or is the only way to do it { my_func("blah") }
maesbn has quit [Remote host closed the connection]
<shevy>
rknLA I think this is for ruby 1.8.7, a few things changed in ruby C since 1.9.x
mikepack has joined #ruby
<shevy>
the general gist of it should still be valid though
<bnagy>
rknLA: if you're writing bindings I'd suggest FFI
mayankkohaley has joined #ruby
ciopte7 has quit [Quit: ciopte7]
<bnagy>
portable for more interpreters, and good to work with / maintained
bradhe has joined #ruby
wvms has quit [Ping timeout: 248 seconds]
jeff_sebring has quit [Remote host closed the connection]
mxweas has quit [Ping timeout: 265 seconds]
<rknLA>
which direction does ffi go?
<rknLA>
calling c functions from ruby?
<bnagy>
wrapping binary libs
<rknLA>
(the docs on the github page are a bit perplexing.. maybe i should read the ruby extensions document first)
<shevy>
I have a question. In IRB, when I type 'pwdj', and this method was not found, it reports this:
<shevy>
NameError: undefined local variable or method `pwdj' for main:Object
<shevy>
Is there a way to somehow catch this, and perhaps do something else, but only when run in irb?
<rknLA>
bnagy: is there more latency using FFI than getting my hands dirty and going DIY?
<rknLA>
(the binary lib is for real time audio)
sako has quit [Ping timeout: 245 seconds]
hynkle has quit [Read error: No route to host]
<bnagy>
if it's an existing lib it's going to be a lot easier with ffi, I'd say
<bnagy>
if you're that worried about performance then ruby isn't the right tool
mxweas has joined #ruby
zomgbie has quit [Read error: Connection reset by peer]
koskoz has quit [Ping timeout: 240 seconds]
Guest20110 has quit [Ping timeout: 260 seconds]
sacarlson has quit [Ping timeout: 245 seconds]
bradhe has quit [Remote host closed the connection]
<rknLA>
it's not an existing lib.
t-mart has quit [Quit: Leaving]
<rknLA>
i'm thinking about doing a lib that does all of the heavy lifting of the audio processing in c,
hynkle has joined #ruby
<shevy>
hmmm how do I require a .rb file in 1.9.3
<rknLA>
but writing it in a way that is flexible enough to use with ruby or other c programs.
hasrb has joined #ruby
<shevy>
aha... changing require 'test.rb' to require './test.rb' works ...
<rknLA>
similar to max/msp or puredata, in that all of the objects are written in c, but they're connected in a gui patching environment. all of the sound objects would be written in c, but connected together in ruby
nooodl_ has joined #ruby
<rknLA>
ruby should be fast enough to handle that, right?
<bnagy>
rknLA: well then your only real option is to write it as a standalone lib, and then wrap it, no? If you write it as a ext gem it won't be usable for anything else
nooodl has quit [Disconnected by services]
pygospa has quit [Disconnected by services]
nooodl_ is now known as nooodl
ciopte7 has joined #ruby
TheRealPygo has joined #ruby
<bnagy>
afaik, anyway
<rknLA>
bnagy: yeah, correct.
<rknLA>
k
bbttxu has joined #ruby
<rknLA>
er,
<rknLA>
misread as afk
<rknLA>
so is ffi useful for that?
mxweas has quit [Ping timeout: 245 seconds]
<bnagy>
main options are FFI and DL
<bnagy>
I have had extreme pain with DL, but some people like it
pdtpatrick has joined #ruby
<rknLA>
ah, so, i'd write the lib in c, then use ffi just to call the functions in the headers?
senny has quit [Remote host closed the connection]
<rknLA>
stack overflow is fucking amazing.
<shevy>
yeah
khakimov has joined #ruby
savage- has joined #ruby
proghat_ has quit [Ping timeout: 245 seconds]
ciopte7 has joined #ruby
francisfish has quit [Remote host closed the connection]
gongura has quit [Quit: This computer has gone to sleep]
fabrice31 has quit [Remote host closed the connection]
francisfish has joined #ruby
iocor has joined #ruby
bluOxigen has quit [Ping timeout: 256 seconds]
brianpWins has quit [Quit: brianpWins]
kenperkins has joined #ruby
wilmoore has joined #ruby
bier has joined #ruby
sacarlson has joined #ruby
francisfish has quit [Ping timeout: 245 seconds]
sacarlson has quit [Max SendQ exceeded]
<rking>
I don't get why stackoverflow has caught on so much.
MasterIdler_ is now known as MasterIdler
MrGando has joined #ruby
<rking>
Don't get me wrong - I like it, but why that site and not the 50 others like it, before it?
CheeToS has quit [Ping timeout: 248 seconds]
tatsuya_o has quit [Remote host closed the connection]
dcorbin has quit [Quit: This computer has gone to sleep]
azm has quit [Read error: Connection reset by peer]
azm has joined #ruby
azm has quit [Changing host]
azm has joined #ruby
mdw has quit [Remote host closed the connection]
<eam>
rking: UI (experts-exchange was terrible, faked info, register-to-read), and license (SO is cc-wiki)
kenichi has joined #ruby
oooPaul has joined #ruby
Soliah has joined #ruby
adeponte has joined #ruby
ptulskie has quit [Quit: ptulskie]
alexim has joined #ruby
Morkel has quit [Quit: Morkel]
carloslopes_ has quit [Ping timeout: 245 seconds]
<rknLA>
register (and pay) to read definitely killed experts exchange.
<rking>
Good points.
<rknLA>
UI definitely helped a lot. also searchability (though that may be more recent).. it's consistently in the top few of all of my tech-related google searches
<rking>
I didn't even know about the license. That's fantastic.
gongura has joined #ruby
tds has joined #ruby
<rknLA>
i think the upvoting and "accepted" answer aspects of the UI are probably it's best usability features. experts exchange was basically just a phpbb, right? reading through 6 pages of conversation is annoying when you just want the answer.
hadees has quit [Quit: hadees]
gongura has quit [Client Quit]
bigoldrock has joined #ruby
indian has quit [Ping timeout: 248 seconds]
dekroning has quit [Ping timeout: 245 seconds]
gongura has joined #ruby
tomask has joined #ruby
rippa has joined #ruby
Solnse has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
artOfWar_ has joined #ruby
fserb has joined #ruby
koskoz has joined #ruby
a_a_g has quit [Quit: Leaving.]
snip_it_ has joined #ruby
hasrb has quit [Remote host closed the connection]
artOfWar has quit [Ping timeout: 252 seconds]
zomgbie has joined #ruby
sako has joined #ruby
Sheehan has quit [Ping timeout: 245 seconds]
macmartine has joined #ruby
macmartine has quit [Remote host closed the connection]
macmartine has joined #ruby
td123 has joined #ruby
ramblex has quit [Quit: ramblex]
dr_bob has joined #ruby
looopy has joined #ruby
ken_barber has quit [Remote host closed the connection]
ken_barber has joined #ruby
rippa has quit [Ping timeout: 265 seconds]
hmans has joined #ruby
carlyle has joined #ruby
rippa has joined #ruby
yonggu_ has joined #ruby
hasrb has joined #ruby
hynkle has joined #ruby
bluenemo_ has joined #ruby
az has left #ruby ["WeeChat 0.3.7"]
axl_ has quit [Read error: Connection reset by peer]
iocor has quit [Quit: Computer has gone to sleep.]
hadees has joined #ruby
axl_ has joined #ruby
<bluenemo_>
i'm on debian squeeze and i'm getting the mysql2 error: rb_wait_for_single_fd (while gem installing it its checked for (not present) but the installation doesnt fail), when i then rake assets:precompile i get undefined symbol: rb_wait_for_single_fd
shadoi has joined #ruby
yonggu_ has quit [Remote host closed the connection]
yonggu has quit [Read error: Connection reset by peer]
yonggu_ has joined #ruby
looopy has quit [Remote host closed the connection]
<bluenemo_>
i've googled a lot and found that i can give the installation several options like --mysql-dir and so on, which doesnt help. i'm quite sure i've got all the (apt) packages installed
Helius has quit [Ping timeout: 246 seconds]
timonv_ has quit [Remote host closed the connection]
d3vic3 has quit [Ping timeout: 245 seconds]
n1x has joined #ruby
timonv has joined #ruby
<shevy>
rking I dont really know any other site like stackoverflow
<shevy>
it's kinda like almost the simplest thing possible. people post questions, other people post answers. that's it kinda... plus there is some kind of karma system, where everyone helping others is encouraged to do so
<tds>
design question for you all: I'm coding some payroll software, and it's meant to be used by companies both in the US and Canada (with possibility of future expansion elsewhere.) obviously for some classes like Employee, there is going to be some shared functionality, but a lot of differences as well. for example, some regulatory data and business logic only has to exist for one country in the other. since a company can contain only one type of employee in this app (t
<tds>
they can only be canadian or american), i was thinking of just using mixins to add the different functionality at runtime, instead of creating an inheritance hierarchy which has the potential to become extremely cumbersome. any thoughts/criticisms/alternatives?
greyEAX has joined #ruby
Facefox has joined #ruby
<greyEAX>
how do i set my code to work with utf8?
ZeroModulus has joined #ruby
<dross>
shevy: I'm curious how stackoverflow funds the site
<greyEAX>
i need to use japanese characters in a response, and i can't do it because it errors our
<greyEAX>
*(out
<dross>
probably ads, which i don't se
<dross>
see
<shevy>
dross yeah, no idea at all
v0n has joined #ruby
mdhopkins has quit [Quit: mdhopkins]
timonv has quit [Ping timeout: 245 seconds]
d3vic3 has quit [Client Quit]
joch_n has joined #ruby
<rking>
greyEAX: What Ruby version?
<greyEAX>
it should be 1.9.1
<greyEAX>
lemme check
<rking>
greyEAX: OK, as long as it's 1.9
<greyEAX>
1.9.3
Targen has quit [Ping timeout: 245 seconds]
<rking>
(1.8 is do-able, but different)
<greyEAX>
p194
alexander-- has joined #ruby
alexander-- has quit [Client Quit]
<shevy>
1.8 was great
RiseAgainst has joined #ruby
<rking>
greyEAX: OK, so exactly what are you doing with your data, input → processing → output ?
<rking>
shevy-- # not the first time I've said that.
fayimora has quit [Read error: Connection reset by peer]
<greyEAX>
well basically i just want to print a string with にほんご characters
<rking>
greyEAX: The string is embedded in the .rb itself?
<shevy>
rking why was Encoding not made optional?
<greyEAX>
yeah
<rking>
shevy: Because it's a nonoptional concept. Otherwise you're stuck with hardcoding an implicit encoding.
fayimora has joined #ruby
<rking>
greyEAX: Super. Put # encoding: utf8 as the 2nd line of your script.
RiseAgainst has quit [Remote host closed the connection]
chrismcg is now known as zz_chrismcg
<greyEAX>
coolshoes
<greyEAX>
that worked
<greyEAX>
thanks!
fridim_ has joined #ruby
snearch has joined #ruby
schovi has quit [Remote host closed the connection]
fayimora has quit [Read error: Connection reset by peer]
fayimora has joined #ruby
<rking>
greyEAX: BTW I think it should be utf-8, not utf8.
<rking>
greyEAX: I was surprised to Alt+Tab over here and see you say it worked. =)
<rking>
(Because in my test I had to use the dash.)
<shevy>
metainformation in comments
TaTonka has quit [Read error: Connection reset by peer]
peregrine81 has joined #ruby
<greyEAX>
oh mine had the dash in it
<greyEAX>
i didn't copypaste it
blumbri has quit [Ping timeout: 246 seconds]
<rking>
shevy: In 1.8 you had to use -Ku, which I like less.
<shevy>
after the shebang?
elhu has quit [Ping timeout: 248 seconds]
<shevy>
something like "#!/usr/bin/ruby -wKu" ?
<shevy>
or is that a commandline switch
blumbri has joined #ruby
hoelzro is now known as hoelzro|away
<rking>
Yeah, like that.
apok has joined #ruby
<rking>
But it has numerous disadvantages to the current way.
zomgbie has quit [Ping timeout: 245 seconds]
ziyadb has joined #ruby
n1x has left #ruby ["Ex-Chat"]
<shevy>
well the new way requires an additional line specifying what encoding to use
<shevy>
perhaps in ruby 3.0 we can code in pure comments alone :D
<shevy>
that would be a language worth having, one where comments is data and logic
zomgbie has joined #ruby
rippa has quit [Ping timeout: 256 seconds]
bigdc1 has joined #ruby
fayimora has quit [Read error: Connection reset by peer]
fayimora has joined #ruby
ringotwo has joined #ruby
relix has joined #ruby
mdw has joined #ruby
ringotwo has quit [Remote host closed the connection]
williamcotton has joined #ruby
snearch has quit [Quit: Verlassend]
jrist is now known as jrist-afk
gongura has quit [Quit: This computer has gone to sleep]
flip_digits has joined #ruby
ringotwo has joined #ruby
tomask has quit [Quit: Quit]
hemanth has quit [Read error: Connection reset by peer]
SegFaultAX|work2 has joined #ruby
hemanth has joined #ruby
zomgbie has quit [Ping timeout: 244 seconds]
TaTonka has joined #ruby
<rking>
Ehh, sorta.
kvirani has quit [Remote host closed the connection]
Facefox has quit [Ping timeout: 250 seconds]
llaskin has left #ruby [#ruby]
counterbeing has quit [Read error: Connection reset by peer]
Solnse has quit [Ping timeout: 252 seconds]
Drewch has joined #ruby
alexander-- has joined #ruby
alexander-- has quit [Client Quit]
cesario has joined #ruby
A124 has joined #ruby
roolo has joined #ruby
borys_b_timakov has joined #ruby
tayy has joined #ruby
werdnativ has joined #ruby
tayy has quit [Remote host closed the connection]
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
krusty_ar has quit [Read error: Connection reset by peer]
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
the_jeebster1 has joined #ruby
pdtpatrick_ has joined #ruby
DrShoggoth has quit [Read error: Connection reset by peer]
the_jeebster has quit [Ping timeout: 245 seconds]
bigdc1 has quit []
pdtpatrick has quit [Ping timeout: 245 seconds]
pdtpatrick_ is now known as pdtpatrick
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
krusty_ar has joined #ruby
davidpk has joined #ruby
arturaz has quit [Ping timeout: 240 seconds]
arturaz has joined #ruby
havenn has joined #ruby
pdtpatrick has quit [Read error: Connection reset by peer]
zomgbie has joined #ruby
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
pdtpatrick has joined #ruby
khakimov has joined #ruby
Facefox has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
Facefox has quit [Max SendQ exceeded]
Facefox has joined #ruby
cbuxton has quit [Quit: Leaving.]
cbuxton has joined #ruby
schovi has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
mrsolo has joined #ruby
mockra has joined #ruby
mrsolo has quit [Client Quit]
mrsolo has joined #ruby
schickung has quit [Quit: schickung]
vlad_starkov has joined #ruby
irrationalfab has quit [Remote host closed the connection]
cj3kim has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby
cbuxton has quit [Ping timeout: 245 seconds]
cbuxton has joined #ruby
cj3kim has quit [Client Quit]
zommi has quit [Remote host closed the connection]
nateberkopec has quit [Quit: Leaving...]
mdw_ has joined #ruby
<shevy>
so when you are writing a ruby program that outputs stuff on the commandline
<shevy>
but you want to have it coloured, what do you use?
carloslopes has joined #ruby
nahhh has quit [*.net *.split]
patronus has quit [*.net *.split]
rudle has quit [*.net *.split]
brian- has quit [*.net *.split]
ged has quit [*.net *.split]
nahhh has joined #ruby
rudle has joined #ruby
patronus has joined #ruby
brian- has joined #ruby
ged has joined #ruby
<shadoi>
highline does it for menus/prompts, etc.
<shadoi>
If you just want colored output there are a few different options
<shadoi>
I suppose you could just use highline for it as well though.
mdw has quit [Ping timeout: 248 seconds]
ciopte7 has quit [Quit: ciopte7]
irrationalfab has joined #ruby
<shevy>
hmm ok, going to have a look at highline, thanks
mindrag has joined #ruby
voodoofish430 has joined #ruby
cbuxton has quit [Remote host closed the connection]
jeffreybaird has quit [Quit: jeffreybaird]
nipra has joined #ruby
jamesaxl has quit [Ping timeout: 245 seconds]
baniseterfiend` has quit [Remote host closed the connection]
jamesaxl has joined #ruby
baniseterfiend` has joined #ruby
<matled>
shevy: search for ansi / vt 100 escape codes
<matled>
probably there are libraries for that too, but some simple stuff is useful to know anyway
baniseterfiend` has quit [Read error: Connection reset by peer]
Ammar01 has quit [Quit: Leaving]
banisete_ has joined #ruby
nilg has quit [Remote host closed the connection]
hoelzro|away is now known as hoelzro
maletor_ has joined #ruby
<matled>
for example "\r\e[K" to go back to the beginning and remove the content of the current line
<shevy>
oh that one is cool
havenn has quit [Remote host closed the connection]
<matled>
handy to display progress of long running jobs :)
<shevy>
lol ...
<shevy>
print "hi \r\e[K"
werdnativ has quit [Quit: werdnativ]
robbyoconnor has quit [Ping timeout: 252 seconds]
<shevy>
outputs nothing at all :)
<shevy>
at least not the "hi" part
<shevy>
hmm indeed, I could make a growing status bar with this I suppose?
<shevy>
print "\r\e[K|"
<shevy>
print "\r\e[K|==="
<shevy>
print "\r\e[K|========"
<shevy>
print "\r\e[K|========>"
<matled>
if the output is growing \r is enough
<shevy>
ah
<matled>
the kill line is necessary to remove anything that is longer than the new output
<matled>
for example if you're counting down
<shevy>
I see
CannedCorn has quit [Ping timeout: 246 seconds]
<matled>
or just add the current item in the output which has varying length
lxsameer has quit [Ping timeout: 245 seconds]
nilg has joined #ruby
mikepack has quit [Remote host closed the connection]
<tommylommykins>
be warned: Some utilities gsub \r with zn before printing
<tommylommykins>
that messed timers up
<Paradox>
i'm having trouble installing the termios gem on OS X 10.7 with 1.9.3-p194
<Paradox>
i run gem install termios, and it spits make errors
<koskoz>
what is the gem to install to have the 'Time' library?
maletor has joined #ruby
ringotwo has quit [Remote host closed the connection]
krz has joined #ruby
<Hanmac>
koskoz you dont need a gem for time
roolo has joined #ruby
td123 has quit [Quit: WeeChat 0.3.8]
dekroning has joined #ruby
Dreamer3 has joined #ruby
Vainoharhainen2 has quit [Quit: Leaving...]
havenn has joined #ruby
mrdtt has quit [Quit: Leaving]
zaychenok has quit [Read error: Connection reset by peer]
zaychenok has joined #ruby
<Paradox>
koskoz, it comes built in
<Paradox>
do you mean the addons rails provides?
<Paradox>
they come in actionview and actionpack
jcromartie has joined #ruby
albemuth has quit [Ping timeout: 252 seconds]
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
<deryl>
don't you just have to: require 'time' to get all of the time classes including the stuff that people are debating over merging together into core/stdlib
* deryl
thought i read that was all that was required
digitalcakestudi has quit [Ping timeout: 245 seconds]
<Dl33ter>
How can I add a field like " ALL ", in a grouped_collection_select, in all categories?
snip_it_ has quit [Quit: snip_it_]
walterheck has joined #ruby
zaychenok has quit [Read error: Connection reset by peer]
zaychenok has joined #ruby
Dreamer3 has quit [Quit: Leaving...]
gcds has quit [Quit: gcds]
borkman` has joined #ruby
zaychenok has quit [Read error: Connection reset by peer]
zaychenok has joined #ruby
NimeshNeema has joined #ruby
borkman has quit [Ping timeout: 248 seconds]
<Paradox>
deryl, no, not as of p194…
<deryl>
hh. rolled in then. thanks for the heads up
<Paradox>
the stdlib Time doesn't have changes to Fixnum or time_ago_in_words
mindrag has left #ruby [#ruby]
<Paradox>
like… 10.minutes.ago
<Paradox>
or 10.minutes for that matter
<deryl>
ok so that change was not rolled in. my mistake. thanks :)
zaychenok has quit [Read error: Connection reset by peer]
<Paradox>
those are in actionview i believe
zaychenok has joined #ruby
williamcotton_ has joined #ruby
<deryl>
no no, this i thought wasn't part of the rails related gems. i thought that the time_ago_in_words was added to the portion of ruby that isn't considered core. (Thats stdlib correct? core is, well, core, and then there's stdlib)
jeffreybaird has joined #ruby
williamcotton has quit [Ping timeout: 246 seconds]
williamcotton_ is now known as williamcotton
<Paradox>
aah no
<Paradox>
my mistake
havenn has quit [Remote host closed the connection]
<deryl>
like Date was supposed to have an extender lib that was put into stdlib but not rolled directly into core. and yes, this is me going purely off what i thought i read
<Paradox>
they are in active support
<deryl>
ok. thanks for the clarification
vitoravelino has quit [Ping timeout: 252 seconds]
<Paradox>
afaik, its still not in stdlib
<Paradox>
time_ago_in_words and distance_between… are still in Actionpack
vitoravelino has joined #ruby
vitoravelino has quit [Changing host]
vitoravelino has joined #ruby
<deryl>
got ya
rknLA has quit [Remote host closed the connection]
<Paradox>
and the mods to fixnum and whatnot so you can do 10.minutes or string.titlecase
<Paradox>
are in Activesupport
<deryl>
ok so i'm confused. least i know that
<Paradox>
yeah
<Paradox>
hopefully we'll see those things rolled in in 2.0
<Paradox>
because they are pretty damn useful
<Paradox>
i mean all that 10.minutes returns is 600
<Paradox>
but still
<deryl>
yeah, hope so too.
zaychenok has quit [Client Quit]
<Paradox>
better than having to define your own constants in every program
<deryl>
true
zaychenok has joined #ruby
<deryl>
just lots of these 'little things' going on so not always sure if they've taken place already, are pending, etc. and the intimate details of whats what i'm not always sure where to find the details on
jrist-afk is now known as jrist
<deryl>
just goes with the territory :)
khyron320 has quit [Remote host closed the connection]
arturaz has quit [Ping timeout: 245 seconds]
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
<Paradox>
thats one reason why i prefer ruby to python
<Paradox>
actual community debates
<Paradox>
python, if guido doesnt like something
<Paradox>
he just shuts it down
<Paradox>
hard to imagine matz acting that way
<deryl>
yeah, you'd be hard pressed to get me to believe hed ever go that route
<deryl>
err he'd
<Paradox>
i came up with this analogy in a different IRC chan a week or so ago
<Paradox>
both guido and matz are nerds
<Paradox>
but guido is the guy who got angry and wouldnt play dnd with you if you didnt let him be dungeon master
<deryl>
i mean not like i know the guy personally or anything, just what i read of him and his translated tweets etc, he doesn't strike me as that kind of guy
khyron320 has joined #ruby
<Paradox>
while matz was the one who lol'd at being eaten by a grue
<deryl>
lol
artOfWar_ has quit [Read error: Connection reset by peer]
UNIXgod has quit [Ping timeout: 245 seconds]
zaychenok has quit [Client Quit]
artOfWar has joined #ruby
<deryl>
oops phone
zaychenok has joined #ruby
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
ChampS666 has joined #ruby
twock has joined #ruby
Foxandxss has joined #ruby
koskoz has quit [Ping timeout: 256 seconds]
zaychenok has quit [Client Quit]
<shevy>
lol
zaychenok has joined #ruby
<shevy>
you'd have to be able to speak japanese though, if matz were to be the DM :P
artOfWar has quit [Remote host closed the connection]
davidpk has quit [Quit: Computer has gone to sleep.]
Kunda has quit [Quit: Kunda]
Helius has joined #ruby
davidpk has joined #ruby
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
hydrozen has joined #ruby
bosphorus has quit [Remote host closed the connection]
jrist is now known as jrist-mtg
werdnativ has joined #ruby
zaychenok has quit [Client Quit]
williamcotton_ has joined #ruby
zaychenok has joined #ruby
williamcotton has quit [Ping timeout: 248 seconds]
williamcotton_ is now known as williamcotton
walterheck has quit [Quit: Computer has gone to sleep]
sepp2k has joined #ruby
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
tcopp has joined #ruby
MasterIdler has quit [Quit: MasterIdler]
zaychenok has quit [Client Quit]
MasterIdler has joined #ruby
qwerxy has joined #ruby
zaychenok has joined #ruby
francisfish has joined #ruby
wpaulson has joined #ruby
maletor has quit [Ping timeout: 256 seconds]
maletor has joined #ruby
fayimora has quit [Read error: Connection reset by peer]
fayimora has joined #ruby
fayimora has quit [Read error: Connection reset by peer]
a_a_g has quit [Ping timeout: 244 seconds]
fayimora has joined #ruby
hasrb has quit [Remote host closed the connection]
mdw_ has quit [Read error: Connection reset by peer]
greyEAX has quit [Ping timeout: 260 seconds]
mdw has joined #ruby
manizzle has joined #ruby
UNIXgod has joined #ruby
dotnull has joined #ruby
timonv has joined #ruby
kirun has joined #ruby
maletor has quit [Ping timeout: 245 seconds]
mdw has quit [Read error: Connection reset by peer]
mdw_ has joined #ruby
brngardner has quit [Remote host closed the connection]
hasrb has joined #ruby
maletor has joined #ruby
tewecske has joined #ruby
peregrine81 has quit [Quit: Computer sleeping.]
peregrine81 has joined #ruby
mdw_ has quit [Read error: Connection reset by peer]
Facefox has quit [Ping timeout: 250 seconds]
nipra has quit [Ping timeout: 244 seconds]
mdw has joined #ruby
zaychenok has quit [Quit: Konversation terminated!]
Facefox has joined #ruby
zaychenok has joined #ruby
mdw has quit [Read error: Connection reset by peer]
mdw has joined #ruby
kirun_ has joined #ruby
qwerxy has quit [Quit: offski]
ylluminate has joined #ruby
kirun has quit [Ping timeout: 252 seconds]
alejo has joined #ruby
mdw has quit [Read error: Connection reset by peer]
yoklov has joined #ruby
zaychenok has quit [Read error: Connection reset by peer]
mdw has joined #ruby
zaychenok has joined #ruby
wpaulson has quit [Quit: wpaulson]
williamcotton_ has joined #ruby
qwerxy has joined #ruby
evoltech has left #ruby [#ruby]
fayimora has quit [Ping timeout: 245 seconds]
wpaulson has joined #ruby
the_jeebster has joined #ruby
williamcotton has quit [Ping timeout: 246 seconds]
williamcotton_ is now known as williamcotton
the_jeebster1 has quit [Read error: Connection reset by peer]
olrrai has joined #ruby
mdw has quit [Read error: Connection reset by peer]
mdw has joined #ruby
rizzylt has quit [Ping timeout: 245 seconds]
zaychenok has quit [Read error: Connection reset by peer]
nipra has joined #ruby
zaychenok has joined #ruby
UNIXgod has quit [Changing host]
UNIXgod has joined #ruby
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
fayimora has joined #ruby
<lectrick>
What's the best way to duck-type whether an object is IO-like?
<lectrick>
So far I have respond_to?(:rewind) but I'm not 100% sure
mayankkohaley has quit [Ping timeout: 244 seconds]
zaychenok has quit [Read error: Connection reset by peer]
zaychenok has joined #ruby
<wpaulson>
Checking for :rewind sounds pretty good. What methods are you planning to call on the object after it's typed?
zaychenok has quit [Read error: Connection reset by peer]
zaychenok has joined #ruby
dEPy has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
zaychenok has quit [Read error: Connection reset by peer]
<dEPy>
what is ||= in ruby?
zaychenok has joined #ruby
<xclite>
val || = expr
<epochwolf>
dEPy: if object is false, nil, or undefined, assign it to this.
<xclite>
same as val = val || expr
<xclite>
as epochwolf said, basically initializes something that is falsy
nipra has quit [Ping timeout: 244 seconds]
<epochwolf>
xclite: or undefined
<xclite>
undefined is falsy
<epochwolf>
xclite: it's not in most cases
<epochwolf>
it's an exception
<shevy>
lectrick I usually check for .is_a? directly
<lectrick>
shevy: StringIO.is_a?(IO) #=> false
<epochwolf>
lectrick: if you know you need an IO object, it's okay to check the type directly.
<xclite>
so it is
kirun_ is now known as kirun
federic has quit [Remote host closed the connection]
<Hanmac>
xclite "val ||= expr" and "val = val || expr" is not the directly the same, but similar enough
<epochwolf>
Hanmac: val = will define val as nil
<epochwolf>
before (val || expr) is evaluated
<shevy>
lectrick well seems as if IO and StringIO are not really related to each other or?
theRoUS has quit [Remote host closed the connection]
<xclite>
yay principle of least surprise. ||= is equivalent to: a or a = expr
nanderoo has quit [Quit: Leaving.]
theRoUS has joined #ruby
<Hanmac>
shevy: they are related
<lectrick>
shevy: Well, I guess it's semantics. StringIO doesn't deal directly with files, it just implements the IO calls to a String object
<epochwolf>
xclite: it's not actually, you'll get an exception if a isn't defined.
zaychenok has quit [Read error: Connection reset by peer]
<shevy>
well, are they subclasses of anything else?
zaychenok has joined #ruby
<shevy>
with subclasses, code like this would work fine: class Cat; end; class Dog < Cat; end; cat = Cat.new; dog = Dog.new; cat.is_a? Cat # => true; dog.is_a? Dog # => true; dog.is_a? Cat # => true; cat.is_a? Dog # => false
<xclite>
epochwolf: should have said || but got lazy with the shift
<Hanmac>
shevy, not per subclass because this is not so possible, but they share the same methods
<xclite>
epochwolf: hm even that's wrong. guess my ref was outdated
<shevy>
walks like a duck
<epochwolf>
xclite: val = val || expr is the behavior iirc
<shevy>
quacks like a duck
<shevy>
is a wolf
<shevy>
the epochwolf!!!
graft has joined #ruby
* epochwolf
raises his pimppaw and slaps shevy
zaychenok has quit [Client Quit]
<shevy>
lol
<graft>
anyone okay with REXML here? I am trying to figure out how to get the name of an attribute, and it seems to not exist as a method
zaychenok has joined #ruby
burgestrand has joined #ruby
<epochwolf>
REXML… the horrors
<shevy>
:)
* epochwolf
clings to nokogiri
<epochwolf>
at least nokogiri can validate stuff in a decent manner D:
<shevy>
nokogir is the good looking dress around the bride, but she is still ugly
<epochwolf>
shevy: I'm an enterprise rails developer, it's ugly.
looopy has joined #ruby
<epochwolf>
graft: I'll check some docs for you, which ruby version?
<graft>
i think i avoided nokogiri because i didn't like the way it generates output or something, i forget
<graft>
never mind, i figured it out
ken_barber1 has joined #ruby
<GeekOnCoffee>
shevy: doesn't mean you should put an ugly dress on the ugly bride
<graft>
REXML::Element.attributes doesn't actually return an enumerator of the attributes, it just gives |name,value| pairs
rippa has joined #ruby
<epochwolf>
graft: ow… nokogiri just provides a nice method.
<Hanmac>
shevy: StringIO.ancestors shows some kind of impossible modules :P
<shevy>
I remember I had problems in the past with nokogiri. it was a dependency for mechanize. not sure what changed, but nokogiri didnt work for me back then and neither did mechanize as a result :(
<shevy>
but it was like 2 or 3 years ago
zaychenok has quit [Client Quit]
<epochwolf>
shevy: I've been using it for parsing html and xml for a few years.
<epochwolf>
It's pretty good.
zaychenok has joined #ruby
<epochwolf>
hmm.. maybe just 18 months.
<shevy>
Hanmac, yeah... IO.ancestors is even stranger... # => [IO, is this common that a class has itself as ancestor?
<Hanmac>
this "IO::writable" module is very funny :P
<nw>
graft: REXML is unbelievably slow, though
<nw>
compared to nokogiri
looopy has quit [Remote host closed the connection]
<epochwolf>
nw: it's slow compared to anything
<nw>
epochwolf: true enough
<shevy>
Hanmac, well I still find the ruby separation in modules and classes a bit weird
<epochwolf>
shevy: modules are namespaces
<shevy>
it kinda gives me the message "try to use classes and subclasses"... but with modules, it seems to tell me "ignore subclasses, use separate modules and include them"
<epochwolf>
but they also can act as mixins
wpaulson has left #ruby [#ruby]
hydrozen has quit [Quit: Computer has gone to sleep.]
<shevy>
epochwolf, but people use class Foo; class Bar too. see apeiros_ he once said the toplevel class gives him more options than a module:)
<epochwolf>
shevy: inheritance is a heavy weight tool.
ChampS666 has quit []
hemanth has quit [Read error: Connection reset by peer]
<nw>
i recently migrated a script from REXML to nokogiri… the execution time went down from over two minutes to less than two seconds
wpaulson_ has joined #ruby
<Hanmac>
shevy: goto php and use ther interfaces
<shevy>
ewwwwwww
<shevy>
php!
hemanth has joined #ruby
<epochwolf>
nw: yes, I've seen similar performance changes, especially with xpaths
<shevy>
but who knows... perhaps I will one day
<nw>
epochwolf: yep
itnomad has joined #ruby
<shevy>
there seem to be more php jobs :P
<nw>
so yeah, i really wouldn't recommend using rexml unless you absolutely have to :P
<epochwolf>
shevy: there's more fast food jobs than php jobs
<daed>
hell yeah fast food
<dEPy>
what's .method ?
<daed>
there are more php jobs maybe
<daed>
but holy fuck i'd rather write ruby any day
<daed>
i'd even take a pay cut to write ruby over php
<epochwolf>
daed: pretty much
<shevy>
epochwolf man, I have utmost respect for the fast food folks. I couldn't do such a job
<barefoot>
hehe
<epochwolf>
shevy: O
<daed>
i loved working fast food for the most part
<epochwolf>
shevy: I've done it. I have no respect for those people.
<daed>
at least, the food prep
<daed>
manning drive-thru is the worst experience on earth
<epochwolf>
daed: 1 month at McDonalds, 2 years at subway.
<Hanmac>
depy: .method returns an Method object, its like a time capsule wich you can call later
bosphorus has joined #ruby
<shevy>
daed: hehe
<daed>
epochwolf; 9 months at taco bell, 1 year at papa johns doing delivery
<daed>
i enjoyed both
<Hanmac>
at 03:14:07 UTC on Tuesday, 19 January 2038, epochwolf will apear and swallow the sun
<shevy>
k we still have some years
* epochwolf
hiccups
<shevy>
epochwolf why only one month there?
ghanima has joined #ruby
francisfish has quit [Remote host closed the connection]
<epochwolf>
shevy: a manager punched me. I left.
kvirani has joined #ruby
<shevy>
whoa
<dEPy>
Hanmac closure? closed over an acuall class/object?
<epochwolf>
I also had one of those peopel slip drugs into my drink
<Hanmac>
depy: yeah the Method Objects are similar to a closure/Proc
Seventoes has joined #ruby
hadees has quit [Quit: hadees]
jrist-mtg is now known as jrist
cyong has joined #ruby
tuxaddicted has quit [Quit: leaving]
jeffreybaird has joined #ruby
twixmix has left #ruby [#ruby]
<ghanima>
Let me rephrase is capistrano the right tool for automated tasking if you have to interface with sudo a great deal
stat1x has quit [Remote host closed the connection]
stat1x has joined #ruby
vitor-br has joined #ruby
havenn has joined #ruby
zaychenok has quit [Quit: Konversation terminated!]
vlad_starkov has quit [Remote host closed the connection]
Helius has quit [Remote host closed the connection]
zomgbie has quit [Ping timeout: 245 seconds]
williamcotton has quit [Ping timeout: 256 seconds]
corenumb has joined #ruby
williamcotton has joined #ruby
zaychenok has quit [Client Quit]
hasrb has quit [Remote host closed the connection]
wpaulson__ has joined #ruby
zaychenok has joined #ruby
<corenumb>
why isnt this working https://gist.github.com/2912405 ? it keeps giving me Please Enter -h for more infomation even tho i pass -h argvement
* corenumb
anyone ?
ken_barber has joined #ruby
<RubyPanther>
ghanima: yes
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
<xclite>
corenumb: are you passing a -i also? your if requires both $host and $inj to be set
sepp2k has quit [Read error: Operation timed out]
<xclite>
corenumb: if you pass just -h $inj isn't set.
ken_barber1 has quit [Ping timeout: 244 seconds]
<corenumb>
xclite, but when I do just -h shouldnt it show the help and exit ?
sepp2k has joined #ruby
wpaulson_ has quit [Ping timeout: 265 seconds]
<xclite>
corenumb: I've never used OptionParser but does it just hit the first occurrence of -h?
kapowaz_ has joined #ruby
<corenumb>
hmm
zaychenok has quit [Client Quit]
<xclite>
corenumb: if you remove the first h does it exit as expected?
<corenumb>
xclite, gimme a minit
zaychenok has joined #ruby
Banistergalaxy has quit [Ping timeout: 260 seconds]
xaq has joined #ruby
kapowaz_ is now known as kapowaz
bradb has joined #ruby
zaychenok has quit [Client Quit]
cek has joined #ruby
zaychenok has joined #ruby
<cek>
wondering why isn't my autoload working when execution is 1 class away from parent module
<cek>
says it can't find the constant
<cek>
autoload :A, 'a' ; getting uninitialized constant Top::A when trying to use A.new
ken_barber1 has joined #ruby
<cek>
from within Top::B#some_method
jeremy_carroll has joined #ruby
ken_barb_ has joined #ruby
<jeremy_carroll>
Quick question. Does ruby 1.8.7 have a Random function which takes a Seed? I see 1.9.2 has Random.new.
<cek>
problem solved by moving autoload under Top.
cek has quit [Client Quit]
td123 has joined #ruby
ken_barber has quit [Ping timeout: 265 seconds]
banisete_ has quit [Remote host closed the connection]
<xclite>
jeremy_carroll: after a quick google, there is no Random object in 1.8.7
schaerli has joined #ruby
zaychenok has quit [Read error: Connection reset by peer]
<xclite>
jeremy_carroll: so of course there's rand but I don't see it taking a seed. maybe some doc somewhere elaborates
zaychenok has joined #ruby
ken_barber1 has quit [Ping timeout: 245 seconds]
<jeremy_carroll>
xclite: Yeah. I was coming up blank as well. Was looking for an RNG to get the same values every time based on a seed. Ex: I have an array of 100 servers, and I need 10% of them. Calculate an RNG to pick out 10 numbers from 0-99 with a seed so the same servers are selected every time, even with a failure / retry block
<xclite>
jeremy_carroll: one stackoverflow user mentioned installing the backport gem
<xclite>
jeremy_carroll: which gives you access to Random, among other things, without requiring an upgrade to 1.9.2
zaychenok has quit [Client Quit]
<jeremy_carroll>
xclite: I don't know what else that will affect tho. Wondering if I can just recompile random.c for 1.8.7 in a gem, or something.
zaychenok has joined #ruby
netogallo has joined #ruby
stephenjudkins has joined #ruby
<xclite>
jeremy_carroll: there's a gem called simple-random but I have no experience with it. Most of my dev is local so I keep on the bleeding edge of ruby
nisstyre has quit [Quit: Leaving]
chienpo has joined #ruby
jeffreybaird has quit [Ping timeout: 244 seconds]
cjs226 has quit []
carlyle has quit [Remote host closed the connection]
<jeremy_carroll>
xclite: I hear you. I'm used to 1.9.x branch, but I have some 1.8.x clients that are looking to deploy this.
<jeremy_carroll>
xclite: Thanks for the tips. Looking into that now.
ken_barber has joined #ruby
icooba has quit [Quit: icooba]
fayimora has quit [Ping timeout: 246 seconds]
carlyle has joined #ruby
cyong has quit [Quit: Leaving.]
dcorbin has joined #ruby
dcorbin has quit [Changing host]
dcorbin has joined #ruby
zaychenok has quit [Quit: Konversation terminated!]
Helius has quit [Remote host closed the connection]
<R3dy>
If I do Thread.new{function_that_returns_string(args)}
wpaulson_ has joined #ruby
<R3dy>
I don't get my returned data
d3c has quit [Quit: Quit]
<R3dy>
is ther esomething else I need to do to track that?
<workmad3>
R3dy: well... not surprising
Dr4g_ has joined #ruby
schickung has joined #ruby
<workmad3>
R3dy: the whole point of a thread is that it executes in a different context at a different time... you need to jump through hoops if you want to transfer data between threads (and it's generally advised to keep data sharing to a minimum)
<R3dy>
workmad3: acctually I just want each thread to prepend to an array
hynkle has quit [Quit: hynkle]
<R3dy>
so like I have a method that maeks a call to a website and pulls some data
<R3dy>
it then uses that data to create an instance of a class
geekbri has quit [Remote host closed the connection]
<R3dy>
I am doing this a few thousand times
<R3dy>
so it would be cool to thread it
<R3dy>
to make it faster?
<R3dy>
maybe I don't understand it correctly
<shevy>
R3dy seems you can not easily append data to arrays that way in a thread
<ged>
I.e., you can append to the array inside the thread.
<ged>
Just .join all the threads at the end.
blacktulip has quit [Remote host closed the connection]
<R3dy>
lol man I"m such a newb
<ged>
Or the thread's block will return the last value of the block when you .join if you prefer to not to share the array inside the threads. Which, as workmad3 says is better.
<R3dy>
I don't really get either of the help from shevy or ged
<ged>
Or I guess .value is how you do that under 1.9.
<shevy>
that page explains what it is done with threads
<shevy>
to see the different, remove all thread occurences and run that script again
<eph3meral>
has anyone here successfully gotten ruby-debug-ide19 to play nice with Eclipse 3.7 (Indigo) using the DLTK Ruby plugin? I actually had to modify some of the code in that plugin to get it to not throw errors, and now in my eclipse debugger log, I get messages about connecting to the remote app when I run my ruby program, but then nothing happens, I can't do much from there, can't set breakpoints, don't see anywhere to click step over,
<eph3meral>
or see variables, etc
<eph3meral>
ruby-debug19 itself works fine for me
td123 has quit [Quit: WeeChat 0.3.8]
jeffreybaird has quit [Read error: Connection reset by peer]
lorandi has quit [Quit: Leaving]
<eph3meral>
i'm using the actual ruby-debug-19 gem as opposed to the 'debugger' gem
joshman_ has quit [Ping timeout: 244 seconds]
jeffreybaird has joined #ruby
yxhuvud has quit [Ping timeout: 244 seconds]
<eph3meral>
i've got both rdebug and rdebug-ide available on my path
jgarvey has quit [Ping timeout: 240 seconds]
Markvilla has joined #ruby
Azure has quit [Ping timeout: 240 seconds]
looopy has quit [Remote host closed the connection]
nlc has quit [Ping timeout: 244 seconds]
Azure has joined #ruby
nlc has joined #ruby
pdtpatrick has quit [Remote host closed the connection]
Gm4n has quit [Ping timeout: 244 seconds]
looopy has joined #ruby
pdtpatrick has joined #ruby
mdw has quit [Remote host closed the connection]
azm has quit [Read error: Operation timed out]
looopy has quit [Remote host closed the connection]
Gm4n has joined #ruby
sepp2k has quit [Remote host closed the connection]
nilg has quit [Remote host closed the connection]
bricker88 has joined #ruby
koskoz has joined #ruby
mneorr has quit [Read error: Operation timed out]
wvms has joined #ruby
Vert has joined #ruby
bglusman has quit [Remote host closed the connection]
bglusman has joined #ruby
koskoz has quit [Ping timeout: 244 seconds]
looopy has joined #ruby
nfk has quit [Quit: yawn]
Guest20110 has quit [Ping timeout: 244 seconds]
CannedCorn has joined #ruby
berserkr has quit [Quit: Leaving.]
jeffreybaird has quit [Ping timeout: 244 seconds]
binaryplease has joined #ruby
bglusman has quit [Ping timeout: 260 seconds]
cyong has quit [Quit: Leaving.]
wangr has quit [Ping timeout: 265 seconds]
ylluminate has quit [Read error: Connection reset by peer]
bluenemo__ has quit [Remote host closed the connection]
schaerli has quit [Remote host closed the connection]
bluenemo_ has quit [Remote host closed the connection]
mdw has joined #ruby
denysonique has joined #ruby
medik has joined #ruby
sohocoke has joined #ruby
robbyoconnor has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
robbyoconnor has quit [Read error: Connection reset by peer]
chson has quit [Remote host closed the connection]
theRoUS has quit [Client Quit]
mneorr has joined #ruby
dagnachewa has quit [Quit: Leaving]
<ged>
havenn: Do you find that the Actor pattern is easier to describe to people than just Threads on their own?
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
internet_user has quit [Remote host closed the connection]
hemanth has joined #ruby
<havenn>
ged: If they already understand classes and objects, then I think yes. Adding a '!' to make it concurrent is pretty easy imho.
<lectrick>
why does Hash#delete not end in a bang
<havenn>
ged: I suppose if they don't get Objects, then 'no'.
<workmad3>
lectrick: why should it?
<Karmaon>
How do I add trailing zeros after a number? 1.2 -> 1.20
<ged>
I quite like Celluloid, and am using it for a largish project, but for just fetching a bunch of HTML, it seems like overengineering.
<lectrick>
workmad3: because the general consensus seems to be that any methods that modify the receiver should end in a ! if they can
<ged>
havenn: And your example is glossing over the need for futures with the sleep 10.
<workmad3>
lectrick: that's not the general consensus
<havenn>
ged: true true
<workmad3>
lectrick: that's the general consensus in *lisp*
<workmad3>
lectrick: the ruby idiom is that a ! should be used for a potentially more dangerous variant of a method
<lectrick>
workmad3: There should be 2 versions. Hash#delete should return a copy of the original Hash instance, minus the key. Hash#delete! should delete the key from the receiver and return it if it exists, otherwise return nil
<ged>
I think the second you have any threads that need to talk to *each other*, Celluoid will save you a ton of heartache.
<lectrick>
workmad3: "potentially more dangerous" is bullshit vagueness for "it has side effects or it does not have side effects"
<ged>
I ask because I am going to need to explain Actors and Futures to some people in the near future.
<lectrick>
I think the conceptual division is pretty clear
<workmad3>
lectrick: hardly
digitalcakestudi has joined #ruby
borys_b_timakov has quit [Remote host closed the connection]
<workmad3>
lectrick: various ! methods, both variants have side effects, but behaviour changes
beneggett has joined #ruby
<workmad3>
lectrick: others, neither may modify the receiver, but one may throw exceptions that the other doesn't
<workmad3>
lectrick: if no variants are present, no ! method should be present...
<billiamii>
Does that mean that I should alwasy default to no !... yeah.
<workmad3>
billiamii: I'll be upset with you if you stick a ! on a method for no reason :P
<lectrick>
workmad3: Do you think it is theoretically possible to line all these up into a pattern?
hasrb has joined #ruby
<billiamii>
Well, it's not no reason, it's an incorrect reason :)
<shevy>
well
<shevy>
what methods have a ! in standard ruby
<workmad3>
billiamii: sure :)
<shevy>
noone has such a list!
<havenn>
ged: I agree with everything you've said. I just am enjoying fiddling with Celluloid (my example was sad indeed, but nice to know it's out there and getting used more and more!)!
samwin has joined #ruby
<bricker88>
workmad3: I like unnecessary bangs, makes the code more exciting
<workmad3>
bricker88: you're evil
theRoUS has quit [Read error: Connection reset by peer]
<shevy>
I hate the bangs
<bricker88>
:D
<lectrick>
def omg!
<bricker88>
omgwtfbbq!
<shevy>
but I use them, especially the .gsub! ones
<ged>
In pry: find-method -n \!$ will show you a list.
<shevy>
x = x.gsub(/\d+/,'') vs x.gsub!(/\d+/,'') alone, saves ... uhm... 3 characters I think
<ged>
havenn: It's taken a bit of shifting in the way I think about the problem, but then things just seem to drop into place.
PaciFisT has quit [Quit: Leaving.]
dv310p3r has quit [Ping timeout: 260 seconds]
<workmad3>
aha, Tempfile#close!
mdw has quit [Ping timeout: 256 seconds]
<workmad3>
both close and close! have side-effects (they close the file handle) but close! will unlink it too :)
ciopte7 has joined #ruby
youdonotexist has quit [Remote host closed the connection]
<workmad3>
not to mention Process.exit vs Process.exit!
<havenn>
Why not #each! instead of #map, is there a reason a bang doesn't fit there?
theRoUS has joined #ruby
<workmad3>
havenn: map and map! both exist
hemanth has quit [Read error: Connection reset by peer]
balki_ has joined #ruby
<havenn>
workmad3: Ahh, forgot about that. >.> #each, #each!, and #each!!?!! then =P
<workmad3>
havenn: and each!... what would that do?
<shevy>
die, !-methods, die!
hemanth has joined #ruby
alexander-- has joined #ruby
alexander-- has quit [Client Quit]
wpaulson has joined #ruby
axl_ has quit [Quit: axl_]
<ged>
Hehe.
<shevy>
well, more than one ! would be nice to have
balki has quit [Read error: Connection reset by peer]
* Sigma00
gives shevy a class with !-methods that perform normally, and non!-methods that act on themselves
<workmad3>
shevy: process.die!!!!!!!!
<shevy>
to prioritize which methods are more important than others :>
<shevy>
yeah workmad3 exactly
wpaulson has quit [Read error: Connection reset by peer]
goraxe has joined #ruby
Enekoos has joined #ruby
<shevy>
I am still sad the ennnnd proposal was shot down
<shevy>
imagine it:
<shevy>
def feed_the_cat
wpaulson has joined #ruby
<shevy>
in a class
<goraxe>
hi, I'm looking to learn what the difference between :slave and ':slave' is and how to get to the former from the latter :-)
<shevy>
ennd!!!!
wpaulson has quit [Read error: Connection reset by peer]
<shevy>
goraxe the '
wpaulson has joined #ruby
<shevy>
the second is a string
<goraxe>
string vs other
<shevy>
the first is a symbol
<shevy>
a string object is be different from another string object
<shevy>
a symbol is always its boring same
<shevy>
:cat.object_id # => 1115048
<shevy>
":cat".object_id # => 26642740
<shevy>
":cat".object_id # => 26651280
<goraxe>
okay makes sense
wpaulson has quit [Read error: Connection reset by peer]
wpaulson has joined #ruby
<goraxe>
can I get the symbol named ina string?
<shevy>
:symbols are faster than string objects, if you fill up a hash with one million string objects and one million symbols you will see the difference
qwerxy has quit [Quit: offski]
<shevy>
via .to_sym
wpaulson_ has joined #ruby
<goraxe>
nice shevy thanks
<havenn>
goraxe: :slave.inspect #=> ":slave"
<shevy>
":cat".to_sym # => :":cat"
<havenn>
for the other way around
<shevy>
hmm odd... that output looked different I could swear...
<shevy>
did something change here from 1.8 to 1.9?
<shevy>
oh wait
<shevy>
I dumbed myself down here
<xclite>
"cat".to_sym => :cat
<shevy>
yeah
<shevy>
goraxe, you confused me :P
<goraxe>
I have enough to figure it out
<shevy>
haha
<goraxe>
I had been adding a ':' but that may not be needed
<shevy>
goraxe, the most important thing is... ruby symbols are really boring
<shevy>
yep
<shevy>
when you use .to_sym, the string objects rarely have a leading ':' character