Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
banisterfiend has joined #ruby
sorin has joined #ruby
t0mmyvyo has joined #ruby
saurb has joined #ruby
demet8 has joined #ruby
demet8 has quit [#ruby]
demet8 has joined #ruby
demet8 has quit [#ruby]
wroathe has joined #ruby
emmanuelux has joined #ruby
gyre007 has joined #ruby
Ownatik has joined #ruby
soulnafein has joined #ruby
iocor has joined #ruby
iocor has joined #ruby
<gyre007> rubyists and rubystas?I started learning ruby from the Programming Ruby 2nd edition, the author keeps using the :: in a lot of expressions before clarifying what it actually is for ie SomeClass::Somethin or even SomeClass::Something::Else
<gyre007> anyone could shed some light on this ?
<soulnafein> gyre007: have you used any other prog language before?
nowthatsamatt has joined #ruby
<gyre007> yes, I'm assuming that it is some sort of referencing of the defined variables/objects ?
<soulnafein> gyre007: what language have you used?
<gyre007> like in C++ when you referring to global variable you'd say Class::global_var
<gyre007> C C++
danishkhan has joined #ruby
<soulnafein> are there namespaces in C++?
<gyre007> yes
<soulnafein> so in ruby you have modules
<soulnafein> which you can use like namespaces sometime
<ElderFain> why can't i do something like [var.to_a,var2.to.a]
momo_ has joined #ruby
<ElderFain> i have to do var.to_a; var2.to_a; [var,var2] which kind of bothers me
<soulnafein> gyre007: so if I have a class Dog in a module Animals I refer to it as Animals::Dog
<gyre007> soulnafein: mm I see. ok so this explains one thing
<gyre007> what about Animals::Dog::puppy
MasterIdler_ has joined #ruby
<soulnafein> you can have classes inside classes in ruby
<soulnafein> and modules inside modules
dibri has joined #ruby
<gyre007> I've also seen a case where a class is defined and it has a constant defined as its var, which is ten referenced as CLass::Constant
<gyre007> I mean field, not var
nowthatsamatt has quit [#ruby]
philcrissman has joined #ruby
<banisterfiend> gyre007: so long as it's a Constnat or a class method it can be accessd using the :: notation
<gyre007> so even the class methods can be called via ::
<banisterfiend> gyre007: yah
<gyre007> mm..cool
<banisterfiend> gyre007: have you seen 'labyrinth' ? the movie by jim henson
pdtpatr1ck has joined #ruby
soulnafein has quit [#ruby]
<gyre007> banisterfiend nope, but that name sounds familiar
<gyre007> any good ?
<gyre007> isnt that the puppet guy ?
<gyre007> from Star Wars
randym has joined #ruby
CacheMoney has joined #ruby
twoism_ has joined #ruby
i8igmac has joined #ruby
looopy has joined #ruby
tomzx has joined #ruby
havenn has joined #ruby
tayy has joined #ruby
<tayy> hi everyone! how do i get Mechanize to print http headers?
diegok has joined #ruby
momo_ has joined #ruby
tatsuya_o has joined #ruby
chimkan has joined #ruby
<startling> have any of you folks used citrus? I'm having some trouble walking the parse tree
matthias3 has joined #ruby
ZachBeta has joined #ruby
sythe has joined #ruby
fallen has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
robacarp has joined #ruby
seanstickle has joined #ruby
ZachBeta has joined #ruby
<dark3rdre4ms> Hello, I am trying to compile xchat-ruby against ruby 1.9
<dark3rdre4ms> my problem is ruby.h
<dark3rdre4ms> is it like, ruby/ruby.h
<dark3rdre4ms> actually, nvm
chrxn has joined #ruby
<CacheMoney> I'm trying to use the 'mysql' gem and the website (http://www.tmtm.org/en/ruby/mysql/) states I need to download a .tar.gz file. How do I unzip a file like that?
momo_ has joined #ruby
<startling> CacheMoney: tar xzf myfile.tar.gz
<startling> CacheMoney: that's how you would do it on a unixy os, anyway.
jordanstephens has joined #ruby
<CacheMoney> startling: I did that and got an error message saying "The term 'tar' is not recognized as the name of a cmdlet, fucntion, ....." Do I need to install tar or a tar gem?
<startling> CacheMoney: what os are you on?
<CacheMoney> windows
tsd_usa has joined #ruby
<startling> CacheMoney: ah.
<dark3rdre4ms> CacheMoney: Yeah, that will be a problem
<diegok> CacheMoney: I think winzip is able to uncompress...
andrewhl has joined #ruby
<dark3rdre4ms> Download 7zip
<dark3rdre4ms> 7zip is better really
aBound has joined #ruby
<CacheMoney> dark3rdre4ms: okay I'll check it out. Thanks!
<dark3rdre4ms> you are welcome
<aBound> Hello all, are there any book recommendations for learning Ruby for a beginner like me?
<diegok> dark3rdre4ms: no idea. I would install cygwin und then use tar :)
<dark3rdre4ms> diegok: same
<dark3rdre4ms> aBound: Well, I began learning Ruby with Why's Poignant Guide
<dark3rdre4ms> excellent "book"
<aBound> dark3rdre4ms, I'll check that out.
<startling> aBound: seconding the poignant guide, though it might be slow if you have programming experience already
<aBound> startling, Nope no programming experience here.
<dark3rdre4ms> I also have the book The Ruby Programming Language
<dark3rdre4ms> aBound: yep, why's poignant guide will be great for you :P
<aBound> :P
<dark3rdre4ms> ruby is my first language and now I'm kind of dabbling in C
<dark3rdre4ms> but I don't ever see myself leaving though
<dark3rdre4ms> heck, right now I'm trying to get xchat-ruby to compile for ruby 1.9
g0bl1n has joined #ruby
<aBound> By the way are there any exercises within this book?
<startling> aBound: yes, kind of.
<startling> aBound: it's a weird book. just go with it
<dark3rdre4ms> yeah, kind of
<dark3rdre4ms> yeah it is very weird
<dark3rdre4ms> but very good
<aBound> haha
<aBound> No doubt.
tsd_usa has joined #ruby
jxpx777 has joined #ruby
<dark3rdre4ms> _why definitely had an imagination
<dark3rdre4ms> I wish he would show up out of the blue.
robacarp_ has joined #ruby
<aBound> It does seem a bit weird indeed but I'll get used to it more or less. :P
<dark3rdre4ms> aBound: yes, it will make you laugh
<aBound> Which kind of editors and/or IDE's do you guys tend to use?
wroathe has joined #ruby
nat2610 has joined #ruby
<dark3rdre4ms> aBound: GVIM just for an editor. When I'm really working on a project I use Aptana Studio
<startling> aBound: vim
<dark3rdre4ms> aptana is an excellent IDE
moted has joined #ruby
<aBound> Seems VIM gets a lotta attention. I'll check em both out I have a little to much RAM. :P
<nat2610> Hi, I must be really bad with google but I don't find a nice way to some something like curl --interface eth0.1234 foobar.com in "pure" ruby
<diegok> aBound: RAM is not what you'll need for vim :)
<aBound> I know but he also said Aptana Studio. :P
<aBound> :)
<diegok> aBound: then yes, RAM and a lot of patience I guess :)
mkscrg has joined #ruby
jergason has joined #ruby
<dark3rdre4ms> aBound: you'll need a lot of ram with Aptana studio
<dark3rdre4ms> it's written in Java
<aBound> Patience is a virtue. :-)
<startling> that explains it. :3
<CacheMoney> startling: http://www.tmtm.org/en/ruby/ I unzipped the file with 7zip but I'm still left with a .tar file. Can I use this file on Windows?
<dark3rdre4ms> yep, I can run it with 2GB's of ram, KDE, and a few instances of Chrome open just fine
<startling> aBound: vim should be able to do whatever you need though, if you don't mind the learning curve
<aBound> dark3rdre4ms, Shouldn't be an issue for me with 16GBs of RAM.
colint_ has joined #ruby
<startling> CacheMoney: I have no idea, I don't dev on windows
<dark3rdre4ms> aBound: nope.
<dark3rdre4ms> CacheMoney: extract the tar file
<diegok> aBound: I'm a vim big fan, but there is a new editor that's having a lot of good words around: http://www.sublimetext.com/2
<dark3rdre4ms> the same way you extracted the other one
<startling> CacheMoney: but you do need to untar it somehow
<dark3rdre4ms> I'm an ex-Windows rubyist
<dark3rdre4ms> so, yeah.. >.<
Ripp__ has joined #ruby
<aBound> diegok, I heard about that editor but I seen you had to purchase it or somewhat.
Karmaon has joined #ruby
<diegok> aBound: yep :)
dibri has joined #ruby
<aBound> EX-Windows user. <<
<startling> dark3rdre4ms: welcome home
<diegok> I would prefer to pay to not use a java thingy :p
<dark3rdre4ms> ha
<dark3rdre4ms> diegok: overall it's a pretty nice IDE
<dark3rdre4ms> it's based on Eclipse
<diegok> <puke>
<dark3rdre4ms> :|
<diegok> :-p
<dark3rdre4ms> eclipse is a pretty decent IDE
<diegok> but you need a cluster to start it :p
<aBound> Looks like all I have to do is wait till Ubuntu 12.04 LTS gets released before doing anything special.
<dark3rdre4ms> diegok: LOL
<dark3rdre4ms> I feel right at home here. xD
namidark has joined #ruby
<dark3rdre4ms> lulz
<diegok> dark3rdre4ms: there are two things I dislike in this world: java and eclipse :)
<dark3rdre4ms> well, of course you dislike eclipse because you dislike java
<dark3rdre4ms> lol
<banisterfiend> dark3rdre4ms: that lol was unwarranted i demand u retract it!
<diegok> nah, I don't dislike eclipse because it run on the jvm...
<diegok> I just dislike it for being what it is :-)
<aBound> Some of the bluray disc are written in Java it seems.
<diegok> Indeed, I'm somehow like the jvm but hate java as a computer language.
<diegok> :)
<diegok> java just doesn't fit in my perlish mind :)
<aBound> Alright guys thanks for the advice and I appreciate it. Have a good day. :P
<CacheMoney> dark3rdre4ms: Did you use 7zip on the command line at all when you were developing on Windows?
<dark3rdre4ms> CacheMoney: no
pingfloyd has joined #ruby
headius has joined #ruby
<startling> is there a style guide most people use for ruby?
ylluminate has joined #ruby
pac1 has joined #ruby
eignerchris has joined #ruby
Sailias has joined #ruby
<banisterfiend> startling: yes
<startling> banisterfiend: what is it?
robacarp1 has joined #ruby
jergason has joined #ruby
<startling> banisterfiend: thanks
kcoma has joined #ruby
<startling> I'm used to python and the style guide there is pretty rigid and ubiquitous
<startling> oh hey, first line references pep8.
<banisterfiend> startling: yeah, python is a language for autistic OCDs
<startling> yes, mental health problems are *so* funny
<banisterfiend> for people who dont have them, they can be a bit funny ;)
<banisterfiend> startling: sorry
bstarek has joined #ruby
<bstarek> hello everybody, i am using ArchLinux, and I just got this error message while update ruby gem: http://pastebin.com/ai6Zfwyp
<bstarek> thank you guys for taking a look at this issue, tarek
<josx> google?
<bstarek> josx, i have tried :(
<josx> hmm, if google fails, off the top of my head I'm not sure
<josx> can you install gems with gem install <>?
<banisterfiend> startling: do you use ipython ?
theRoUS has joined #ruby
pu22l3r has joined #ruby
<csprite> didn't ms drop support for ironpy?
albemuth has joined #ruby
<startling> banisterfiend: nah. I just type shit in vim and run it in a different terminal window
<startling> csprite: ipython is a different thing from ironpython
JSchuff has joined #ruby
<csprite> oh ok
<Phlogistique> In Ruby 1.9, Enumerators provide somewhat Haskell-style lazy list manipulations, right?
<Phlogistique> I'm not sure how to go about filtering a list in a lazy way
nim_ has joined #ruby
Richmond has joined #ruby
<banisterfiend> Phlogistique: what kind of thing did u have in mind
<Phlogistique> I have a file
<banisterfiend> Phlogistique: look at this http://www.michaelharrison.ws/weblog/?p=163
macmartine has joined #ruby
g0bl1n_ has joined #ruby
<Phlogistique> from which I'd like to do file.readlines.select{ ... do stuff ... }.each { ... do stuff ... }
<Phlogistique> with the stuff in the "each" block being done before the file is finished reading
<banisterfiend> Phlogistique: yeah we dont have lazy_select yet unfortunately, but we're getting it soon
<banisterfiend> Phlogistique: you can implement it yourself though, easily, check that blog post ^
<Phlogistique> OK, thanks
Sailias has joined #ruby
<startling> oh, neat, enumerators are basically python generators
theRoUS has joined #ruby
<ElderFain> can someone explain why [ object.to_a, object2.to_a ] doesn't work?
<Phlogistique> ElderFain: it does work
<Phlogistique> ElderFain: also: what do you mean it doesn't work?
ceej has joined #ruby
<tsd_usa> ElderFain: you have an array which contains two arrays
<ElderFain> Phlogistique: I have an instance where I'm calling Hash[:symbol => [ ob.to_a, ob2.to_a] ]
<ElderFain> and it does not like it as in, it doesn't work
<ElderFain> i had to move the to_a calls out onto their own lines
fayimora has joined #ruby
<Phlogistique> ElderFain: what does "doesn't work" _means_? what _happens_?
g0bl1n has joined #ruby
baroquebobcat_ has joined #ruby
<ElderFain> sec lemme modify the code to force that path...
<ElderFain> what the shit
<ElderFain> argh this did not work i remember thinking it was stupid that i had to pull it out!!
* ElderFain facepalms
<ElderFain> (it works fine now…)
<Phlogistique> cool.
<ElderFain> sorry for the noise..
yoklov has joined #ruby
cloke has joined #ruby
<startling> how do I get vim to do two space indents if I'm editing a ruby file?
Sailias_ has joined #ruby
adeponte has joined #ruby
asobrasil has quit [#ruby]
havenn has joined #ruby
<davidcelis> .vimrc configuration
i8igmac has joined #ruby
wookiehangover has joined #ruby
nari has joined #ruby
<startling> yes. I don't know what to put in there so that it's my default (on non-ruby files) and two spaces on ruby files.
aers has joined #ruby
<startling> (and neither does #vim apparently; I thought you folks might)
t0mmyvyo has joined #ruby
sdwrage has joined #ruby
shallskins has joined #ruby
andrewhl has joined #ruby
<havenn> startling: Skip the Scala part of this Gist: https://gist.github.com/741111
al3xnull has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
pencilcheck has joined #ruby
<startling> havenn: perfect, thanks
i8igmac has joined #ruby
a_a_g has joined #ruby
<bstarek> josx: can you provide a little more info on installing gems without gem install please?
colint has joined #ruby
mcoffee has joined #ruby
<pingfloyd> just curious, does this channel also rails questions, or is there a channel more dedicated to RoR?
<td123> pingfloyd: #rubyonrails
<pingfloyd> thanks
<td123> bstarek: put gem: --user-install in your /etc/gemrc file, I'm going to make that the default on arch soon :P
<bstarek> td123: thanks man sounds good, are u an Arch user too?
marknyc has joined #ruby
<td123> bstarek: yes :)
<bstarek> td123: nice, have u had a hard time configuring it too? :)
<td123> bstarek: configuring what?
cloke has joined #ruby
i8igmac has joined #ruby
fermion has joined #ruby
baroquebobcat has joined #ruby
<bstarek> td123: ruby gem in order to sync whith other apps?
<td123> oh, no
<pingfloyd> I'm liking Ruby
<td123> bstarek: I unfortunately don't know about your error because everything works over here :/
<bstarek> td123: oh lucky you!
<i8igmac> i always screw up when using Threads... how can i kill all the ruby process's
mrtheshadow has joined #ruby
albemuth has joined #ruby
<bstarek> td123: by the way i cant find the gemrc file under /etc/
<td123> bstarek: I'm going to add it soon
<bstarek> td123: niceeeee!!
<bstarek> td123: let me know
Seisatsu has joined #ruby
<td123> bstarek: an updated ruby to p105 with those changes will be pushed tomorrow to testing and probably move to stable repos soon
<td123> after
<bstarek> td123: great man, are u a developeer?
<td123> ya
mksm has joined #ruby
<bstarek> td123: keep up the good work man
kpshek has joined #ruby
<td123> i plan to :p I still have some more plans for ruby changes (hopefully for the better)
voodoofish4301 has joined #ruby
fayimora_ has joined #ruby
al3xnull_ has joined #ruby
baroquebobcat has joined #ruby
sjang1 has joined #ruby
seivan has joined #ruby
<bstarek> td123:wish u guys good luck
<bstarek> td123:what is arch biggest advantage?
<bstarek> speed is crazy i gotta say
<td123> my favorite is the simplicity and that it doesn't hide anything away from you, you basically get vanilla pkgs
<bstarek> i used to be a debian user ... i am really looking for something more challenging and i have to say that arch puts u to the test from the very first day
<bstarek> agree with you....comes with very limited packages, the rest is your preference
<bstarek> i meant basic packages at the install
<td123> ya, it definitely doesn't sugarcoat anything :P
<bstarek> it doesnt overwhelm the user with extra stuff....u choose u install it
nim__ has joined #ruby
<bstarek> td123: anyway, thanks for the help, im out! ;)
voodoofish430 has joined #ruby
Deele has joined #ruby
<CacheMoney> is anyone famillar with Rubygame?
<CacheMoney> *familiar
saurb has joined #ruby
<RubyPanther> CacheMoney: nobody gets familiar with any of it, everybody is very distant and aloof when use code.
pu22l3r has joined #ruby
Karmaon has joined #ruby
<banisterfiend> CacheMoney: rubygame is dead
<banisterfiend> CacheMoney: use Gosu instead
pu22l3r has joined #ruby
manizzle has joined #ruby
dv310p3r has joined #ruby
nerdy has joined #ruby
<CacheMoney> I just came across it on YouTube, was watching the tutorial but it was old and wondered if anyone still uses it
tangledhelix has joined #ruby
<CacheMoney> thanks, i'll check out Gosu
Sivart has joined #ruby
<CacheMoney> banisterfiend: do you know of any good resources/examples/tutorials for Gosu?
czn has joined #ruby
nim__ has joined #ruby
panthrodeb has joined #ruby
<banisterfiend> CacheMoney: the gosu website, libgosu.org
<CacheMoney> banisterfiend: yeah i'm on there... just curious to know if you had any other resources.
viper1092 has joined #ruby
<banisterfiend> CacheMoney: look at the tutorials that come with the gem
replore_ has joined #ruby
_|christian|_ has joined #ruby
czn has joined #ruby
tsd_usa has joined #ruby
andrewhl has joined #ruby
zakwilson has joined #ruby
cbuxton has joined #ruby
startlin1 has joined #ruby
matthias_ has joined #ruby
mcoffee has joined #ruby
ckrailo has joined #ruby
c0rn has joined #ruby
sorin has joined #ruby
p0y has joined #ruby
ben_alman has joined #ruby
c0rn has joined #ruby
matthias2 has joined #ruby
pu22l3r has joined #ruby
headius has joined #ruby
radic_ has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
chimkan has joined #ruby
pingfloyd has joined #ruby
cashman has joined #ruby
adeponte has joined #ruby
ryannielson has joined #ruby
gokul has joined #ruby
havenn has joined #ruby
<startling> what's the best way to turn a string into an integer?
<ryannielson> "string".to_i
<ckrailo> err ryannielson beat me :P
<startling> thanks!
<ryannielson> ckrailo: You did provide useful docs though, so lets call it a tie.
banisterfiend has joined #ruby
yoklov has joined #ruby
gen0cide_ has joined #ruby
baroquebobcat has joined #ruby
rippa has joined #ruby
al3xnull has joined #ruby
kaiwren has joined #ruby
igotnolegs has joined #ruby
nfluxx has joined #ruby
mrtheshadow has joined #ruby
chaitanya has joined #ruby
jingoro has joined #ruby
nfluxx has joined #ruby
wmoxam has joined #ruby
<startling> are arrays expensive?
<banistergalaxy> startling: in what sense
<startling> is having lots of nested lists bad for performance? I'm trying to figure out the best way to represent linked lists
<any-key> I get mine discounted in bulk
<any-key> you don't really do linked lists per-se in scripting languages
<any-key> that's the interpreter's job
<startling> yes. I'm writing an interpreter.
<any-key> and it does a damn good job, so premature optimization will hurt you
<any-key> ah
<startling> heh.
<any-key> arrays are such a fundamental part of the language that they are very well-optimized
shaatar has joined #ruby
<any-key> you aren't playing with pointers
<startling> meh, I bet I can just cheat and make it look like a linked list to the interpreted script
<any-key> what language are you writing an interpreter for?
<startling> just a toy lispy thing.
<any-key> just use native ruby arrays
<startling> okay, yeah.
ABK has joined #ruby
mikepack has joined #ruby
yoklov has joined #ruby
kanzure has joined #ruby
replore has joined #ruby
dfo has joined #ruby
<dfo> ll'l;'
<any-key> I disagree
<dfo> foktj
<dfo> u decide nothign
kanzure has quit [#ruby]
i8igmac has joined #ruby
kp666 has joined #ruby
n8ji has joined #ruby
gianlucadv has joined #ruby
chaitanya has joined #ruby
a_a_g has joined #ruby
jeffmjack has quit [#ruby]
a_a_g1 has joined #ruby
porco has joined #ruby
chimkan_ has joined #ruby
porco has joined #ruby
Karmaon has joined #ruby
S2kx has joined #ruby
ABK has joined #ruby
matthias3 has joined #ruby
cableray has joined #ruby
nerdy has joined #ruby
Karmaon has joined #ruby
dfo has quit [#ruby]
rickmasta has joined #ruby
CodeZombie has joined #ruby
JohnBat26 has joined #ruby
drewrm has joined #ruby
Karmaon has joined #ruby
tonini has joined #ruby
mcoffee has joined #ruby
djdb has joined #ruby
zomgbie has joined #ruby
enherit has joined #ruby
aBionic has joined #ruby
rickmast has joined #ruby
n8ji_ has joined #ruby
havenn has joined #ruby
trend has joined #ruby
mmercer has joined #ruby
matthias_ has joined #ruby
mmercer has joined #ruby
skyofdwarf has joined #ruby
tbrock has joined #ruby
macmartine has joined #ruby
denom has joined #ruby
CannedCorn has joined #ruby
mmercer has joined #ruby
Karmaon has joined #ruby
randym has joined #ruby
zomgbie_ has joined #ruby
krz has joined #ruby
randym_ has joined #ruby
thone_ has joined #ruby
yxhuvud has joined #ruby
mmercer has joined #ruby
kawa_xxx has joined #ruby
QKO has joined #ruby
havenn has joined #ruby
matthias2 has joined #ruby
ph^ has joined #ruby
Mekkis has joined #ruby
kawa_xxx has joined #ruby
hukl has joined #ruby
senthil has joined #ruby
<senthil> Is getters/settings considered evil in ruby as well?
<senthil> *Ar
<senthil> e
<banistergalaxy> senthil: sometimes
<senthil> banistergalaxy: elaborate please?
<regedarek> Hi guys i have big problem
<regedarek> how to test response in ruby??
<regedarek> http response*
<regedarek> im trying to write tests to gem: https://github.com/regedarek/soup-client/blob/tests/spec/soup_spec.rb but i cant get access to response status or maybe this is not good way to do this??
<senthil> regedarek: i use vcr for anything http related, it hits the external api once and stores the data
havenn has joined #ruby
<senthil> regedarek: next time same http is high, the stored data is used; its fast, but avoids mocking
<regedarek> senthil: ok but im thinking about how to test this by response.should be_success???
<regedarek> i need some tpi for this??
<senthil> regedarek: i might check the response code
krz has joined #ruby
krz has joined #ruby
ieo has joined #ruby
samuel02 has joined #ruby
<senthil> does get refer to HTTParty#get?
remink has joined #ruby
mackid has joined #ruby
<ieo> I was under the impression that "method do..end" and "method {..}" were interchangeable. Am I wrong?
macmartine has joined #ruby
xpot-arcturus has joined #ruby
<regedarek> senthil: i think no
<senthil> regedarek: what exactly is soup.io client?
<senthil> regedarek: api wrapper for soup.io?
<regedarek> yes
<senthil> does the client have a #get method?
<regedarek> no
shadoi has joined #ruby
e|f has joined #ruby
<senthil> ieo: {} is for one line blocks, do...end is for multiple lines
<regedarek> with this client you can only post
GoBin has joined #ruby
<senthil> ieo: {} also has higher preference than do...end
<regedarek> only problem is becose i dont have idea how to use get method when i write tests for gem only
<ieo> senthil: thanks. the reason I ask is because swapping do...end for {...} is giving me a syntax error: http://pastie.org/3392644
<senthil> regedarek: i'm not really sure where this #get comes from
<ieo> I may be doing something rather silly though – I haven't used ruby for a few months so I'm stale
nfluxx has joined #ruby
krz has joined #ruby
nim__ has joined #ruby
hmans has joined #ruby
justfielding has joined #ruby
hmans has joined #ruby
<senthil> ieo: beats me
porco has joined #ruby
<senthil> try rescue_from(ActiveRecord::RecordNotFound) { render_error 404 }
<ieo> senthil: bingo. I think the block was being interpreted as an parameter
<senthil> regedarek: you should remove this line "builder.use Faraday::Response::Logger" when building the faraday object. when i ran the tests it polluted the screen
snearch has joined #ruby
zomgbie has joined #ruby
<senthil> regedarek: @client.new_link("http://wp.pl", title = 'wp', description = 'WP').status.should == ''. if you care just about success/failure, i'd do that
baniseterfiend` has joined #ruby
xpot-arcturus has joined #ruby
DrShoggoth has joined #ruby
<regedarek> thx it works :) thx a lot ;)
<baniseterfiend`> regedarek: np
enherit has joined #ruby
senthil has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
sizz has joined #ruby
twelvechairs has joined #ruby
startling has joined #ruby
bluOxigen has joined #ruby
snearch has joined #ruby
Morkel has joined #ruby
dibri has joined #ruby
snearch has joined #ruby
mafolz has joined #ruby
<twelvechairs> esoteric question. Is there a simple way to be able to sort objects in a regular way (eg by object_id) however, where enumerables, ensure that duplicates (eg. 2 arrays with the same contents) always end up in the same spot?
Guest62662 has joined #ruby
eldariof has joined #ruby
ph^ has joined #ruby
stoffus has joined #ruby
nerdy has joined #ruby
atmosx has joined #ruby
pi3r has joined #ruby
zommi has joined #ruby
simonwh has joined #ruby
JohnBat26 has joined #ruby
bier has joined #ruby
Sliker has joined #ruby
QaDeS has joined #ruby
<CacheMoney> I'm using the 'Crack' gem to parse JSON. However, the .json file I was given is producing an error when I attempt to parse it. Error message reads "line 2: syntax error, unexpected ':', expecting tASSOC". I realize Ruby wants a '=>' in place of the ':'. Is there any way around this?
trivol has joined #ruby
atmosx has joined #ruby
marvin_ has joined #ruby
looopy has joined #ruby
medik has joined #ruby
randym has joined #ruby
zomgbie has joined #ruby
voodoofish430 has joined #ruby
<startling> CacheMoney: don't use that json parser?
<CacheMoney> startling: which do you recommend? I'm new to programming and it's the only parser I've used so far, although it was with XML
neko_gata_s has quit [#ruby]
<startling> CacheMoney: I've never used one; the google might help you
<CacheMoney> thanks
elliot_ has joined #ruby
ephemerian has joined #ruby
cyri_ has joined #ruby
daglees has joined #ruby
daglees has joined #ruby
iocor has joined #ruby
Mekkis has joined #ruby
eldariof has joined #ruby
saurb has joined #ruby
hukl has joined #ruby
choi0hun has joined #ruby
don9z has joined #ruby
fortysixandtwo has joined #ruby
senthil has joined #ruby
saurb has joined #ruby
don9z has quit [#ruby]
bjensen has joined #ruby
DuoSRX has joined #ruby
patjoh has joined #ruby
alek_b has joined #ruby
dross has joined #ruby
fayimora has joined #ruby
willb has joined #ruby
Helius has joined #ruby
stringoO has joined #ruby
Guest14918 has joined #ruby
Mekkis has joined #ruby
gianlucadv has joined #ruby
BiHi has joined #ruby
ikaros has joined #ruby
pen has joined #ruby
nd_____ has joined #ruby
fayimora has joined #ruby
patjoh has joined #ruby
award85 has joined #ruby
award85 has joined #ruby
bluOxigen has joined #ruby
pen has joined #ruby
davidpk has joined #ruby
<shevy> dumdedum
<shevy> who volunteers as my testie!
<baniseterfiend`> shevy: me!
eka has joined #ruby
<shevy> but I need an inexperienced dude who makes many mistakes :(
<shevy> in ancient times, fowl did that
robotmay has joined #ruby
<baniseterfiend`> shevy: fowlie is gone forever left gone away forever gone gone gone
<shevy> yeah :(
bstarek has joined #ruby
<shevy> skyrim changed him
<shevy> I can only warn people about it
iocor has joined #ruby
Mekkis has joined #ruby
Sivart has joined #ruby
kin9 has joined #ruby
krz has joined #ruby
Targen has joined #ruby
iocor has joined #ruby
ephemerian has joined #ruby
bluOxigen has joined #ruby
arturaz has joined #ruby
<CacheMoney> I'm trying to take an array of strings ["a2", "f6", "r1", "a2", ...], take the first character and save it as a key, save the second character as the value in a new hash. I'm having trouble doing this for some reason
iocor has joined #ruby
Ferdev has joined #ruby
<senthil> CacheMoney: Hash[*a]
<senthil> CacheMoney: where a is your array
<baniseterfiend`> CacheMoney: https://gist.github.com/20cbbbb092d001d4d1ef
krzkrzkrz has joined #ruby
krzkrzkrz has joined #ruby
<baniseterfiend`> CacheMoney: is that what u wanted?
bluOxigen has joined #ruby
krzkrzkrz has joined #ruby
<CacheMoney> baniseterfiend: yes that's exactly what i trying to do. Thanks!
simonwh has joined #ruby
|DM| has joined #ruby
iocor has joined #ruby
senny has joined #ruby
etehtsea has joined #ruby
<senthil> baniseterfiend`: is each_with_object like inject?
<baniseterfiend`> CacheMoney: np and remember "baniseterfiend` is the number one, yeah!"
<baniseterfiend`> senthil: no, but it's often used in place of a particular use-case of inject
jbw_ has joined #ruby
Talvino has joined #ruby
<CacheMoney> baniseterfiend: haha. What is the line `h[key] = value doing? Is it saving it to a new hash?
<senthil> CacheMoney: oops, i understood the question wrong
<baniseterfiend`> CacheMoney: no it's saving it to the same hash
<senthil> baniseterfiend`: how is it diff?
<CacheMoney> baniseterfiend: a hash named 'h'?
<CacheMoney> baniseterfiend: nevermind, I understand it now
<baniseterfiend`> senthil: conceptually they're very different, inject reinjects the result of the block back into the block at the next iteration
<baniseterfiend`> senthil: each_with_object just passes in the same object each time
<baniseterfiend`> when you modify the object it's the same object that'll be passed in at the next iteration
<baniseterfiend`> senthil: read the docs ;)
<baniseterfiend`> show-doc Enumerable#inject
<baniseterfiend`> show-doc Enumerable#each_with_object
<senthil> baniseterfiend`: am doing it now
<CacheMoney> baniseterfiend: is that why you use .each_with_object()? So that I don't get duplicated keys?
rohit has joined #ruby
<baniseterfiend`> CacheMoney: no...
<baniseterfiend`> CacheMoney: i use it because u want to build a hash
punkrawkR has joined #ruby
namidark has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
visof has joined #ruby
visof has joined #ruby
<senthil> baniseterfiend`: have you come across this article: http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html
<senthil> baniseterfiend`: i've been trying to decide if its good or bad, curious what you think
<baniseterfiend`> senthil: i like small methods + small classes
<baniseterfiend`> but the rest of it seems kind of hysterical
Muon has joined #ruby
<senthil> baniseterfiend`: me too, the else example is confusing as hell
<rohit> I think that article meant two levels of indentation and not one
<senthil> rohit: one inside a method
<shevy> "9. Don?t use setters, getters, or properties." quite the nonsense really
<senthil> baniseterfiend`: i don't understand 9: don't use setters/getters or properties
<shevy> it does not even explain it
<rohit> Maybe the book explains it
<shevy> hehe
<senthil> i know! i've been googling for a while now
<baniseterfiend`> senthil: i understand it and i think it's probably a good idea for some classes
<Muon> is this thread-safe? if not, how should it be fixed? https://github.com/reagent/etsy/blob/master/lib/etsy.rb#L56
<baniseterfiend`> senthil: the idea is that setter isn't descriptive enough nor does it giev you enough control over the data
<baniseterfiend`> it's too low level
<baniseterfiend`> senthil: so instead of my_object.users << User.new
<baniseterfiend`> senthil: do this: my_object.add_user User.new
<baniseterfiend`> senthil: that way you can also do some basically sanity tests over the data
<baniseterfiend`> so u can raise if someone passes in a Horse.new
<shevy> hehe
<senthil> oh!
<senthil> what about getters? why not use them
Spockz has joined #ruby
<baniseterfiend`> senthil: getters can expose implementation details of your object that u dont necessarily want exposed
iocor has joined #ruby
<senthil> baniseterfiend`: then what's the alternative?
<baniseterfiend`> senthil: also it enables people to change the object outside of your api
<baniseterfiend`> senthil: like, my_object.users #=> a UserCollection instace is returned
tatsuya_o has joined #ruby
<senthil> so return just the details?
<baniseterfiend`> senthil: then someone can just start blindly adding to UserCollection whenever they want
<baniseterfiend`> with none of the safeguards of add_user, and they can also modify it in other ways
<baniseterfiend`> senthil: well some people say if you *really* want a getter then make sure the getter returns a dup of the object instead of teh real object
<baniseterfiend`> so that if some guy does mess with it, it wont affect your actual data
eighty4 has joined #ruby
<senthil> baniseterfiend`: seems paranoid
<baniseterfiend`> senthil: it's just about insuring that people cant mess with your object aside from using your APIs
<baniseterfiend`> ensuring*
<baniseterfiend`> senthil: because you can make guarantees about your APIs and you can be sure that the state of your object is going to be sane
<baniseterfiend`> but if people work around your APIs then all bets are off, and you have to put more error checking code into yoru methods
<CacheMoney> can I sort a hash alphabetically based on it's keys?
<baniseterfiend`> senthil: whereas if you can rely on them using your APIs then you yourself dont have to code so defensively
<senthil> baniseterfiend`: interesting
<senthil> baniseterfiend`: how about you? do you return clone objects?
<senthil> baniseterfiend`: i mean in pry or something
saurb has joined #ruby
simonwh has joined #ruby
<baniseterfiend`> senthil: not really, i just dont provide getters sometimes, but mostly i just dont care as nothing too bad could happen, and anyway the API is not the main way of interacting with Pry, the REPL itself is, so it's kind of different to most projects
<rohit> That blog post only mentions this essay: www.xpteam.com/jeff/writings/objectcalisthenics.rtf
<rohit> the blog post is just the authors summary I guess
<rohit> That essay might be outdated. The Thoughtworks Anthology might have a edited/newer version.
EddieS has joined #ruby
adac has joined #ruby
<senthil> baniseterfiend`: ic, thanks
Jeena_ has joined #ruby
<Jeena_> why is there no alias which is called includes? for Array#include? ?
<shevy> what
<shevy> ah
<shevy> you mean because of proper english
<Jeena_> [1,2,3,4].includes? 7 would be easier
<baniseterfiend`> Jeena_: you join #ruby just to ask that q?:P
<Jeena_> yes
<shevy> yeah
<shevy> the short answer is: matz' english is not the best
<Jeena_> haha
<Muon> why does this not work? http://ideone.com/0apuW
<baniseterfiend`> Jeena_: does [1,2,3,4] include 7 ?
<baniseterfiend`> Jeena_: does [1,2,3,45] includes 7 ?
<shevy> the longer answer is... it's not as simple actually. in general the singular form is preferred. but there was a slight controversy
<shevy> if File.exist?(this_file)
<shevy> if File.exists?(this_file)
<senthil> [1,2,3,4].selects_all ...
<shevy> hehe
<shevy> is that proper english?
adeponte has joined #ruby
<shevy> hmm
<Jeena_> my problem is that I am getting it wrong every single time and have to look it up in the documentation ;)
<shevy> perhaps it also has to do that it is a method applied onto one object?
<shevy> if cat.can_talk?
<shevy> if cats.can_talk?
<shevy> if cat.exist?
<shevy> if cats.exist?
aetaric has joined #ruby
<Jeena_> a simple alias would be less surprise
<shevy> probably
<rohit> The apply to single object hypothesis sounds correct
tvo has joined #ruby
<senthil> you're asking the array does it 'include' this
<shevy> damn array!
<Jeena_> there is never the word "does" in my code alwas if array.include… or while array.include… or unless arra.include...
visof has joined #ruby
visof has joined #ruby
<Jeena_> but perhaps now that I got some possible answers I will remember it
<Muon> what is the malfunction there? how can I mix it in properly?
<Muon> pastie-3393420.rb:15:in `<main>': undefined method `api_key=' for A:Class (NoMethodError)
JStoker has joined #ruby
<senthil> Muon: extend the module
anoNxeRo has joined #ruby
Kambus has joined #ruby
simonwh has joined #ruby
lorenzo_ has joined #ruby
lorenzo__ has joined #ruby
clockwize has joined #ruby
diegok has joined #ruby
tvw has joined #ruby
senthil has joined #ruby
iocor has joined #ruby
sterNiX has joined #ruby
baniseterfiend` has joined #ruby
kreantos has joined #ruby
iocor has joined #ruby
logbot69648 has joined #ruby
kaiwren has joined #ruby
mikewintermute has joined #ruby
kreantos has quit [#ruby]
momo_ has joined #ruby
davidpk has joined #ruby
logbot54291 has joined #ruby
Azure|netbook has joined #ruby
saurb1 has joined #ruby
nemesit has joined #ruby
BrianE has joined #ruby
tayy has joined #ruby
Mekkis has joined #ruby
kstephens has joined #ruby
Spockz has joined #ruby
Sliker has joined #ruby
jwang has joined #ruby
rohit has quit [#ruby]
_headie_ has joined #ruby
dibri has joined #ruby
MrGando has joined #ruby
Russell^^ has joined #ruby
parzo has joined #ruby
flippingbits has joined #ruby
eldariof has joined #ruby
headius has joined #ruby
Jake232 has joined #ruby
voodoofish430 has joined #ruby
malditogeek has joined #ruby
MrGando_ has joined #ruby
tk_ has joined #ruby
rohit has joined #ruby
canton7 has joined #ruby
IAD has joined #ruby
dnyy has joined #ruby
x0F has joined #ruby
aquarian_1981 has joined #ruby
senthil has joined #ruby
Asher has joined #ruby
sv has joined #ruby
bluenemo has joined #ruby
ElderFain has joined #ruby
sacarlson has joined #ruby
karantan has joined #ruby
baniseterfiend` has joined #ruby
<karantan> what does "::" mean in ruby? (class Myclass < Smt::AA::BB)
<sacarlson> is there a way of listing the methods available on an object? my error undefined method `get_active' I want to see what is there that can be done to this object
<Asher> karamtan - namespacing.. just means BB is in the context of AA
<Asher> sacarlson - obj.methods
<sacarlson> ok cool I'll try the pust obj.methods
<sacarlson> opps puts
<shevy> hehe pust pust pust
lorandi has joined #ruby
<baniseterfiend`> Asher: ashraff:)
<Muon> senthil: what about the class << self voodoo?
<Asher> baniseterfiend` what's up
<Asher> muon - opens the context for the eigenclass of self
<senthil> Muon: You don't need it if you extend the module. class << self in a module defines module class methods
<Muon> okay
<baniseterfiend`> Asher: added `up regex` so you can move to the next parent stack frame that matches the regex, pretty fucking sexy if u ask me, ashraff!!
<Asher> neat
<Muon> senthil: but what if I want the module class method thing to remain?
<baniseterfiend`> Asher: so there's a stack frame further up the stack called 'run' (the run method) instead of having to type 'up 5' or whatever to move to it, i can just go: up run
<baniseterfiend`> or even `up r` (if no other matches for r)
tayy has joined #ruby
fayimora has joined #ruby
<senthil> Muon: You want a Module class method and a Class class method of the same name?
pdelgallego has joined #ruby
<Muon> I need backwards compatibility
<Muon> well, I think I need it, anyway
<Muon> the highlighted module is not thread-safe, correct?
<senthil> Muon: is the Etsy module included anywhere?
<Muon> no
<Muon> at present, it's used as that
<Muon> er
<senthil> Muon: but you're?
<Muon> I want to stop having to reset the api_key for every application
<Muon> well, modular Sinatra application
<Muon> senthil: is this the right thing to do?
<senthil> Muon: is what?
twelvechairs has joined #ruby
jlebrech has joined #ruby
<Muon> removing the (global?) module-level configuration and API entrypoints?
pdelgallego_ has joined #ruby
pdelgallego has joined #ruby
pdelgallego_ has joined #ruby
<senthil> Muon: i dont know anything about your app to answer that
pdelgallego_ has quit [#ruby]
<Muon> it's not my gem :P
<Muon> but I'm interested in best practices
iocor has joined #ruby
<sacarlson> Asher that did the trick for me the obj.methods fantastic thanks
phantomfake has joined #ruby
<senthil> is there a destructive version of alias_method? one that frees up the other method name
nari has joined #ruby
<Tasser> senthil, hm? rename?
<rohit> senthil: that would violate the name alias_method know?
<rohit> know==no*
<senthil> rohit: true
<senthil> I just want to free up the method name, so it will go up the method lookup chain
<senthil> Tasser: don't think rename exists
<rohit> My initial thought is remove the method from the class/module
<rippa> just use undef
<senthil> rohit: can't, https://gist.github.com/1844311
<senthil> rippa: undef removes all version of method, i just want to remove one version, so ruby can find the other one
<senthil> i know i can rename the method and then call super so it will look up the path
<senthil> but there must be a easier way
<senthil> #remove_method seem to work
davidpk_ has joined #ruby
MrGando has joined #ruby
looopy has joined #ruby
emmanuelux has joined #ruby
<arturaz> support for jruby + pageant: https://github.com/net-ssh/net-ssh/pull/35 (vote it up! ;)
<headius> woohoo
<arturaz> headius, you're up late ;)
<headius> early!
<headius> my schedule is all screwy these days
<senthil> here's a fun fact: don't do "def self.included?" and wonder why the hook isn't being called when module is included
<arturaz> headius, 6 am? :}
<headius> I think enebo might be initiating JRuby 1.6.7 release today, so I figured I'd scan issues again
<arturaz> oh, i need to run my suite for 1.9 then
<arturaz> :)
<headius> please do!
<arturaz> what branch?
<headius> jruby-1_6 still
<arturaz> okay, will do
bertho_y has joined #ruby
<headius> 30 issues marked as fixed in 1.6.7, heavy on 1.9 stuff
rohit has joined #ruby
<rohit> senthil: is there a remove_method?
BrianE has joined #ruby
otakutomo has joined #ruby
phantomfake has joined #ruby
<senthil> rohit: there is, but I didn't have to use it since alias_method itself frees up the name
<baniseterfiend`> headius: i shoudl probably file an issue, but it seems jruby has this issue too (recently fixed on rbx) https://github.com/rubinius/rubinius/issues/953
<rohit> senthil: oh ok cool
runeb_ has joined #ruby
<headius> system ~/projects/jruby2 $ jruby -e '
<headius> >
<headius> > puts binding.eval("__LINE__")
<headius> > '
<headius> 4
<headius> not sure I see the problem
<headius> fwiw, I looked into this today for arturaz...binding carries a filename and line number with it, so it's going to be the file and line at the point you call binding
<headius> it's not the line at which you call eval
<arturaz> yeah, that makes sense :)
<arturaz> use binding.eval str, __FILE__, __LINE__
<arturaz> as headius pointed out
<headius> baniseterfiend`: oh, I see...if you hit __LINE__ earlier it uses that again
<headius> as with rbx, passing explicit line works
iocor has joined #ruby
<headius> I'm not sure how useful __LINE__ is here anyway if you're not passing explicit file and line to eval
trivol has joined #ruby
<baniseterfiend`> headius: we need to recover the original line using binding.eval("__LINE__") though, but for us it just always returns 1
<headius> it's not going to reflect what you think it does
<headius> "original line"?
<baniseterfiend`> whereas we need the line that the `binding` method was called on
<headius> so you actually want the line where binding was called
<baniseterfiend`> headius: yeah
<headius> not the line where you eval
<baniseterfiend`> headius: right
<headius> what for?
<baniseterfiend`> headius: in MRI, if we store that binding and later on call that_binding.eval("__LINE__") we get thet line where the `binding` method was originally invoked
<baniseterfiend`> headius: for a debugger
<baniseterfiend`> headius: they invoke: `binding.pry` in tehir code, and we want to display lines of code either side of that, to capture the context around the `binding.pry` call
<headius> mmm ok
<baniseterfiend`> so we grab that_binding.eval("__LINE__") and then retrieve 5 lines +- that line
zommi_ has joined #ruby
<headius> sure
<headius> that's totally bizarre that it resets to 1
visof has joined #ruby
visof has joined #ruby
<headius> I don't know why that would happen
<headius> __LINE__ is just parsed directly into a fixnum AST node
<headius> system ~/projects/jruby2 $ ast -e "__LINE__"
<headius> AST:
<headius> RootNode 0
<headius> NewlineNode 0
<headius> FixnumNode 0
<headius> I don't know why hitting it would cause binding's behavior to change
mengu has joined #ruby
<headius> ahh, this is a bug in the compiler
<headius> it works in interpreter
<baniseterfiend`> interesting
nari has joined #ruby
<headius> both interpreters are ok
rohit has quit [#ruby]
<headius> heh, I know why
<headius> compiled code doesn't track line numbers
<headius> the JVM does it at that point
<headius> baniseterfiend`: file the bug
<headius> it's nontrivial
davidpk has joined #ruby
<headius> a core optimization in JRuby's compiler is eliminating the tracking of line numbers that other impls have to do
<baniseterfiend`> headius: thanks, it's really edgecasey and we can get around it anyway using caller() but i'll file it anyway
<headius> yeah, caller works because it actually walks the JVM stack trace
<headius> binding would have to do something similar, or I'd have to have the compiler pass position information to it at the point of call
iaj_ has joined #ruby
gvt has joined #ruby
telling has joined #ruby
telling has joined #ruby
Muz has joined #ruby
kaktus has joined #ruby
tessi has joined #ruby
mbreit has joined #ruby
dcarper has joined #ruby
sayakb has joined #ruby
randym has joined #ruby
bluenemo has joined #ruby
LMolr has joined #ruby
pdelgallego_ has joined #ruby
pdelgallego has joined #ruby
bjensen has joined #ruby
pdelgallego has quit [#ruby]
pdelgallego_ has quit [#ruby]
pdelgallego_ has joined #ruby
pdelgallego_ has quit [#ruby]
Jeena_ has quit [#ruby]
pdelgallego has joined #ruby
MoMo has joined #ruby
dl3r has joined #ruby
<nim__> i'm trying this
<nim__> def show
<nim__> @kiniseis << @current
<nim__> @current.x = @nextpos.x
<nim__> @current.y = @nextpos.y
<nim__> puts @current.x
<nim__> puts @current.y
<nim__> puts @kiniseis.last.x
<nim__> puts @kiniseis.last.y
<nim__> end
<nim__> why th last element in kiniseis Array changes when i change the current.x and the current.y
<nim__> any ida?
<nim__> idea
<baniseterfiend`> headius: sorry where do i go to file issues for jruby?
chaitanya has joined #ruby
<baniseterfiend`> nm i found it
fayimora has joined #ruby
<senthil> if you've two modules with same name methods and include them in a class, will calling super on the last one call the first one?
<baniseterfiend`> senthil: the last included one will call the first included one
<JonnieCache> yes
<JonnieCache> rails 3 is heavily based on that pattern
<senthil> really? its not happening to me
palcu has joined #ruby
ixti has joined #ruby
palcu has joined #ruby
<senthil> baniseterfiend`: only solution i can think is to get the method directly and bound it like you mentioned a while back
jamesaxl has joined #ruby
<baniseterfiend`> senthil: my gosh that code is crazy
<baniseterfiend`> :)
<Phlogistique> nim__: because arrays are copied by reference
<senthil> baniseterfiend`: hehe, i'll take that as a complement
<Phlogistique> if you want it not to happen you have to use @current.clone
<baniseterfiend`> senthil: why not just call super by default
<baniseterfiend`> instead of post-hoc decorating the methods with a super call
<senthil> Then Single.new.map wouldn't work
<nim__> thx senthil
<senthil> I should've named it better, Single and Double are linked lists. Iteration and IterationReverse Enumerable like modules
iocor has joined #ruby
<nim__> i found it
<senthil> nim__: found what?
jds has joined #ruby
nanderoo has joined #ruby
<baniseterfiend`> senthil: i think whatever your'e doing that code is much too complicated, at least in my 4 years of ruby i've never had to write code like that
sterNiX has joined #ruby
<senthil> baniseterfiend`: hmm
<nim__> i'm too tired and i make some stupid mistakes
<nim__> thx anyway
<nim__> :)
<baniseterfiend`> senthil: but it's a learning process i think, it's good you know how to write code like that, and solve complicated metaprogramming puzzles
<arturaz> um, where do you host gems now?
<baniseterfiend`> cos then at least u know how to do it
<baniseterfiend`> even if eventually you stop doing things like that
<senthil> nim__: glad to help
<nim__> :)
<senthil> baniseterfiend`: yep!
<JonnieCache> yeah code like that is all well and good but it shouldnt be allowed near anyone whos givign you money
gavit has joined #ruby
<senthil> all i'm trying to do is renaming the methods in IterationReverse to _reverse if Iteration is included
<senthil> *rename
<senthil> I mean add _reverse at the end of them
BiHi has joined #ruby
<JonnieCache> renaming methods is just mean
<JonnieCache> add new methods based on old ones, fair enough, but renaming methods is just pulling the rug out from under the poor developer
<senthil> JonnieCache: I don't disagree with you one bit. Just playing around with stuff really.
<JonnieCache> yeah fair enough. you could try undefine_method
<JonnieCache> think thats what its called
<JonnieCache> instead of just trying to overwrite it like that
<senthil> JonnieCache: I tried it earlier, it undefed it from the module, not just the class like i want
g0bl1n has joined #ruby
`brendan has joined #ruby
jds has joined #ruby
gabeh_ has joined #ruby
jlebrech has joined #ruby
banseljaj has joined #ruby
nemesit has joined #ruby
looopy has joined #ruby
hukl has joined #ruby
<headius> baniseterfiend`: bugs.jruby.org
<headius> oh, you got it
gabeh has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
malditogeek has joined #ruby
fermion has joined #ruby
mengu_ has joined #ruby
ryannielson has joined #ruby
mikewintermute has joined #ruby
Ownatik has joined #ruby
gabeh has joined #ruby
wyhaines has joined #ruby
sacarlson has quit [#ruby]
phantomfake has joined #ruby
pencilcheck has joined #ruby
Spockz has joined #ruby
JonSchuff has joined #ruby
wroathe has joined #ruby
BrianE has joined #ruby
berkes has joined #ruby
snearch has joined #ruby
emmanuelux has joined #ruby
<senthil> zzzz time, laters
asobrasil has joined #ruby
jtrudeau has joined #ruby
amacgregor has joined #ruby
csavola has joined #ruby
gvt has joined #ruby
enroxorz has joined #ruby
enroxorz has quit [#ruby]
enroxorz-work has joined #ruby
wmoxam has joined #ruby
badelat has joined #ruby
td123 has joined #ruby
badelat has joined #ruby
PragCypher has joined #ruby
kf8a has joined #ruby
yoklov has joined #ruby
linoj_ has joined #ruby
skaczor has joined #ruby
yekta has joined #ruby
speggey has joined #ruby
speggey_ has joined #ruby
pu22l3r has joined #ruby
Inode has joined #ruby
Inode has quit [#ruby]
Mekkis has joined #ruby
thecreators has joined #ruby
tayy has joined #ruby
crankycoder has joined #ruby
TheDeadSerious has joined #ruby
yfeldblum has joined #ruby
geekbri has joined #ruby
jergason has joined #ruby
jxpx777 has joined #ruby
jxpx777_ has joined #ruby
ab5tract has joined #ruby
<ab5tract> anyone here tried to access an object instance of a class with a mixin, from within the mixin code itself?
<arturaz> How do I add dependency to gemspec for specific platform?
cantbecool has joined #ruby
<Tasser> arturaz, RUBY_PLATFORM? :-)
Elwell has joined #ruby
<arturaz> Tasser, in gemspec?
<Tasser> arturaz, nah, that was 'define platform'
<arturaz> s.add_dependency 'jruby-pageant' if RUBY_PLATFORM == "java"
<arturaz> My only thought is to have "fake" gem with nothing inside and ruby platform
<Elwell> Hi - What's the preferred way of pulling user lookup info out of AD -- http://rubyforge.org/projects/activedirectory/ looks a bit unmaintained.
<Elwell> do it with the raw LDAP queries?
svg_ has joined #ruby
<svg_> is any trouble with gd2 in ruby 1.9?
<svg_> I cant run anything
karantan_ has joined #ruby
karantan has quit [#ruby]
<svg_> i get this:
<svg_> gd2.rb:53: warning: else without rescue is useless
iocor has joined #ruby
Uni has joined #ruby
carlyle has joined #ruby
<svg_> gd2 not working is any other library to graphics in ruby 1.9 ?
cantbecool has quit [#ruby]
derailed_ has joined #ruby
theRoUS has joined #ruby
Jake232 has joined #ruby
robotmay has joined #ruby
<ab5tract> nevermind, i had a hiccup that led me to believe 'self' wasn't working
<CannedCorn> guys, i've got a method that can take host+port arrays as arguments currently and i want to have it take a single array of strings instead
pencilcheck has joined #ruby
dv310p3r has joined #ruby
Muon has quit ["PLANE SHIFT!"]
saurb has joined #ruby
<arturaz> here we go, for all you net-ssh/pageant needs: https://github.com/arturaz/jruby-pageant & https://github.com/net-ssh/net-ssh/pull/35
drknus has joined #ruby
lateau_ has joined #ruby
milkpost has joined #ruby
robotmay has joined #ruby
zommi has joined #ruby
tomzx has joined #ruby
bbttxu_ has joined #ruby
yoklov has joined #ruby
namidark[w] has joined #ruby
rippa has joined #ruby
jgarvey has joined #ruby
frontendloader has joined #ruby
denom has joined #ruby
jeekl has joined #ruby
jeekl has joined #ruby
zulax has joined #ruby
virunga has joined #ruby
<CannedCorn> can't really think of how to do it in an elegant way
philcrissman has joined #ruby
<virunga> we should do ruby proselytizing in the other prog langs channels :D
<virunga> like "you could that much easily in Ruby"
<virunga> *do
csherin has joined #ruby
Skaag has joined #ruby
Skaag has joined #ruby
pencilcheck has joined #ruby
csavola has joined #ruby
porco has joined #ruby
<geekbri> What is the difference between require and include?!=
phantomfake has joined #ruby
PaciFisT has joined #ruby
headius has joined #ruby
<CannedCorn> is using blah.first.last bad form?
<virunga> geekbri, include?
<virunga> CannedCorn, what's blah?
<virunga> or include?!=
hck has joined #ruby
Jay_Levitt has joined #ruby
jxpx777_ has joined #ruby
bitrot has joined #ruby
enherit has joined #ruby
Sailias_ has joined #ruby
<pencilcheck> is there a standard way in ruby to debug? is there a guide for that?
<geekbri> virunga i meant just "include" the other where just my exasperation :)
<csavola> geekbri: require is a short cut for class << self; include foo; end
p0y has joined #ruby
nowthatsamatt has joined #ruby
<rippa> csavola: you mean extend ?
nowthatsamatt has quit [#ruby]
<csavola> rippa: yeah my bad. no caffeine this morning
<virunga> geekbri, include A couple of points about the include statement before we go on. First, it has nothing to do with files. C programmers use a preprocessor directive called #include to insert the contents of one file into another during compilation. The Ruby include statement simply makes a reference to a named module. If that module is in a separate file, you must use require to drag that file in before using include. Second, a Ruby include does not simply c
<virunga> opy the module's instance methods into the class. Instead, it makes a reference from the class to the included module. If multiple classes include that module, they'll all point to the same thing.
<virunga> from ruby-doc
<virunga> good for meta-programming i think
<geekbri> ah i see.
<geekbri> or at least i think i get it
albemuth has joined #ruby
adambeynon has joined #ruby
wmoxam has joined #ruby
<virunga> u make a ninja wanna fuck bitch
waxjar has joined #ruby
albemuth has joined #ruby
rfloriano has joined #ruby
emmanuelux has joined #ruby
<geekbri> Well i'm gonnna guess thats unrelated.
saurb has joined #ruby
shlevy has quit [#ruby]
<virunga> :)
<virunga> is there anyone from Canada?
<twixmix> virunga: Absolutely.
Skaag_ has joined #ruby
<virunga> twixmix, absolutely in english means absolutely yes or absolutely no?
<twixmix> virunga: Yes, I meant yes.
<virunga> in my language the former
<virunga> ah ok
gabeh_ has joined #ruby
<virunga> twixmix, is there in Canada penal servitude like in USA?
kp666 has joined #ruby
<virunga> twixmix, do you work with ruby?
<twixmix> virunga: Can't say I know if there's Penal Servitude or not.
<deryl> yeah. do something stupid you end up in prison, and then get to work the road gangs
<twixmix> virunga: And I do some ruby on the side, not for my day job though.
<virunga> i thought Canada was a civil country...
<virunga> :)
<deryl> that is civil
<deryl> absolutely nothing wrong with having prisoners repair roads, clean up trash, make license plates
BrianE has joined #ruby
<virunga> constrain they to worl against their will..
<deryl> you did something wrong, you got busted. you're doing time to pay back society for the stupidity you did. doing all that during your sentence is A) perfectly legal and B) how you pay back society. :shrug:
<deryl> virunga: tough shit. net time tell them not to break the law and be so stupid
<deryl> s/net/next/
Mosselman has joined #ruby
<Mosselman> hi guys, I am getting a " `encode': "\xCC" on US-ASCII (Encoding::InvalidByteSequenceError) " error when I run: `find -L "#{path}" -type f ! -name '.*'`.encode('UTF-8').split("\n")
<deryl> *excessive* abuse of a prisoner is wrong. using them without regard for sleep, pain, ect is wrong. Just because they're a prisoner doesn't mean you trat them like shit. However most countries treat their prisoner population like crap. the USA isn't the only one
sorin has joined #ruby
<Mosselman> Before that I used to get errors about ASCII as well, but it was a different one.
<virunga> deryl, my country is between them country
jds has joined #ruby
<virunga> anyhow..
<deryl> virunga: myriad of different ways to handle the troublemakers amongst us. Unfortunately, in order to handle that mass, the innocent sometimes get lost in that system. a system not designed *for* innocents.
emmanuelux has joined #ruby
<deryl> yeah, anyhow ;)
<Mosselman> It happens when it encounters files with names that include special chars.
emmanuelux has joined #ruby
jxpx777_ has joined #ruby
spanner has joined #ruby
senthil has joined #ruby
<virunga> deryl, last thing: give a look at the servitude etymology
emmanuelux has joined #ruby
<virunga> :D
<virunga> but i understand yuor point of view
<deryl> virunga: i spent most of my adult life in the military. Servitude was my mddle name :)
<deryl> <grin>
jxpx777- has joined #ruby
jxpx777-_ has joined #ruby
<virunga> :)
emmanuelux has joined #ruby
<shevy> yeah even without "i"
<shevy> only remember the necessary things :>
<deryl> hehe
msuszczy has joined #ruby
moshee has joined #ruby
<deryl> "There is no 'I' in TEAM, troops! Remember that!"
gregorg has joined #ruby
gregorg has joined #ruby
<deryl> oh, and you quickly remove the word 'volunteer' from your vocabulary
<virunga> :D
emmanuelux has joined #ruby
<deryl> ok, time to walk the pooch, then come back to sit and stare aimlessly at the screen while I try to pull a few blog articles from my brain.
<deryl> later
<virunga> bye
kp666 has joined #ruby
DrShoggoth has joined #ruby
namidark[w] has joined #ruby
<Phlogistique> Mosselman: if it's not guaranteed to be valid UTF-8 data, don't encode it in UTF-8
<Phlogistique> or you will run into horrible nightmares
BrianE has joined #ruby
<Mosselman> Phlogistique: what should I do then? Because this is breaking my app.
macabre has joined #ruby
<Phlogistique> Mosselman: what do you want to do with your "find" results?
<Mosselman> Is there a standard lib that will allow me to list all paths inside of a subfolder? Because that is basically what that thing is doing. But then in a way that WILL give me valid utf-8 nameS?
audy has quit ["Textual IRC Client: http://www.textualapp.com/"]
<Phlogistique> Mosselman: Dir["*"] should be closer to what you're looking for
perturbedpanda has joined #ruby
<Tasser> Mosselman, depends on your filesystem
<Mosselman> I am using 'play' and app by github for playing music at the office. What the find command does is list all files inside of the specified folder (path) and then the script will split each new line and scan the audio file at every full path to a file and index it.
<Mosselman> Phlogistique: thanks, I will look into that.
elliot_ has joined #ruby
<Mosselman> Tasser: I am on unix, mac to be precise.
kp666 has joined #ruby
<Phlogistique> Mosselman: then you don't need it to reencode it?
jwmann has joined #ruby
<Phlogistique> https://github.com/candlerb/string19 anyway, here is a tutorial about strings in Ruby 1.9
<Mosselman> Phlogistique: well the problem was that before reencoding I would get errors when non ASCII files were found.
<Phlogistique> (I can't give much more help without ranting)
<Phlogistique> Mosselman: oh
<Mosselman> even setting utf-8 everywhere in the app I could possibly think of didn't help
<Mosselman> Phlogistique: I can take it ;), thanks for the help so far. I will dive into this some more.
bbttxu_ has joined #ruby
<Phlogistique> that's Ruby 1.9 for you. Try setting everything to BINARY instead? (default external, default internal, and source code)
neurodrone has joined #ruby
neurodrone has joined #ruby
<Mosselman> I will give that a try
nemesit has joined #ruby
emmanuelux has joined #ruby
TaTonka has joined #ruby
<Mosselman> hmm no changes
<Phlogistique> tbf, yesterday I was working on a quick & dirty web app of mine and used some Ruby 1.9 syntax in the process (keyword arguments). Just before saving the file, I felt cold sweat dropping in my back just thinking of how many ways it would fail if I ran it through Ruby 1.9; so I made it 1.8 compatible and ran it under 1.8.
kp666 has joined #ruby
BrianE has joined #ruby
dyer_ has joined #ruby
senthil has joined #ruby
sixdahs has joined #ruby
<Phlogistique> Mosselman: could you provide a minimal failing exemple?
ph^ has joined #ruby
kp666 has joined #ruby
iocor has joined #ruby
<Mosselman> as in the error I got back?
C0NNER has joined #ruby
<Phlogistique> yes; a minimal exemple exhibiting your problem
etehtsea has joined #ruby
<Mosselman> sure thing
<Mosselman> hang on
emmanuelux has joined #ruby
emmanuel_ has joined #ruby
tsd_usa has joined #ruby
<Mosselman> this is the file that executes the code, I have been messing around in it so it might look like shit sometimes
<Mosselman> the error
<Mosselman> I could do a puts of the filename it crashes on
nowthatsamatt_ has joined #ruby
kp666 has joined #ruby
<Phlogistique> http://sprunge.us/iDXC
<Phlogistique> Mosselman: the above works for me
S1kx has joined #ruby
n3m has joined #ruby
<Mosselman> Phlogistique: thanks :) I will put that in
<Mosselman> see what happens :)
<Phlogistique> Mosselman: 1. Your file begins with coding: utf-8, therefore litteral strings are UTF8
<Phlogistique> therefore "\n" in split("\n") is UTF8
<Phlogistique> so split can only operate on UTF8 strings
<Mosselman> yeah it should be
<Mosselman> oh like that
<Mosselman> hmm
<Mosselman> I hate this encoding, too much of a noob
notjohn has joined #ruby
<Mosselman> :)
<Mosselman> I will give your snippet a try
kp666 has joined #ruby
mephux has joined #ruby
<Phlogistique> my snippet is not what rubyist would advise, mind you; I just find 1.9's behaviour so horrible that I do that in order to get an as-naive-as-possible 1.8-like behaviour
<Mosselman> Phlogistique: I want it to work first, then I'll see if I can get it 'pretty' later :).
<Mosselman> I got further ahead though, now it is giving my mysql errors about collations, so I am getting closer :)
<Phlogistique> Mosselman: by the way, you can avoid doing split("\n") by using String#to_a :)
<Mosselman> Phlogistique: that might actually work better.
<Mosselman> I didn't write that piece of code for getting all file names. The guys at github did.
<Mosselman> doesn't mean they wrote it in the best way possible. kind of ugly even to do it like that if you ask me, instead of using default libs
<Phlogistique> 17:04:53 < Mosselman> Phlogistique: I want it to work first, <- I just helped you slipping the problem under the carpet; the program is still wrong
<Phlogistique> but by asking Ruby to be naive, you can get it not to notice it.
chimkan_ has joined #ruby
blueadept has joined #ruby
<Mosselman> Phlogistique: true, but that is how debugging sometimes goes
<Phlogistique> yeah, the problem with Dir["**/.*"] is that it won't follow symlinks
<Mosselman> There is also the 'File' class no?
<Phlogistique> yeah but it doesn't provide a method for that
skitrees has joined #ruby
soulnafein has joined #ruby
sterNiX has joined #ruby
emmanuel_ has joined #ruby
<Mosselman> `query': Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
fr0gprince_mac has joined #ruby
<Tasser> Mosselman, looks like you need to reencode those data
<Mosselman> yep
<Mosselman> Tasser: just doing that, seems to work for now.
<Tasser> #encode('utf-8') # =
TheShrew has joined #ruby
<Tasser> Mosselman, why 'for now' - that's the correct way to do it
<Mosselman> Tasser: because I have tried several possible solutions to this encoding problem, some more for a while and then another exception comes up. So I have learned not to trust it when I don't get errors the first time round.
skitrees has joined #ruby
<Mosselman> Phlogistique: thanks for the help, it seems to be working now.
<Mosselman> Tasser: what does "# =" do?
statarb3 has joined #ruby
emmanuelux has joined #ruby
alex__c2022 has joined #ruby
gvt has joined #ruby
Targen has joined #ruby
chimkan has joined #ruby
maxyz_ has joined #ruby
mayankkohaley has joined #ruby
<Tasser> Mosselman, that was a comment (#) and should have been a ?
<Mosselman> Tasser: haha sorry, got confused I am doing this: `find -L "#{path}" -type f ! -name '.*'`.encode('UTF-8').split("\n")
<Mosselman> is that wrong?
dkannan has joined #ruby
tsd_usa has quit [#ruby]
<Tasser> Mosselman, so you want all dotfiles?
hoelzro has joined #ruby
andrewhl has joined #ruby
blenny has joined #ruby
<Mosselman> no just all files in all subfolders of {path}
emmanuelux has joined #ruby
Nathandim has joined #ruby
skitrees has joined #ruby
pdelgallego has joined #ruby
_srp has joined #ruby
Spockz` has joined #ruby
mikepack has joined #ruby
lkba has joined #ruby
graft has joined #ruby
spanner has joined #ruby
<graft> okay, how do i replace all but the last occurence of a match?
<graft> specifically if i have a string like "blah.blah.blah.ok.wut" I want to squash all the . except for the last one
enroxorz has joined #ruby
samsonjs has joined #ruby
senthil has joined #ruby
addisaden has joined #ruby
<virunga> graft, a ugly idea is find the first match starting from the end and then search the matches in the substring from 0 to the point of the that match. This because i don't regular exp in Ruby
<theRoUS> does anyone know of a way in ruby to extract the same information from an ssh pubkey file as 'ssh-keygen -l' does? namely, the encryption type, the fingerprint, and the number of bits? i can get the fingerprint all right, but the other parts are still stumping me..
spanner_ has joined #ruby
headius has joined #ruby
<virunga> *know
<hoelzro> graft: /\.([^.]+)\./?
cbuxton has joined #ruby
lkba has joined #ruby
<hoelzro> hmm...actually you would have to invoke that multiple times...nevermind.
LnL has joined #ruby
<hoelzro> you *could* extract everything up until the final dot, replace all of the matches in that prefix, and prepend to it to the original suffix
skitrees has joined #ruby
<graft> this is the best i got: .sub(/(.*)(?=\.)/) { |m| $1.sub(/\./,"") }
<graft> basically what you just said :)
ckrailo has joined #ruby
<graft> theRoUS: why don't you just go read the ssh-keygen source?
fayimora has joined #ruby
jergason has joined #ruby
<theRoUS> graft: haven't found it (haven't done more than a cursory search, though).
<theRoUS> graft: was hoping it had already been done.
<hoelzro> theRoUS: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/openssh-5.9.tar.gz
<graft> theRoUS: if you're on ubuntu you can just do apt-get source openssh-client
<graft> etc.
<graft> or that :)
<theRoUS> d'oh, i always forget about using the package manager to get the source..
adeponte has joined #ruby
LnL has quit ["[self quit];"]
kaiwren has joined #ruby
philips has joined #ruby
<JonnieCache> almost all ssh functionality is in net::ssh afaik
lkba has joined #ruby
a_a_g has quit [#ruby]
<hoelzro> if I want to make a gem that contains a C extension, is it pretty standard to have rake build the .so for me? or is make still used?
* hoelzro is new to Ruby development
skitrees has joined #ruby
stayarrr has joined #ruby
<JonnieCache> theres a whole thing where the rake generates the makefile
<JonnieCache> but i dont know how it works. someone here will
sterNiX has joined #ruby
ZenoArrow has joined #ruby
<JonnieCache> looks like a bit of a mess tbh but as I say I've never done it
<hoelzro> hmm
trend has joined #ruby
<JonnieCache> although tbf anything to do with make/autoconf always looks a mess to me
dcarper has joined #ruby
ChampS666 has joined #ruby
<hoelzro> this looks promising: http://rake-compiler.rubyforge.org/
gvt has joined #ruby
simonwh has joined #ruby
sarkis has joined #ruby
<ZenoArrow> Hi all, quick question, should be straightforward to answer. Having problems with 'each_with_index'. Please see code here: http://pastie.org/3395622
<ZenoArrow> Can anyone explain why it's not working for me? Even if you're not sure, I'm open to suggestions!
<JonnieCache> i dont think the index does what you think it does
<ZenoArrow> Okay, can you explain further?
<JonnieCache> what should in your mind be happening with that code?
<JonnieCache> i dont know hwat youre trying to do
ByteCrunch has joined #ruby
<ZenoArrow> What I'd like is to print each array item, just like the top code does
<senthil> ZenoArrow: include rowarray
<virunga> ZenoArrow, Does that code run?
minijupe has joined #ruby
<JonnieCache> ah ok well the index variable is a counter which increases with each iteration of the loop
enroxorz has joined #ruby
enroxorz has joined #ruby
<JonnieCache> whereas the line does the same thing as it does in the top example
wedgeV has joined #ruby
<JonnieCache> so if you wanted it to do the same thing you would just puts line like in the top one
<graft> ZenoArrow: you just want rowarray[index] instead of line[index]
ZenoArrow_ has joined #ruby
<JonnieCache> what youre doing is treating the each item in the array as if it were an array itself, using the [] syntax. what that does depends on whats in the array
<graft> line is still the same as it is in the first loop, it's the actual array element, you're indexing into it instead of into the array
<graft> yeah
Sliker has joined #ruby
<ZenoArrow_> Sorry, lost connection, back now. What did I miss?
<graft> heh
<graft> ZenoArrow: you just want rowarray[index] instead of line[index]
<graft> make sense?
<ZenoArrow_> Let me explain...
enroxorz-work has quit [#ruby]
<ZenoArrow> This code is just a test for using FasterCSV
<ZenoArrow> As far as I know, I need to be able to add each array item individually, that's why I'm trying out each_with_index
stayarrr has joined #ruby
ph^ has joined #ruby
<ZenoArrow> So, perhaps a better example would be, how do I print out all array items with index ID 5..9 ?
<Phlogistique> ZenoArrow: array[5..9].each &:puts
<senthil> rowarray[5...9]
<senthil> ZenoArrow: add as in addition or add to another array
<ZenoArrow> Phlogistique, senthil, yes I know that, but I can't hard code the indexes, it was just an example.
tommyvyo has joined #ruby
<ZenoArrow> senthil, let me start from the beginning.
<graft> a very good place to start
<ZenoArrow> ;-)
<Phlogistique> ZenoArrow: here's a corrected version of your code http://sprunge.us/Baii
<ZenoArrow> Let's say I have a CSV file with 25 lines. What I want to to is take that CSV file, look for a certain line of text in each line, write the lines that match to an array, then overwrite the CSV with the array contents (so that the only lines that remain are those that had the text I searched for). Does this help explain what I'm doing?
davidpk has joined #ruby
<Phlogistique> yes, but you could do it in a much simpler way
<Phlogistique> see Array\#select
<Afal> or even not use ruby and just use grep on the command line
Mekkis has joined #ruby
<Phlogistique> Afal: indeed
<senthil> or ack
<hoelzro> ack++
<Phlogistique> or grep using ruby by doing ruby -ne 'print if ~/regex/'
<senthil> what is ack++
<graft> ZenoArrow: do you mean certain line by index, or certain line by match?
<ZenoArrow> I'm definitely open for suggestions, whatever's easiest!
<hoelzro> senthil: I'm just agreeing that ack is awesome =)
<Phlogistique> ZenoArrow: easiest is just using grep
<senthil> hoelzro: oh lol
voodoofish430 has joined #ruby
<graft> i agree with Phlogistique it seems like you don't care about its CSV-ness at all
<graft> and you can use Array.filter or some such
<graft> err Array.map i guess
<ZenoArrow> Phlogistique, tried your amendment, seems to work. Thanks. :-) However, now I'm interested in grep. So let's say I was looking for the text "_Opened_", how would I iterate through all .csv files in a folder and overwrite the files so that only the rows with that line of text was returned?
<graft> can't keep my languages straight
danishkhan has joined #ruby
<Phlogistique> ZenoArrow: for i in *.csv; grep -i 'that line of text' $i; done
<graft> ZenoArrow: if you want in-place edits in the shell with sed or something, #ruby is probably not the place to ask
kenperkins has joined #ruby
davidcelis has joined #ruby
<Phlogistique> wait, grep does not have in-place edit?
<graft> i don't think so
<Phlogistique> well
<graft> grep is just regexp search, as it should be
<graft> sed does in place edits though
<graft> and also does regexp matching
<ZenoArrow> Okay, I'll go digging into sed. Thanks for all of your help!
<graft> probably easier in ruby tho
<graft> with Dir.glob() and File.open
<Phlogistique> then ruby -pe 'print if ~/regex/' -i file
<Phlogistique> for i in *.csv; ruby -pe 'print if ~/regex/' -i $i; done
<graft> that won't update the file for him tho
<Phlogistique> yes it will
<graft> oh -i i see
coucher has joined #ruby
yxhuvud has joined #ruby
<graft> that seems pretty short and sweet
<ZenoArrow> Will try that out now, thanks!
yopp has joined #ruby
jgrevich has joined #ruby
<Phlogistique> well, except it's -ne, not -pe
kpshek has joined #ruby
<JonnieCache> why use bash for loops with grep when you can just use the awesomeness of ack?
ieo has joined #ruby
<theRoUS> JonnieCache: KeyManager doesn't want to deal with just-plain-.pub files, apparently.
<senthil> Phlogistique: running "for i in *.rb; ruby -ne 'print if ~/Rails/' -i $i; done" - i get bash: syntax error near unexpected token `ruby'
* theRoUS keeps snooping through net::ssh
<Phlogistique> senthil: yeah, you're missing a "do"
<yopp> anyone tried to build ruby on OSX 10.8 preview?
<Phlogistique> for i in *.rb; do ruby -ne 'print if ~/Rails/' -i $i; done
<JonnieCache> yopp: is the preview actually out?
SegFaultAX|work has joined #ruby
savage- has joined #ruby
<JonnieCache> thought it was just an announcement
<yopp> JonnieCache: yup, availiabe in mac dev center
<ZenoArrow> Ah, I should've mentioned, I'm running Windows (I've got Linux installed though), sed and awk aren't available as far as I can tell.
<ZenoArrow> Might have to wait until I get home.
fermion has joined #ruby
<JonnieCache> i may abandon osx in favor of linux tbh. not happy at all about this signing bollocks
<hoelzro> ZenoArrow: http://gnuwin32.sourceforge.net
<ZenoArrow> hoelzro, thank you.
<yopp> JonnieCache: you can disable it. but, anyway, someday they silently remove this feature :)
CacheMoney has joined #ruby
<JonnieCache> i was really excited about smashing all my money on a new macbook pro when they come out, with their 15" retina displays and such.
ZenoArrow has quit [#ruby]
<JonnieCache> dont care if you can disable it, its the default. thats bad enough
<yopp> it's a geek-talk. regular users don't need to care about malware crap
badabim has joined #ruby
<yopp> they want just to work, and code signing is good solution.
<senthil> Phlogistique: oops, thanks
<JonnieCache> yes and regular users wont be able to use software not sanctioned by the ghost of jobs
<JonnieCache> we all know what its like trying to get apple to approve your code
samsonjs has joined #ruby
<JonnieCache> how long before they deny keys to apps that compete with them like they do on the iphone?
<deryl> they approve code for non pets?
<deryl> :)
danishkhan has joined #ruby
mikepack has joined #ruby
<deryl> (as in pet devs, not animals)
<JonnieCache> they could easily have implemented a system of keys like apt uses, where anyone can have unlimited free keys which can then be revoked if an app is bad. instead they choose not to. the only possible reason for this is that they want to exert control in the future
C0NNER has quit [#ruby]
<Phlogistique> ZenoArrow: well, yeah, or install cygwin; anyway, with ruby it isn't much harder: Dir["*.csv"].each {|f| l = File.readlines(f).select{|i| i=~/regex/}; File.open(l,'w') {|h|h.print l}}
maletor has joined #ruby
<hoelzro> JonnieCache: that's the problem; it's not about what they *could* do, it's about what they *want* to do
<hoelzro> which, in my opinion, is lock down your Macbook as tight as your iPad
<JonnieCache> bascially they can fuck off and die. suggestions for high quality notebook hardware welcome to jonnie@cleverna.me
<deryl> JonnieCache: when steve was alive he made no qualms about stating thats exactly what they were trying to do. only difference is apple's never admitted they were doing it to block competing apps.
* hoelzro is a big fan of his new ThinkPad
<JonnieCache> i am going to miss osx though
<hoelzro> JonnieCache: hackintosh?
<JonnieCache> i guess i can still use it at work
<deryl> his reason was 'application quality'
<graft> what is a retina display anyway?
<JonnieCache> hoelzro: just because im not paying for it doesnt solve the moral problem
<hoelzro> JonnieCache: ah
<JonnieCache> graft: display with 10x the resolution of normal displays. basically the iphone screen
<JonnieCache> means you have to have a resolution-indpeendent GUI.
<JonnieCache> it may not actually be in the next macbook pros but its definitely coming
<graft> must be expensive to have a 15" version of that
adeponte has joined #ruby
<JonnieCache> the price will drop so much through when they start ordering those quantities
<JonnieCache> remember when the price of NAND flash plummeted through the floor when the ipod nano came out?
<graft> i wasn't paying attention...
MrGando has joined #ruby
<graft> is that better for your eyes?
<JonnieCache> no idea
<JonnieCache> it certainly makes fonts easier to read
hooper_ has joined #ruby
<robacarp> I doubt its better for your eyes
<robacarp> staring at a streen is hard work regardless of what resolution
<robacarp> but they look amazing
<davidcelis> not better, not worse
<davidcelis> its still looking at a screen
davidpk has joined #ruby
<davidcelis> just a much sexier screen
<JonnieCache> it might reduce the mental strain from reading a lot of text in some scenarios i guess
<graft> well you don't have to worry about subpixel hinting and fuzzy lines and stuff like that
<robacarp> JonnieCache: I could easily be convinced of that...my kindle epaper display is much easier to read
<graft> although i guess it might mean 90% of the internet becomes wallet-sized
henrico has joined #ruby
<henrico> anybody from california or NY here plz pvt-me
<robacarp> graft: apple is smart enough to compensate for pixel density...unlike...well nevermind
<JonnieCache> thats a good point, 90% of css uses px
daniel_hinojosa has joined #ruby
<davidcelis> em
<Phlogistique> JonnieCache: yeah but browsers support zooming while preserving proportions
<Phlogistique> (because so much people use px)
<JonnieCache> yeah true so they could just have it autozoom
tangledhelix has joined #ruby
<JonnieCache> still itll inevitably be another massive compatibility headache for us web people
cloke has joined #ruby
soulnafein has quit [#ruby]
<henrico> shall move to wheter california or NY i'm gathering information about thsese placies anyone who can help me here
Araxia has joined #ruby
<theRoUS> JonnieCache: Net::SSH::KeyFactory.load_public_key(FILE) seems to be pretty close to what i want, but still not quite (just fyi)
<JonnieCache> cool
phux has joined #ruby
<theRoUS> JonnieCache: still looking for something that'll get me the type, the bits (size), the fingerprint, and the comment from the .pub file. i can so far get everything except the size in various ways
nowthatsamatt has quit [#ruby]
renanoronfle has joined #ruby
<JonnieCache> cant you calculate the size manually?
<JonnieCache> if you can get the actual key string then surely you can convert it to binary and get its size in bits
hobodave has joined #ruby
saurb has joined #ruby
TheTFEF has joined #ruby
TheTFEF has joined #ruby
<theRoUS> JonnieCache: except for leading zeroes being dropped
Sum10Code has joined #ruby
<JonnieCache> hmmm how do you mean
<JonnieCache> where are they being dropped?
_john has joined #ruby
Knodi has joined #ruby
minijupe has joined #ruby
BBonifield has joined #ruby
lorandi has joined #ruby
MrGando has joined #ruby
sorin has joined #ruby
tommyvyo has joined #ruby
<robacarp> sometimes I insert a debugger statement, refresh the page and start to get frustrated when its taking forever
adamkittelson has joined #ruby
saurb has joined #ruby
alfism has joined #ruby
flak has joined #ruby
patjoh_ has joined #ruby
robotmay has joined #ruby
chrxn has joined #ruby
mikepack has joined #ruby
emocake has joined #ruby
<senthil> what's the cmd to output info about gist, is it !gist?
<robacarp> I think only certain people are qualified to run !commands
<senthil> ah man
<senthil> i want to yell that ppl
<senthil> *at
carlyle has joined #ruby
nfluxx has joined #ruby
rafa2000 has joined #ruby
eignerchris has joined #ruby
derailed_ has joined #ruby
<JonnieCache> robacarp: yes and then you refresh the page like 10 times causing the requests to queue up for when you kill the debugger, then leading to more debuggers
<robacarp> :-D
<JonnieCache> it would be nice to use fibers to cause pry/rdebug to squirt html into the page when it fires
<JonnieCache> would probably be a horrible mess to do that though
yopp has joined #ruby
csherin has joined #ruby
emocake has joined #ruby
marvin_ has joined #ruby
remink has joined #ruby
voodoofish430 has joined #ruby
Mosselman has joined #ruby
waxjar has joined #ruby
johnn has joined #ruby
cbuxton has joined #ruby
bluOxigen has joined #ruby
milkpost has joined #ruby
apok has joined #ruby
mikepack has joined #ruby
<apok> matt: very strange, i get this error: ActionController::RoutingError (No route matches [GET] "/users/sign_in"):
<apok> sorry wrong room
kidoz has joined #ruby
trivol has joined #ruby
svg__1 has joined #ruby
tvo has joined #ruby
Sailias_ has joined #ruby
<johnn> rake question... i have some code to import a CSV table into an ActiveRecord model, this is not in rails (just ruby), how can i point to the 'environment' task so i don't get: "Don't know how to build task environment"? I'm not really sure where to look since i'm very unfamiliar with this
mickn has joined #ruby
<johnn> right now i'm scrubbing data and it's getting to be too much to store in memory obviously, and i wrote the script in ruby--so i don't know if pure SQL would make more sense or not
tayy has joined #ruby
<senthil> johnn: gist your Rakefile
Azure has joined #ruby
Azure has joined #ruby
samxor has joined #ruby
eywu has joined #ruby
snearch has joined #ruby
Morkel has joined #ruby
akemrir has joined #ruby
samsonjs has joined #ruby
TheTFEF has joined #ruby
akemrir has joined #ruby
ctp has joined #ruby
tatsuya_o has joined #ruby
akemrir has joined #ruby
gen0cide_ has joined #ruby
nd______ has joined #ruby
Silker has joined #ruby
sarkis has joined #ruby
banseljaj has joined #ruby
dnyy has joined #ruby
v0yager_ has joined #ruby
Sliker_ has joined #ruby
alindeman has joined #ruby
Nathandim has joined #ruby
shajen has joined #ruby
<shajen> hi
<shajen> how can i get 5 the largest elem from array?
hobodave has joined #ruby
hobodave has joined #ruby
<Tasser> shajen, the 5 largest?
<shajen> [1,2,3,4,5,6,7,8,9] should return [5,6,7,8,9]
dv310p3r has joined #ruby
<shajen> without sort :)
<Sp4rKy> you should do your school exercises yourself ;)
<shajen> it isnt to school :) but to my private project
<shajen> i dont knwo how to do it :(
nfluxx has joined #ruby
<Sp4rKy> why without sort then ?
<Sp4rKy> I guess that your initial array is not sorted ?
<shajen> yes, not sorted :0
<Guest37874> you could use #max
<Guest37874> delete that element
<Guest37874> and iterate
<ElderFain> array.each_with_index.max
sonkei has joined #ruby
<shajen> yes, but i'm not sure this idea
mkscrg has joined #ruby
theRoUS has joined #ruby
<ElderFain> arr = [1,2,3,4,5,6,7]; arr[arr.rindex(arr.max)];
<ElderFain> theres two ways without sort, just apply the rest of your logic
<Guest37874> ElderFain: why not just arr.max?
<Guest37874> what index is for?
<ElderFain> Guest37874: so you can pop it out
<ElderFain> he doesn't need the max
<ElderFain> he needs the alrgest ones
<ElderFain> so pop out one, then pop out the next one, which is easy with the index
akemrir has joined #ruby
<rippa> ElderFain: a.delete(a.max)
<ElderFain> ElderFain: =p lots of ways to skin a cat =)
akemrir has joined #ruby
sterNiX has joined #ruby
mengu_ has joined #ruby
Silker has joined #ruby
akemrir has joined #ruby
Guest____ has joined #ruby
akemrir has joined #ruby
theRoUS has joined #ruby
dcarper_ has joined #ruby
berserkr has joined #ruby
luckman212 has joined #ruby
jergason has joined #ruby
baudehlo has joined #ruby
macmartine has joined #ruby
Liothen has joined #ruby
<baudehlo> I'm trying to load thin (or mongrel) with rackup. Both gems are installed. But running "rackup -s thin" gives me: /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': cannot load such file -- thin (LoadError)
akemrir has joined #ruby
<baudehlo> if I just do ruby -e 'require "thin"' it works fine. Anyone help me where to look to debug this?
fayimora has joined #ruby
jxpx777 has joined #ruby
<senthil> baudehlo: are you using bundler?
<baudehlo> senthil: I don't know much about ruby, am I?
<baudehlo> we have a Gemfile.lock - is that where I need to look?
justinmcp has joined #ruby
<senthil> baudehlo: that means you're using bundler
<senthil> look into Gemfile (not Gemfile.lock)
<senthil> see if there's thin in there, if not add to it like: gem 'thin'
<baudehlo> k
<senthil> then you'll need to get the gem: run "bundle install" in a terminal
zakwilson has joined #ruby
tommyvyo has joined #ruby
<baudehlo> woo, you're a rock star.
<baudehlo> senthil++
bash` has joined #ruby
<bash`> hi all
<bash`> what's wrong here? http://dpaste.com/704075/
<bash`> relevant part "/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- vendor-specific"
gvt has joined #ruby
Deele has joined #ruby
cesarstafe has joined #ruby
hmans has joined #ruby
Hanmac has joined #ruby
<cesarstafe> hi people, how can I pass a value from milliseconds to timestamps? this value in miniseconds was got in Gregorian value
<cesarstafe> Time.at(63495940431409 /1000) => 3982-02-08 12:13:51 -0500
<cesarstafe> this is not working I guess ... somebody knows how to do that?
ghanima has joined #ruby
<rippa> cesarstafe: Time.at(63495940431409 /100000) =>1990-02-14 05:36:44 +0400
<rippa> what date should it be?
Sum01Code has joined #ruby
andremaha has joined #ruby
<cesarstafe> but.. it should be 2012-02-08
nfluxx has joined #ruby
Sum01Code has joined #ruby
<cesarstafe> let me see another date
c_wraith has joined #ruby
trivol_ has joined #ruby
<cesarstafe> rippa: Time.at(63496632219709/100000) => 1990-02-13 22:32:02 -0500 and it should be 2012-02-16 14:22:34 -0300
nfluxx has joined #ruby
<cesarstafe> this value '63496632219709' was convert from date in gregorian
<rippa> what's your origin?
<hoelzro> cesarstafe: where exactly are you getting that figure from?
<hoelzro> 2012-02-16 14:22:34 is 1329412954
<hoelzro> (in my test)
stephenjudkins has joined #ruby
<cesarstafe> hoelzro: mmmm... so maybe the Erlang time is doing something more on that value
<rippa> I got it
<rippa> his origin is 0000 year
<cesarstafe> I am getting this value from stored documents throug an erlang app
<rippa> Time uses UNIX epoch
<cesarstafe> ah..
<hoelzro> rippa: wow, nice call
<cesarstafe> and so, exist a way to get the rigth date value with Ruby?
danishkhan has joined #ruby
<rippa> Time.at((63496632219709/1000)+Time.new(0).to_i)
davidcelis has joined #ruby
<JonnieCache> subtract the number of seconds in 1970 years i guess
<cesarstafe> rippa: I will try it
<JonnieCache> unless ive fundamentally misunderstood
CannedCorn has joined #ruby
Spockz_ has joined #ruby
Fraeon has joined #ruby
badabim_ has joined #ruby
<cesarstafe> rippa: I am closser
<cesarstafe> Time.at((63496632219709/1000)+Time.new(0).to_i) => 2012-02-16 17:19:41 -0500
csherin has joined #ruby
<rippa> off by how much?
<cesarstafe> the value should by the next 2012-02-16 14:22:34 -0300
<senthil> time zone diff?
<cesarstafe> there is a way to say if you wants UTC values
<cesarstafe> yes
<cesarstafe> I think so
<rippa> Time#utc
<rippa> thought that does not explain the minutes
<cesarstafe> yes, I have see the minutes difference
<rippa> ruby counts since 1970
<rippa> so maybe there's different method of counting
<rippa> leap seconds and all
<rippa> that may account for it
<c_wraith> Is the return value of Integer#times (the number if the loop terminated normally, nil if it does not) intentional and documented anywhere?
baudehlo has quit [#ruby]
<cesarstafe> with UTC option I get more difference
<cesarstafe> Time.at((63496632219709/1000)+Time.new(0).to_i).utc => 2012-02-16 22:19:41 UTC
<cesarstafe> and should be 2012-02-16 14:22:34 -0300
<Uni> try subtratring Time.now.nsec instead of Time.new(0).to_i perhaps?
tangledhelix has joined #ruby
<rippa> c_wraith: when you exit block with break it returns whatever you passed to break
<cesarstafe> ok, I will
<rippa> so without parameters it returns nil
<rippa> returning number is intentiona
<rippa> l
<Uni> and noor adding rather
<Uni> irc is hard
<rippa> last line of C code
<rippa> return num;
fayimora_ has joined #ruby
<cesarstafe> Uni: Time.at((63496632219709/1000) - Time.now.nsec) => 3970-12-27 08:43:32 -0500
<cesarstafe> Time.at((63496632219709/1000)+Time.new(0).to_i - Time.now.nsec) => 2006-11-02 15:26:31 -0500
<c_wraith> rippa: right, finally found more complete documentation of break. Took me much longer than I expected
chimkan has joined #ruby
<rippa> yeah, docs are somewhat lacking
<cesarstafe> so, i guess that the clossest data that I got was Time.at((63496632219709/1000)+Time.new(0).to_i)
<cesarstafe> * date
c_wraith has quit ["Leaving"]
<rippa> cesarstafe: find offset experimentally and use that
<cesarstafe> maybe differences in three hours are just localtime differences
<CannedCorn> when creating documentation comments
<CannedCorn> what is the second paramater to @param
minijupe has joined #ruby
<cesarstafe> rippa: how do you say? .. try with offset for Time?
<senthil> cesarstafe: one has -0500, another has -0300, so that's only two hours
<CannedCorn> i'm having a really hard time trying to find the specifications for it
<senthil> CannedCorn: in rdoc or yard?
<rippa> cesarstafe: find how many ms you have to add/substract to get the right time
<cesarstafe> senthil: yes, it's true
<rippa> and use that
<cesarstafe> ah
<cesarstafe> ok
<cesarstafe> understood
<CannedCorn> yard
albemuth has joined #ruby
pingfloyd has joined #ruby
irakli has joined #ruby
Jay_Levitt has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
Sum01Code has joined #ruby
gvt has joined #ruby
<cesarstafe> many thanks people
<CannedCorn> with yard how do you get an example text to stretch many lines
robotmay has joined #ruby
rossimatteo has joined #ruby
<rossimatteo> room
badabim has joined #ruby
<CannedCorn> hrm
<rossimatteo> hi
clockwize has joined #ruby
td123 has joined #ruby
<CannedCorn> that didn't work
rubyrobw has joined #ruby
<rubyrobw> good evening everyone!
S2kx has joined #ruby
Ferdev has joined #ruby
<rubyrobw> I would really appreciate it if someone could help me with some Rails basics
<rubyrobw> I'm getting the following error: rake db:create Could not find gem 'rails (= 3.2.1) ruby' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
<rubyrobw> I've already run 'bundle install'
<rubyrobw> Any ideas?
cbuxton1 has joined #ruby
<rubyrobw> Should I update my Gemfile? If yes, how?
hukl has joined #ruby
kpshek has joined #ruby
saurb1 has joined #ruby
<td123> rubyrobw: use rvm to create an isolated environment
<rubyrobw> any Rails pros out there?
<rubyrobw> ok
<senthil> rubyrobw: try #rails
<rubyrobw> what's the process?
<td123> rubyrobw: create a gemset, and never run gem update in it, only use bundle install to manage it
<td123> rubyrobw: read the rvm docs for more info
<cesarstafe> try to install rails 3.2.1 using 'gem install rails v=3.2.1'
<cesarstafe> and run again bundle
<senthil> rubyrobw: see if gem list rails returns the right gem or try "bundle update"
<rubyrobw> I have installed the RVM
<rubyrobw> bundle update didn't work
kirun has joined #ruby
<rubyrobw> I'm running Ruby 1.9.2 and Rails 3.2.1
<senthil> rubyrobw: bundle install --path vendor (it copies the gems into your vendor/)
jergason has joined #ruby
a_a_g has joined #ruby
senthil has quit [#ruby]
marvin_ has joined #ruby
senthil has joined #ruby
<rubyrobw> senthil: I tried that that - thanks - and: bundle exec rake -T - No luck yet
<senthil> do "bundle exec rake -T --trace" and paste that into gist
<rubyrobw> This as well: bundle exec rake db:migrate
<rubyrobw> gist? (apologies for my ignorance)
<senthil> gist.github.com
henrico has joined #ruby
jamw has joined #ruby
Shamgar has joined #ruby
<rubyrobw> I read somewhere that I should update my Gemfile?
<shajen> i have in my controller sth like @all=Corporation.includes(:quotations)
stephenjudkins has joined #ruby
<shajen> how can i include only 2 last quotations (order by date)
luckyruby has joined #ruby
<luckyruby> what logging library does ruby on rails use?
havenn has joined #ruby
<rubyrobw> zlib
fayimora has joined #ruby
<rubyrobw> senthil: what do I do in github once the file has been generated?
<senthil> rubyrobw: huh? i mean copy and paste the error you're getting into gist, so we can tell teh exact nature of it
sorin has joined #ruby
<tommylommykins> hmm, is there any reason to prefer "@thing = initialize_thing unless defined? thing" or "@thing = initialize_thing" if thing.nil?
<tommylommykins> Is there any functional difference?
chairabanta has joined #ruby
<Tasser> tommylommykins, try @thing = nil
<tommylommykins> ...that attemps to put nil in @thing??
<tommylommykins> oh, I misplaced the endquotes in the second example
<rubyrobw> git clone git://gist.github.com/1847584.git gist-1847584
ixti has joined #ruby
Husel has joined #ruby
Azure has joined #ruby
<rubyrobw> robwatt@robsvr:~/shorty$ rake db:create Could not find gem 'rails (= 3.2.1) ruby' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
<rubyrobw> I've already run 'bundle install" and a few other variations
omahajoe has joined #ruby
<senthil> rubyrobw: try it with rake --trace, that gist has no new info
<rubyrobw> senthil: tried it same error msg
shadoi has joined #ruby
<senthil> rubyrobw: post you Gemfile and Gemfile.lock
marvin_ has joined #ruby
marvin_ has joined #ruby
marvin_ has joined #ruby
tommyvyo has joined #ruby
<rubyrobw> senthil: not sure how to do that
QaDeS has joined #ruby
marvin_ has joined #ruby
oposomme has joined #ruby
Skaag has joined #ruby
phantasm66 has joined #ruby
adeponte_ has joined #ruby
oposomme has joined #ruby
justinmcp has joined #ruby
<senthil> rubyrobw: open them in a text editor. copy and paste
imsplitbit has joined #ruby
oposomme has joined #ruby
headius has joined #ruby
mkscrg has joined #ruby
oposomme has joined #ruby
<rubyrobw> source 'https://rubygems.org' gem 'rails', '3.2.1' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer' gem 'uglifier', '>= 1.0.3' en
<senthil> rubyrobw: please use gist for anything longer than 2 lines
bash` has quit ["Konversation terminated!"]
savage- has joined #ruby
<td123> anyone know what the vendor_specific module is? there are some commands that check for it with ruby -r vendor-specific -e "print 'true'" but I don't seem to have it installed on my computer
<wroathe> What's the best way to sort a histogram by key?
<wroathe> I mean Hash
<wroathe> Sorry
<wroathe> (Effectively what I'm trying to sort is a histogram)
savage-_ has joined #ruby
dcarper has joined #ruby
<virunga> wroathe, i think you can take the keys using the appropiate method then use sort of Array class or sort_by of Enumerable module
parzo has joined #ruby
shtirlic has joined #ruby
sythe has joined #ruby
llaskin has joined #ruby
<llaskin> if I want to alternate a variable between true and false how would I do that?
<hoelzro> llaskin: var = not var?
<heftig> or "var = !var"
phantasm66 has joined #ruby
<heftig> the former actually doesn't work
<senthil> if i saw that, it would take me a good 10 secs to figure it out
<llaskin> ok
<hoelzro> heftig: oh? why not?
<heftig> syntax error
<hoelzro> I just tried it in irb
shadoi has joined #ruby
fr0gprince_mac has joined #ruby
<hoelzro> huh.
<shevy> I do switching between flags sometimes
tatsuya_o has joined #ruby
<hoelzro> I tried 'not true'
<heftig> SyntaxError: (irb):7: syntax error, unexpected tIDENTIFIER, expecting '('
<hoelzro> that worked, but 'var = not var' did not
<shevy> def toggle; @flag = ! @flag; end
<heftig> var = (not var) works
bbttxu_ has joined #ruby
axl__ has joined #ruby
RubyRobW_ has joined #ruby
<shevy> yay lisp!
<shevy> var = ((not) var)
c0rn has joined #ruby
mengu_ has joined #ruby
mengu_ has joined #ruby
<td123> can anyone on a non-archlinux distro run ruby -r vendor-specific -e "print 'true'"
<td123> also with ruby 1.9
justinmcp has joined #ruby
stephenjudkins has joined #ruby
_john has joined #ruby
<td123> on arch that errors out
<shevy> ruby: no such file to load -- vendor-specific (LoadError)
<heftig> shevy: that's on?
llaskin has quit [#ruby]
Indian has joined #ruby
dyer has joined #ruby
dyer has joined #ruby
kpshek has joined #ruby
<shevy> hmm
matthias_ has joined #ruby
s0ber has joined #ruby
y3llow has joined #ruby
canton7 has joined #ruby
fr0gprince_mac has joined #ruby
y3llow has joined #ruby
cbuxton has joined #ruby
MrGando_ has joined #ruby
tommyvyo has joined #ruby
y3llow has joined #ruby
alanp has joined #ruby
denom has joined #ruby
zomgbie has joined #ruby
<robert_> shevy: HAIII. :D
Skaag has joined #ruby
senthil has quit [#ruby]
andrewhl has joined #ruby
R3dy has joined #ruby
<R3dy> is there a way for socker.recv to have an unlimited amount
<R3dy> so no mater how big the result is it will still store it
<shevy> hey robert_
<robert_> how's it going? :D
<robert_> shevy: I'm trying to .to_s a string and use it to look up something in a hash, but it's not workeeeeng. D:
<shevy> robert_ I am lately wondering why I have so much complexity in my scripts
<robert_> I see.
<robert_> e.g. record["Xyzzy".to_s]
<robert_> but it doesn't wanna seem to work. :/
<shevy> "Xyzzy".to_s is useless
<shevy> it is already a string so why invoke #to_s again
<shevy> record[] seems to be a hash, it most likely has no key called like that. do require 'pp'; pp record
rushed has joined #ruby
burgestrand has joined #ruby
<R3dy> how do you loop through sock.recv while sock.recv has data to recieve?
denom has joined #ruby
hooper_ has joined #ruby
<R3dy> is socket programming to complicated for people here?
jwang has joined #ruby
BrokenCog has joined #ruby
pingfloyd has joined #ruby
zulax has joined #ruby
pingfloyd has quit [#ruby]
pingfloyd has joined #ruby
Synthead has joined #ruby
<shevy> dunno
<shevy> I myself never had to do it
matthias2 has joined #ruby
v0yager_ has joined #ruby
<luckyruby> i'm using the daemons gem. Is there a way to start up a daemon in the context of bundler?
<luckyruby> I tried bundle exec ruby mydaemon start. didn't seem to work
<td123> shevy: which distro did you run that on?
burgestrand has joined #ruby
badelat has joined #ruby
twixmix has quit [#ruby]
<shevy> td123 hmm knoppix (debian) but all my ruby comes from the source
<td123> shevy: thanks
nowthatsamatt has joined #ruby
startling has joined #ruby
designated has joined #ruby
crankycoder has joined #ruby
jergason has joined #ruby
tim_sharman has joined #ruby
<designated> I'm reading "Programming Ruby 1.9" by Dave Thomas and he mentions using ri ClassName to get more information regarding classes but it doesn't seem to be working the way he explains it. As an example he uses ri assoc but when I type this I get "Nothing known about .assoc" Any suggestions?
<designated> I'm running ruby 1.9.3p125
startling has joined #ruby
<deryl> if you are running RVM, run rvm docs generate
KDiddy has joined #ruby
iocor has joined #ruby
tim_sharman has quit [#ruby]
<burgestrand> designated: ^
<deryl> the full docs aren't usually generated just to save space, but that command under any given ruby RVM controls will build and install the standard docs
emocake has joined #ruby
<designated> deryl, thank you very much
<deryl> np
momo_ has joined #ruby
<designated> I'm guessing ruby is not multi threaded considering it currently has 1 of 8 cores @ 100%
<burgestrand> designated: CRuby is multi-threaded but has a GIL, which means only one thread of Ruby runs at any given moment
<burgestrand> designated: JRuby and Rubinius however do not have a GIL
<epochwolf|vps> designated: mri can only use one core at a time per process due to GIL
ipoval has joined #ruby
<burgestrand> or, well, rubinius 1.x has, not 2.x
tsharman has joined #ruby
badelat has joined #ruby
<designated> burgestrand, epochwolf|vps, thank you
tsharman has joined #ruby
* Hanmac is porting not thread-safe libs ... so it does not realy matter if my gem is not thread safe
redgetan has joined #ruby
chrxn_ has joined #ruby
badabim_ has joined #ruby
raluxgaza has joined #ruby
eka has joined #ruby
<Tasser> Hanmac, on jruby, it does
nowthatsamatt has quit [#ruby]
stringoO has joined #ruby
<Hanmac> currently i does not have seen any good tutorial how to make thread-safe gems in c ... i mean my methods are like return DBL2NUM(_self->getRed()); ... where should the ruby-thread functions go?
mxweas_ has joined #ruby
<shevy> robert_ I tell you ... complexity is the root of all evil
<shevy> if I ever make a programming language, I make it so SIMPLE that every idiot can use it and that the only valid code that works is SIMPLE TERSE and BEAUTIFUL
Axsuul has joined #ruby
stephans has joined #ruby
<robert_> hah, yeah.
<nlew> would that it were so easy
<shevy> nlew well, you have to cut down on some things
ryannielson has joined #ruby
<shevy> it wouldn't be as feature rich as ruby for sure
davidpk has joined #ruby
<BrokenCog> the first compiler writer thought that was what he created, having been assembling previously.
<nlew> there's a trade-off between features and expressiveness though
tommyvyo has joined #ruby
<shevy> sure but I am getting confused about the simple things too
<shevy> - should I turn this method into a class or not
<shevy> - should I use methods in the first place or just write everything without classes and methods
<shevy> and then I have to think about whether I need a specific feature or not
kevinbond has joined #ruby
<msch> for debugging purporses i'd like to add a file to $LOADED_FEATURES so that it doesn't get required. is there a method that performs the same file lookup that Kernel.require does?
<msch> e.g. i want to do $LOADED_FEATURES << Kernel.find_file_to_require 'some/file'
yopp has joined #ruby
<Hanmac> Tasser: do you have a tutorial howto write threadsafe ruby-gems if the ported lib is not thread safe?
<Tasser> Hanmac, define lib
<Hanmac> libs like CEGUI, OGRE3D, or wx
statarb3 has joined #ruby
booginga has joined #ruby
<nlew> msch: Why do you need that? $LOADED_FEATURES should just contain the string you passed to require, not the file that was actually loaded.
<msch> nlew: in 1.9.3 it definitly contains the file that's actually been loaded
<nlew> :O
dcarper has joined #ruby
<nlew> Well so it does.. huh..
<msch> nlew: our app has a rails-like script/console and i'm the only dev in the team that wants to use pry instead of irb. so i negotiated that we'll have a require './local_environement.rb' if File.exist? './local_environment.rb' and i want to stub out "require 'irb'" in there
ixti has joined #ruby
havenn has joined #ruby
Evixion has joined #ruby
havenn has joined #ruby
pen has joined #ruby
EddieS has joined #ruby
<nlew> I can't find anything that exposes that behavior
<nlew> you might look at rubinius, which has it all in ruby and broken into several methods
<startling> I want to inherit from a class that defines the method `initialize`. I want to make it take another argument on instantiating. How do I do that and still call the parent's `initialize`?
<Hanmac> startling: super
conor_ireland has joined #ruby
conor_ireland has joined #ruby
drewrm has joined #ruby
<shevy> superduper
dju has joined #ruby
ests has joined #ruby
<startling> Hanmac: super(initialize) evidently calls the method it's in; i get a `stack level too deep (SystemStackError)`.
<ests> Good evening. Is anyone here attending wroc_love.rb conference?
linoj__ has joined #ruby
<burgestrand> startling: just super
<burgestrand> startling: or super() if you want to pass no args
<burgestrand> startling: or super(args) if you want to pass your own args
stephenjudkins has joined #ruby
carlyle has joined #ruby
<startling> burgestrand: ah, thanks.
<burgestrand> startling: super(initialize) will call super with the parameter of whatever the initialize-method returns, which in turn calls super with the parameter of whatever the initialize-method returns, which in turn…
<startling> yeah. I'm used to how python does it, I guess, which is `parent.__init__(self...)`
<burgestrand> :)
<Hanmac> and if you want to be on the safe side you can check with "defined(super)" if supercall is possible
<burgestrand> super is very similar to just another method call, with the difference that if you pass no arguments and no parentheses it’ll pass the arguments given to the current method
<startling> Hanmac: when wouldn't it be?
<Hanmac> if you does not know if the parent method exist
<startling> ah, okay. i think it always will in this instance, but that's good to know
jeffmjack has joined #ruby
krisfremen has joined #ruby
nari has joined #ruby
<startling> what's the difference between MyModule::thing and MyModule.thing?
c0rn has joined #ruby
<shevy> the latter is nicer
<shevy> and you save one char
<shevy> also, it's more often used
<shevy> people usually do something like
ests has quit [#ruby]
<shevy> Foobar::SOME_CONSTANT_HERE
<startling> oh, so it does the same thing?
<shevy> Foobar.kill('startling')
<shevy> hmm kinda ... but they don't tend to be used in the same way. the :: is used to denote scoping
<shevy> you can do
<shevy> ::FOOBAR
<shevy> sometimes
<shevy> you can never do
<shevy> .foobar
<shevy> unless you have an object before that line
chimkan_ has joined #ruby
<shevy> in ruby code out there you often see something like
<shevy> my_object = FooBar::SomeClass.new
<shevy> my_object.thing
<shevy> hmm
<shevy> my_object::thing would be really ugly
c0rn has joined #ruby
<startling> heh, alright.
saurb has joined #ruby
carlyle has joined #ruby
CacheMoney has joined #ruby
cbuxton has joined #ruby
v0yager has joined #ruby
<CacheMoney> I have an array of strings http://pastie.org/3397791 that I want to remove the spaces between the numbers and save just the numbers to either a hash or an array. Any advice?
matthias2 has joined #ruby
kpshek has joined #ruby
chrxn_ has joined #ruby
<shevy> you want to ...
<shevy> get rid of all spaces? .gsub(/ /,'')
v0yager has joined #ruby
<CacheMoney> i want to remove the spaces and then save them as ints
<shevy> arr.map! {|x| x.gsub(/ /,'') }
<shevy> .to_i
<CacheMoney> shevy: thanks. thats a lot easier than what i was trying to do
<shevy> but note that "1 1 1 1 1 1 1 1 1 1 1 1" will become a 111111111111 Fixnum
<CacheMoney> hmmm... I'd like it to be [1, 1, 1, 1, 1, 1]
<shevy> several ways
<shevy> "1 1 1 1 1 1 1 1 1 1 1 1".split(' ').map(&:to_i) # => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
<shevy> just think of the & as a shortcut
<shevy> you could use the {} block variant too if you like that more
<CacheMoney> shevy: okay. I've never came across the '&' yet, I'll give that a try
davidpk has joined #ruby
<CacheMoney> thanks
<shevy> well you can avoid using it
<shevy> it will be a bit longer though
ests has joined #ruby
coucher has joined #ruby
<shevy> "1 1 1 1 1 1 1 1 1 1 1 1".split(' ').map {|x| x.to_i} # => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
jason_rad has joined #ruby
<jason_rad> How do I print / list out all methods to a certain class? something like puts class.methods is what I'm looking for
<shevy> object.methods.sort
<shevy> Class.new.methods.sort
<shevy> should work too, where Class is the name
minijupe has joined #ruby
<CacheMoney> shevy: this is what you recommend arr.map!{|x| x.split(' ').map{|x| x.to_i}}. It's a lot cleaner than the approach I was taking... appreciate it
<jason_rad> shevy: thank you
<shevy> CacheMoney I am usually happy with the first solution that works
<shevy> I just have no patience to be too creative
<shevy> I like it when things stay small, simple, terse and not complicated
<ests> Is #tap available in Ruby 1.8.7?
<CacheMoney> i agree but because i'm pretty new to programming it's hard sometimes to not get caught in the weeds. Thanks again
<shevy> ests dont think so
albemuth has joined #ruby
Helius has joined #ruby
<banister`sleep> shajen: hey marcu
<banister`sleep> shevy: marcus*
<banister`sleep> jason_rad: i think u want Class.instance_methods
<jason_rad> I'm getting a lot more information than I need. Basically I just want to print out all the "defined methods" i've created in my class
<banister`sleep> jason_rad: is this in irb?
<jason_rad> no
<banister`sleep> jason_rad: ok, Class.instance_methods(false)
<banister`sleep> try that
ests has joined #ruby
<shajen> banister`sleep: tabfail?
<jason_rad> That works banister`sleep
<banister`sleep> shajen: yes sorry :))
<jason_rad> Thank you
<banister`sleep> jason_rad: np
<shajen> ok, no problem
booginga has quit ["Leaving"]
ephemerian has joined #ruby
startling has joined #ruby
shadoi has joined #ruby
baroquebobcat has joined #ruby
marvin_ has joined #ruby
<minijupe> Any idea why my rubies fail at 'make' with rvm? http://pastie.org/3397944
Karmaon has joined #ruby
jobicoppola has joined #ruby
heftig has joined #ruby
canton8 has joined #ruby
yfeldblum has joined #ruby
<davidcelis> OSX?
coderguy has joined #ruby
h4mz1d has joined #ruby
taipres has joined #ruby
oposomme has joined #ruby
phantasm66 has joined #ruby
matthias3 has joined #ruby
caiges has joined #ruby
tomzx has joined #ruby
shevy has joined #ruby
<minijupe> davidcelis: snow L.
saurb1 has joined #ruby
ahlatimer has joined #ruby
ahlatimer has quit ["Leaving..."]
hydrozen has joined #ruby
dyer has joined #ruby
dyer has joined #ruby
<minijupe> all rubies fail to install
<davidcelis> how did you install gc
<davidcelis> gcc*
dagnachewa has joined #ruby
denom has joined #ruby
eignerchris_ has joined #ruby
stephenjudkins has joined #ruby