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/
<seanstickle> atheken: format.json { render {json: @users} }
dcvii has joined #ruby
<seanstickle> atheken: that'll work
darthdeus has joined #ruby
rickmast has joined #ruby
jbhewitt has joined #ruby
<atheken> seanstickle: interesting.. that was gen'ed by rails 3.2.1
<seanstickle> atheken: yeah, I was wrong
<seanstickle> atheken: ignore my response
<atheken> seanstickle: k. thanks anyway.
sdwrage has joined #ruby
<atheken> seanstickle: any other ideas?
fallen has joined #ruby
asteros has joined #ruby
<superman_ffm> h = { a: 1, b: 2, c: 3, d: 4} try to remove all key:value pairs whose value is less than 3.5
<superman_ffm> h.shift ???
<seanstickle> superman_ffm: is that a question?
<superman_ffm> correct yes that is a question
<seanstickle> This is starting to sound like homework questions
<superman_ffm> i try something with h.shift
<examancer> { a: 1, b: 2, c: 3, d: 4}.delete_if{|k,v| v < 3.5}
<superman_ffm> i read the ruby-doc but I don't see that?
<examancer> you are looking just at Hash methods I presume?
<seanstickle> Check out Enumerable
<examancer> Hash also has all of Enumerable's methods
<superman_ffm> yes
<examancer> took me a while to figure that out too :-)
speerfissure has joined #ruby
<superman_ffm> how do I start then how to find it
S1kx has joined #ruby
<examancer> huh?
<davidcelis> superman_ffm: Is this a homework question?
<seanstickle> Are you one of those LivingSocial students?
<superman_ffm> no
<davidcelis> Are you sure?
<davidcelis> Because this sounds a lot like a homework question
<superman_ffm> yea I have a lot of questions
<examancer> superman_ffm: if you look at the docs (http://ruby-doc.org/core-1.9.3/Hash.html) you can see that Hash includes the Enumerable module
<superman_ffm> just trying to learning ruby
<examancer> that particular doc also shows you the methods from Enumerable, so it shows #delete_if as a method of Hash
snip_it has quit [#ruby]
<atheken> seanstickle: FWIW, I think it's because I had a thin process running via pow! that has been up for awhile and I have been mucking about with rvm today, running 'rails s' works fine with the new syntax, sorry for bothering you.
ZenBalance has joined #ruby
<seanstickle> Ha
<seanstickle> Well, all's well that ends well
<superman_ffm> you mean on the left side there are Enumerable
<examancer> superman_ffm: yes
<atheken> seanstickle: thanks for (trying) to help. cheers.
<banisterfiend> seanstickle: hey sean
<seanstickle> Hey banisterfiend !
<superman_ffm> ant the Enumerable belongs to Hash
<banisterfiend> sup
atheken has quit [#ruby]
thats_my_hat has joined #ruby
<examancer> superman_ffm: Enumerable is a module. it is included into a number of other things and you can even use it directly.
asteros has joined #ruby
<seanstickle> Actually, I don't think delete_if is an Enumerable method
_|christian|_ has joined #ruby
<ZenBalance> Hi all, could anyone explain the following code: http://titanpad.com/HTk7v7ojAx I am trying to wrap my head around the concept of threading
<examancer> superman_ffm: think of it like a parent class... its a little different than that, but that's the best description if you come from a language that uses classical inheritence
<examancer> seanstickle: looks like you're right
<examancer> i'm not sure why you didn't see that method then superman_ffm ... its just a normal hash method
<examancer> :-P
<superman_ffm> I see it now, and the k is for key and the v for value
nyrb has joined #ruby
joslin01 has joined #ruby
jobicoppola has joined #ruby
nerdy has joined #ruby
mmokrysz has joined #ruby
<joslin01> kind gentlemen, I'm following the popular rails tutorial. guard is crying about libffi
mmokrysz has quit [#ruby]
<joslin01> if you have a second, everything i gotta say is here: http://stackoverflow.com/questions/9253844/gem-rb-inotify-causing-libffi-errors
mamina has joined #ruby
speerfissure has joined #ruby
<mamina> Can anibody help me with this http://alturl.com/n53kn ?
adman65 has joined #ruby
asteros has joined #ruby
<examancer> lol. i for one thank mamina for the link
randym has joined #ruby
Natch| has joined #ruby
drPoggs has joined #ruby
ReinH has joined #ruby
S2kx has joined #ruby
<td123> lame low-res spam
randym has joined #ruby
Apocalypse has joined #ruby
Karmaon has joined #ruby
dagnachewa has joined #ruby
genexp has joined #ruby
replore has joined #ruby
havenn has joined #ruby
colint_ has joined #ruby
tomzx has joined #ruby
havenn has joined #ruby
fayimora has joined #ruby
stephenjudkins has joined #ruby
<wroathe> So I'm trying to write a method to recursively reverse the digits of an integer in ruby. So far here's what I've got http://pastie.org/3370740 How can this be improved?
<wroathe> I'd like to avoid typecasting in that second return
<wroathe> and potentially reduce it to 2 lines
<wroathe> My math skills aren't wonderful.
<seanstickle> wroathe: only integers?
<seanstickle> 123.to_s.split(//).reverse.join.to_i
<seanstickle> :)
niklasb has joined #ruby
<seanstickle> 123.to_s.reverse.to_i
<seanstickle> Even easier
<td123> Integer(a.to_s.reverse)
<td123> nvm
<td123> :P
<seanstickle> :)
<td123> I like the to_i better
Sivart has joined #ruby
<seanstickle> a = "cat"; b = "dog"; a.split(//).zip(b.split(//)).count{|x| x[0] != x[1]}
<seanstickle> Hamming distance!
<seanstickle> :)
genexp_ has joined #ruby
stringoO has joined #ruby
havenn has joined #ruby
dennda has joined #ruby
genexp has joined #ruby
Dr4g has joined #ruby
<banisterfiend> seanstickle: what's been up in the recent months when you've been absent
<seanstickle> banisterfiend: applied for a job as a Ruby programmer.
<seanstickle> banisterfiend: and read some books.
<seanstickle> How about you?
genexp has joined #ruby
<Dr4g> I'm not a Ruby guy, but organising a "web" event and looking for somewhere to post our web conference that ruby developers can see.
<Dr4g> Where should I look?
CannedCorn has joined #ruby
<Dr4g> Our conference isn't specific to ruby, it's of the "web" which means php/ruby/python community
<wroathe> Sorry, was afk. I don't want to cast the integer over to a string
genexp has joined #ruby
erawtic has joined #ruby
<wroathe> So the constraints I've imposed are that it has to be recursive and it has to operate solely on integers
banisterfiend has joined #ruby
ZenBalance has joined #ruby
<wroathe> Perhaps there's a better algorithm
<banisterfiend> seanstickle: sorry dc. I've been working wth a bunch of guys on expanding the pry ecosystem, built a few plugins: https://github.com/pry/pry/wiki/Available-plugins
<td123> if you need to work on ints, then my though would be for you to use log_10
<seanstickle> Nifty!
<wroathe> log_10?
<td123> yes, assuming you will only be working base 10 integers :P
skipper has joined #ruby
<banisterfiend> seanstickle: you might be interested in this guy: https://github.com/banister/plymouth
<td123> wroathe: if it's not immediately obvious, think about how our numbers work (how do you construct a value from the sequence of numbers we write down)
<seanstickle> Ah perfect
BSaboia has joined #ruby
Shamgar has joined #ruby
genexp has joined #ruby
astrostl has joined #ruby
<wroathe> It will only be base 10 integers and I have no idea :P
<wroathe> How would you express that last return statement then?
<BSaboia> hey guys... what is the "best way" of implementing tabs? segmented view is a good choice?
<BSaboia> sorry, wrong # =\
ReTFEF has joined #ruby
genexp has joined #ruby
vaxinate has joined #ruby
<wroathe> td123 what do you think is immediately obvious about it?
<wroathe> I'm not following you
i8igmac has joined #ruby
genexp has joined #ruby
<td123> wroathe: I'm assuming this is some kind of challenge so I'm trying not to give you too many hints :P
CannedCorn has joined #ruby
dyer has joined #ruby
mpabst has joined #ruby
kmurph79 has joined #ruby
<wroathe> No. It's for project-euler... It's one part of an overall problem. If I wanted to do things the easy way with ruby I could cast the number to a string and do string.reverse and then cast it back to an integer.
<wroathe> I'm just having a little fun.
<wroathe> That code I just linked is my best attempt so far but I'm not really a math guy.
<td123> wroathe: e.g. 4123 = 4*10^3 + 1*10^2 + 2*10^1 + 3*10^0
vaxinate_ has joined #ruby
mpabst has quit [#ruby]
<wroathe> That's essentially what I'm doing isn't it?
<wroathe> Unless I'm missing something in your example
genexp has joined #ruby
looopy has joined #ruby
<banisterfiend> shevy: fowl is in #pry if u wanna join
neurodrone has joined #ruby
neurodrone has joined #ruby
genexp has joined #ruby
<Jarred> Is open asynchronous?
<Jarred> (open-uri)
dagnachewa has joined #ruby
<cespare> Jarred: nope
vjacob has joined #ruby
<seanstickle> Dang, wroate left?
<seanstickle> I finally figured out the all-mathematics answer
Azure|netbook has joined #ruby
pdtpatr1ck has joined #ruby
<seanstickle> For thems that care
<seanstickle> Not recursive, though
moshee has joined #ruby
moshee has joined #ruby
pu22l3r has joined #ruby
<td123> that's essentially what I was thinking :P
<td123> except I had in mind a recursive one :)
jaywastaken has joined #ruby
genexp has joined #ruby
maletor has joined #ruby
pac1 has joined #ruby
<seanstickle> I shy away from recursion.
<seanstickle> Too many blown stacks.
<td123> if your language can't handle 5 levels of recursion.. :P
<seanstickle> td123: I try to assume arbitrarily large inputs
<seanstickle> I tried doing a word ladder that way and blew my stack real quick like.
<seanstickle> So I converted to iterative
skaczor has joined #ruby
josefig has joined #ruby
SegFaultAX has joined #ruby
genexp has joined #ruby
CannedCorn has joined #ruby
<td123> this is where tail recursion would help me
nobitanobi has joined #ruby
<seanstickle> Yes, true.
<nobitanobi> Hi. I'm doing this: <%= @user.birthdate%> - Where birthdate is a date type. How can I change the format of that output?
<seanstickle> strftime
<nobitanobi> ok
pen has joined #ruby
colint has joined #ruby
gener1c has joined #ruby
gener1c has quit [#ruby]
colossus has joined #ruby
dagnachewa has joined #ruby
genexp has joined #ruby
wyhaines has joined #ruby
dandrinkard has joined #ruby
matthias3 has joined #ruby
Shamgar has joined #ruby
genexp has joined #ruby
<hkhalid> ruby for android
<hkhalid> needs more attention
<examancer> yes
<examancer> this looks to be the way to go for now: https://github.com/ruboto/sl4a_jruby_interpreter
BSaboia__ has joined #ruby
dagnachewa has joined #ruby
flip_digits has joined #ruby
Andrevan has joined #ruby
Jooka has joined #ruby
csprite has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
Ownatik has joined #ruby
aetaric has joined #ruby
sekati has joined #ruby
dagnachewa has joined #ruby
_obiJuan has joined #ruby
havenn has joined #ruby
dv310p3r has joined #ruby
randym has joined #ruby
nyrb has joined #ruby
randym has joined #ruby
p0y has joined #ruby
Shamgar has joined #ruby
josefig has joined #ruby
azureye has joined #ruby
colint has joined #ruby
n8ji has joined #ruby
radic has joined #ruby
fayimora has joined #ruby
nobitanobi has joined #ruby
ccooke has joined #ruby
leex has joined #ruby
mbreit has joined #ruby
nobitanobi has joined #ruby
p0y_ has joined #ruby
Sigma00 has joined #ruby
Targen_ has joined #ruby
sinuc has joined #ruby
sinuc has joined #ruby
trebaum has joined #ruby
trebaum has joined #ruby
mikalv has joined #ruby
banisterfiend has joined #ruby
tdubz has joined #ruby
sj26 has joined #ruby
sixteneighty has joined #ruby
Corey_ has joined #ruby
jmeeuwen has joined #ruby
alienvenom has joined #ruby
DefV has joined #ruby
UdontKnow has joined #ruby
klaas has joined #ruby
dnyy has joined #ruby
Gm4n has joined #ruby
sand has joined #ruby
cespare has joined #ruby
end3r- has joined #ruby
Tick-Tock has joined #ruby
swarley has joined #ruby
thomasfedb has joined #ruby
Shamgar has joined #ruby
<swarley> anyone have an answer as to how i make an irc client with GTK, i dont know how to get around the blocking
affix has joined #ruby
p0y has joined #ruby
crazed has joined #ruby
G has joined #ruby
DFectuoso has joined #ruby
zoo-zed has joined #ruby
<banisterfiend> swarley: sshhh, i want to listen to the music
<swarley> :[ but i have no idea how to do it QQ
MetaCosm has joined #ruby
huxley_sparks has joined #ruby
jwmann has joined #ruby
mikepack has joined #ruby
colint has joined #ruby
huxley_sparks has joined #ruby
<td123> swarley: what blocking? are you using threads?
<swarley> td123, no, but GLib should block indefinitely right?
nobitanobi has joined #ruby
kmurph79 has joined #ruby
<td123> nvm, I was thinking about something else
jordanstephens has joined #ruby
DFectuoso has joined #ruby
lewix has joined #ruby
jacktrick has joined #ruby
sekati has quit [#ruby]
pen has joined #ruby
rsaaguy has joined #ruby
havenn has joined #ruby
savage- has joined #ruby
Rishi_ has joined #ruby
td123 has joined #ruby
gokul has joined #ruby
flip_digits has joined #ruby
DFectuoso has joined #ruby
vraa has joined #ruby
flip_digits has joined #ruby
G has joined #ruby
Ownatik has joined #ruby
flip_digits has joined #ruby
flip_digits has joined #ruby
Rishi_ has joined #ruby
fallen has joined #ruby
flip_digits has joined #ruby
G has joined #ruby
rippa has joined #ruby
18WABL9IC has joined #ruby
<Zolrath> I'm trying to use something that has an Hpricot dependency, but Hpricot is crashing and reporting the wrong version of Ruby for some reasons?
flip_digits has joined #ruby
gianlucadv has joined #ruby
nobitanobi has joined #ruby
<RubyPanther> Zolrath: that's a weird one, something is getting the wrong version... like it is setting the current load path but then running the old ruby
<RubyPanther> and Hpricot is just the first native extension that tries to load
<Zolrath> Would that be something wrong with my gem command, building native extensions with system ruby then placing them in my rvm ruby directory or something?
<Zolrath> I don't really see how this is happening
<RubyPanther> Zolrath: I don't know how the vim stuff works, but it sounds like you have an app using an embedded Ruby 1.8.7 and then you're trying to load a gem that you installed into an rvm ruby
<Zolrath> RubyPanther That makes way way more sense
<Zolrath> RubyPanther: Vim was compiled with ruby support with an old version. Thank you very much!
Silker has joined #ruby
nari has joined #ruby
banisterfiend has joined #ruby
CannedCorn has joined #ruby
<RubyPanther> Yay!
Sailias has joined #ruby
mdel has joined #ruby
kp666 has joined #ruby
td123 has joined #ruby
sythe has joined #ruby
sythe has joined #ruby
otakutomo has joined #ruby
akem has joined #ruby
vraa has joined #ruby
chiel has joined #ruby
<chiel> Hi guys
<chiel> is there something in ruby like the magic __set method in php?
kp666 has joined #ruby
<banisterfiend> chiel: since we're generally not php programmers you're going to have to explain whta that method does :)
<chiel> banisterfiend: right, sorry. :P basically, if you define a class, and create an instance of it, you can do something like this:
<chiel> $var = new SomeClass(); $var->someValue = 'bla';
<chiel> then, class SomeClass { function __set($key, $value) { /* do something */ } }
<chiel> so you can basically assign any key/value pair.
<banisterfiend> chiel: sorry i still dont know wtf your'e talking about
<chiel> so instead of having to do `def key=(value) end` a bunch of times... i would only hve to define it once.
<chiel> okay, one moment!
<banisterfiend> chiel: but i think what u want is OpenStruct
opin_ has joined #ruby
<banisterfiend> chiel: alternatively you could role your own solution using method_missing
<chiel> banisterfiend: https://gist.github.com/1813920
<chiel> so i just want to avoid having to define a setter for each key that i want to be ble to assign
<chiel> but that openstruct thing looks like it kinda does what I want
<banisterfiend> chiel: then inherit from OpenStruct
<banisterfiend> chiel: class MyClass < OpenStruct
h4mz1d has joined #ruby
<chiel> hmm yes, gonna give it a shot
rickmasta has joined #ruby
Axsuul has joined #ruby
trend has joined #ruby
nobitanobi has joined #ruby
<nobitanobi> night guys
nobitanobi has quit [#ruby]
mxweas_ has joined #ruby
<banisterfiend> burgestrand: Three Swedish switched witches watch three Swiss Swatch watches switches. Which Swedish switched witch watch which Swiss Swatch watch witch?
jaywastaken has joined #ruby
tonini has joined #ruby
chiel has quit [#ruby]
JohnBat26 has joined #ruby
c0rn has joined #ruby
capelio has joined #ruby
nemesit has joined #ruby
sjang1 has joined #ruby
bmagsipoc has joined #ruby
whereswaldo2 has joined #ruby
ABK has joined #ruby
savage- has joined #ruby
xiaotian has joined #ruby
intacta has joined #ruby
stephenjudkins has joined #ruby
djdb has joined #ruby
jhunter has joined #ruby
Karmaon has joined #ruby
GoBin has joined #ruby
yxhuvud has joined #ruby
daglees has joined #ruby
pen has joined #ruby
Sailias has joined #ruby
punkrawkR has joined #ruby
Illiux has joined #ruby
hmans has joined #ruby
senny has joined #ruby
samuel02 has joined #ruby
Sliker has joined #ruby
iocor has joined #ruby
gokul has joined #ruby
trivol has joined #ruby
Jarred has quit [#ruby]
Shrink has joined #ruby
odinswand has joined #ruby
mafolz has joined #ruby
flak has joined #ruby
bjensen has joined #ruby
opin_ has joined #ruby
snearch has joined #ruby
gokul has joined #ruby
paissad has quit ["Leaving"]
Morkel has joined #ruby
triptec has joined #ruby
intacta has joined #ruby
zommi has joined #ruby
bobby has joined #ruby
fenix457 has joined #ruby
ph^ has joined #ruby
sdwrage has joined #ruby
n8ji_ has joined #ruby
benregn has joined #ruby
snearch has joined #ruby
Doppp has joined #ruby
bier_ has joined #ruby
arturaz has joined #ruby
Sliker has joined #ruby
gmwils has joined #ruby
nemesit has joined #ruby
kreantos has joined #ruby
trivol has joined #ruby
js__ has joined #ruby
ZenBalance has joined #ruby
<ZenBalance> Does anyone know what the inner text of a link is called attribute wise?
<banisterfiend> ZenBalance: cindy
<ZenBalance> I am trying to use it for a css selector scraping with nokogiri
<ZenBalance> as in <a href="http://...">THIS</a>
<ZenBalance> what would "THIS" be referred to as for a css selector?
<banisterfiend> ZenBalance: ask in #rubyonrails
christianreber has joined #ruby
samuel02 has joined #ruby
Doppp has joined #ruby
ZenBalance has quit ["Leaving"]
timonv has joined #ruby
Jamoka has joined #ruby
cyri_ has joined #ruby
triptec has joined #ruby
Asher has joined #ruby
pi3r has joined #ruby
bluOxigen has joined #ruby
etehtsea has joined #ruby
triptec_ has joined #ruby
cakey has joined #ruby
csherin has joined #ruby
thats_my_hat has joined #ruby
sterNiX has joined #ruby
bjensen has joined #ruby
JohnBat26 has joined #ruby
davidpk has joined #ruby
nd____ has joined #ruby
gianlucadv has joined #ruby
adman65 has joined #ruby
king313 has joined #ruby
dennda_ has joined #ruby
Seisatsu has joined #ruby
iocor has joined #ruby
Spockz has joined #ruby
transtionstate has joined #ruby
canton7 has joined #ruby
<transtionstate> ok... any of my mates here knows a thing or two abt rails.. coz then it will be great as the ppl in the rails room are more into gossiping and abuse than talking actual rails stuff... which is annoying
xastion has joined #ruby
<banisterfiend> transtionstate: we hate rails in here
<banisterfiend> :D
<banisterfiend> transtionstate: try #railsbridge
banseljaj has joined #ruby
<transtionstate> banisterfiend: ya mate but may b someone could help me out... its a small doubt that I have am new to rails myself so :)
<transtionstate> i have my rails_root/config/models/en.yml file and this is how the file looks like and all i wanna know is how i could view a "Bet" using the i18 on my view page :)
<banisterfiend> transtionstate: try another rails channel
<transtionstate> banisterfiend: tell me which channel ?
<banisterfiend> transtionstate: i linked already, #railsbridge
<transtionstate> banisterfiend: ok i will try
Shrink has joined #ruby
taipres has joined #ruby
csherin has joined #ruby
dennda_ has joined #ruby
tvo has joined #ruby
dennda_ has quit [#ruby]
opin_ has joined #ruby
dazoakley has joined #ruby
burgestrand has joined #ruby
gyre007 has joined #ruby
eregon has joined #ruby
tvw has joined #ruby
sv has joined #ruby
intacta has joined #ruby
ephemerian has joined #ruby
gregorg has joined #ruby
gregorg has joined #ruby
Ch4rAss has joined #ruby
xastion has joined #ruby
BiHi has joined #ruby
jbw_ has joined #ruby
[edu] has joined #ruby
tayy has joined #ruby
odinswand has joined #ruby
erenrich has joined #ruby
shevy has joined #ruby
fallen has joined #ruby
Elfix has joined #ruby
emmanuelux has joined #ruby
TomJ has joined #ruby
adman65 has joined #ruby
arturaz has joined #ruby
djdb has joined #ruby
MetaCosm has joined #ruby
ReinH has joined #ruby
JStoker has joined #ruby
gentz has joined #ruby
tomku has joined #ruby
dkannan has joined #ruby
dkr_ has joined #ruby
r126l has joined #ruby
epochwolf|vps has joined #ruby
rflorianobr has joined #ruby
oddraisin has joined #ruby
nick_h has joined #ruby
salvador has joined #ruby
mitchty has joined #ruby
fortysixandtwo has joined #ruby
andman_ has joined #ruby
d-snp has joined #ruby
jmcphers has joined #ruby
Amorsen has joined #ruby
shikamaru has joined #ruby
ping-pon- has joined #ruby
hechien_ has joined #ruby
hackeron has joined #ruby
dv_ has joined #ruby
kivi has joined #ruby
WanderingGlitch has joined #ruby
nricciar has joined #ruby
nicksmith has joined #ruby
Jb_ has joined #ruby
companion has joined #ruby
mxweas has joined #ruby
pseud0cod3r has joined #ruby
giminy has joined #ruby
ping_pong has joined #ruby
xxtjaxx has joined #ruby
stepnem has joined #ruby
Derander_ has joined #ruby
DeeJayTwo has joined #ruby
ChloeD has joined #ruby
hSATAC has joined #ruby
tomsthumb_ has joined #ruby
Caius has joined #ruby
nuba has joined #ruby
Kovensky has joined #ruby
jbc22 has joined #ruby
jeedey_ has joined #ruby
Veejay has joined #ruby
nuba has joined #ruby
gentz has joined #ruby
gyre007 has joined #ruby
nd____ has joined #ruby
Gm4n has joined #ruby
mbreit has joined #ruby
amerine has joined #ruby
jxpx777 has joined #ruby
n3m has joined #ruby
Y_Ichiro has joined #ruby
beilabs_ has joined #ruby
wookiehangover has joined #ruby
destructure has joined #ruby
marcin_m has joined #ruby
libertyprime has joined #ruby
Seppman has joined #ruby
kuzushi has joined #ruby
xpot-mobile has joined #ruby
trengof has joined #ruby
Joelio has joined #ruby
pigoz has joined #ruby
jds_ has joined #ruby
babinho has joined #ruby
psino has joined #ruby
bikcmp has joined #ruby
kaktus has joined #ruby
parus has joined #ruby
brian- has joined #ruby
thebastl has joined #ruby
Otend has joined #ruby
matled has joined #ruby
majoh has joined #ruby
RegEchse has joined #ruby
Kiall has joined #ruby
y_matsu_ has joined #ruby
nwonknu has joined #ruby
ninor has joined #ruby
pygmalion has joined #ruby
Muz has joined #ruby
tightwork has joined #ruby
award85 has joined #ruby
koivula has joined #ruby
niko has joined #ruby
felipe has joined #ruby
KillerFox has joined #ruby
robotmay has joined #ruby
mitchty has joined #ruby
ping-pong has joined #ruby
fayimora has joined #ruby
otakutomo has joined #ruby
dazoakley has joined #ruby
randym has joined #ruby
king313 has joined #ruby
king313 has joined #ruby
tatsuya_o has joined #ruby
triptec has joined #ruby
niko has joined #ruby
si14 has joined #ruby
eldariof has joined #ruby
tk_ has joined #ruby
daglees has joined #ruby
mengu has joined #ruby
mengu has joined #ruby
_srp has joined #ruby
fayimora has joined #ruby
niko has joined #ruby
phantomfakeBNC has joined #ruby
berserkr has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
<Tasser> can I send a String as file in curb?
bluenemo has joined #ruby
bluenemo has joined #ruby
conor_ireland has joined #ruby
dazoakley has joined #ruby
gyre007 has joined #ruby
nd____ has joined #ruby
Gm4n has joined #ruby
mbreit has joined #ruby
amerine has joined #ruby
jxpx777 has joined #ruby
n3m has joined #ruby
Y_Ichiro has joined #ruby
beilabs_ has joined #ruby
wookiehangover has joined #ruby
destructure has joined #ruby
marcin_m has joined #ruby
libertyprime has joined #ruby
Seppman has joined #ruby
kuzushi has joined #ruby
xpot-mobile has joined #ruby
trengof has joined #ruby
Joelio has joined #ruby
pigoz has joined #ruby
jds_ has joined #ruby
babinho has joined #ruby
psino has joined #ruby
bikcmp has joined #ruby
kaktus has joined #ruby
parus has joined #ruby
brian- has joined #ruby
thebastl has joined #ruby
Otend has joined #ruby
matled has joined #ruby
majoh has joined #ruby
RegEchse has joined #ruby
Kiall has joined #ruby
y_matsu_ has joined #ruby
nwonknu has joined #ruby
ninor has joined #ruby
pygmalion has joined #ruby
Muz has joined #ruby
tightwork has joined #ruby
award85 has joined #ruby
koivula has joined #ruby
felipe has joined #ruby
KillerFox has joined #ruby
mitchty has joined #ruby
emocakes has joined #ruby
[edu]_ has joined #ruby
jlebrech has joined #ruby
Kambus has joined #ruby
phux has joined #ruby
green_ has joined #ruby
LMolr has joined #ruby
justinmcp has joined #ruby
sliv has joined #ruby
LMolr has joined #ruby
EddieS has joined #ruby
josephwilk has joined #ruby
csherin has joined #ruby
havenn has joined #ruby
<shevy> hehe
Morkel has joined #ruby
xastion_ has joined #ruby
nari has joined #ruby
ikaros has joined #ruby
mefis has joined #ruby
Derper has joined #ruby
Derper has quit [#ruby]
imami|afk has joined #ruby
ctp has joined #ruby
odinswand has joined #ruby
dibri has joined #ruby
otakutomo has joined #ruby
oliwer has joined #ruby
oliwer has quit ["kthxbye"]
stoffus has joined #ruby
sawjig has joined #ruby
pen has joined #ruby
dazoakley has joined #ruby
gianlucadv has joined #ruby
Shrink has joined #ruby
lorian has joined #ruby
bluenemo has joined #ruby
PragCypher has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
PragCypher has joined #ruby
vladyn has joined #ruby
vladyn has quit [#ruby]
mefis has joined #ruby
bertho_y has joined #ruby
danielpunt has joined #ruby
Hellojere has joined #ruby
bonhoeffer has joined #ruby
opin has joined #ruby
<bonhoeffer> i don't understand how the gw variable would ever be defined https://gist.github.com/1816284
bluenemo_ has joined #ruby
<bonhoeffer> i've been doing ruby awhile, but don't get what that variable is referring to
LMolr has joined #ruby
dazoakley has quit [#ruby]
vladyn has joined #ruby
frishi has joined #ruby
InBar has joined #ruby
<burgestrand> bonhoeffer: it’s a parameter that the process method passes to the block it is given
moshef has joined #ruby
<bonhoeffer> but where does that parameter get defined?
<moshef> hi, I'm trying to check if certain name is within the begining of my string. I'm using self.name =~ /^copy of/ . is this enough?
<burgestrand> bonhoeffer: http://codepad.org/g94tdJtl
<moshef> it returns 0 when something is found and nil when not..
<moshef> not supposed to return true/false?
<burgestrand> moshef: it returns the index of where it matched
<bonhoeffer> burgestrand, that is very helpful
<bonhoeffer> so it is literally a dummy variable
<burgestrand> moshef: luckily everything except for false/nil is truthy in ruby so you can safely use it in an if-statement
<moshef> what do i do to return true or false? ask for present?
<burgestrand> bonhoeffer: it becomes a local variable to the block, just like within a method
<moshef> as in - ask if it's present ?
<burgestrand> moshef: you could ask if the result is nil, or do !! (string =~ /pattern/)
<burgestrand> bonhoeffer: http://codepad.org/07BqFdi0
opin_ has joined #ruby
eka has joined #ruby
MChizhov has joined #ruby
<MChizhov> hello, i have i regexp name =~ /(k|n)(\d{2})/ . ARe there some embedded vars, which contain k|n and \d{2}?
<bonhoeffer> burgestrand, so i'm specifically getting that it isn't defined -- so that would be in the calling method then
<burgestrand> bonhoeffer: if the yield does not give any parameters, gw will be bound to nil
<burgestrand> bonhoeffer: http://ideone.com/XuTZC
<burgestrand> bonhoeffer: it’s not the same thing as being undefined, however
<burgestrand> MChizhov: check out $~ (for MatchData) and $1 through $9 for the capturing group results
denysonique__ has joined #ruby
<bonhoeffer> burgestrand, so gateway must have been undefined
<bonhoeffer> or nil
<MChizhov> burgestrand, tnx
<burgestrand> bonhoeffer: nil, possibly
<bonhoeffer> burgestrand, i really appreciate your help . . . i need to write some code with yield and blocks to really have it sink in
<bonhoeffer> rails just has us throw it around where yield pulls in the block we send it
<burgestrand> bonhoeffer: sounds like a good idea, blocks are very useful in ruby
tatsuya_o has joined #ruby
kurko_ has joined #ruby
opin_ has joined #ruby
<bonhoeffer> your simple examples were excellent in helping
_obiJuan has joined #ruby
oner has joined #ruby
<PragCypher> rubyscript2exe or ocra?
p0y has joined #ruby
<MChizhov> i have the hash {1=>'first'. 2=>'second'}. i want to return model field value ModelEx.hash{'1'} in fact ModelEx.first
<MChizhov> is it possible?
moshef has joined #ruby
opin_ has joined #ruby
dcarper has joined #ruby
<banisterfiend> MChizhov: what you said makes no sense
<MChizhov> banisterfiend, i know only number
<MChizhov> 1..8
<MChizhov> and the fields are named first, second etc
mengu has joined #ruby
canton7 has joined #ruby
mengu_ has joined #ruby
QKO has joined #ruby
nari has joined #ruby
nemesit has joined #ruby
jaywastaken has joined #ruby
opin_ has joined #ruby
chimkan has joined #ruby
lorandi has joined #ruby
chimkan_ has joined #ruby
lewix has joined #ruby
tatsuya_o has joined #ruby
rfloriano has joined #ruby
lorandi has joined #ruby
tatsuya_o has joined #ruby
BiHi has joined #ruby
opin_ has joined #ruby
TomJ_ has joined #ruby
TomJ_ has joined #ruby
imami|afk has joined #ruby
<shevy> hmm what is better
niklasb has joined #ruby
p0y has joined #ruby
<shevy> if @use_this
<shevy> do_something
<shevy> but it would require a
<shevy> @use_this = CONFIG.use_this
<shevy> or just use:
<shevy> if CONFIG.use_this
<shevy> do_something
heftig has joined #ruby
PragCypher has joined #ruby
pu22l3r has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
opin_ has joined #ruby
fayimora has joined #ruby
randym has joined #ruby
Mekkis has joined #ruby
thone has joined #ruby
BrianE has joined #ruby
randym has joined #ruby
iocor has joined #ruby
tonini has joined #ruby
tuxaddicted has joined #ruby
senny has joined #ruby
fayimora has joined #ruby
`brendan has joined #ruby
dv310p3r has joined #ruby
fr0gprince_mac has joined #ruby
ABK has joined #ruby
Jackneill has joined #ruby
<`brendan> morning
zastav has joined #ruby
BrianE has joined #ruby
jtrudeau has joined #ruby
triptec has joined #ruby
imami|afk has joined #ruby
milkpost has joined #ruby
dnyy has joined #ruby
_obiJuan has joined #ruby
LMolr has joined #ruby
willb has joined #ruby
speggey has joined #ruby
luke-- has joined #ruby
jxpx777 has joined #ruby
neurodrone has joined #ruby
jxpx777_ has joined #ruby
iocor has joined #ruby
tonini has joined #ruby
Sliker has joined #ruby
nari has joined #ruby
tatsuya_o has joined #ruby
kurko_ has joined #ruby
tonini has joined #ruby
Ownatik has joined #ruby
vaxinate has joined #ruby
iocor has joined #ruby
wroathe has joined #ruby
Dyson has joined #ruby
<Dyson> hi, anyone with a pointer to libselinux docs for me?
<Dyson> I'm unable to come up with anything useful :(
Sailias has joined #ruby
mocker has joined #ruby
asif has joined #ruby
yfeldblum has joined #ruby
josemota has joined #ruby
crankycoder has joined #ruby
abstrusenick has joined #ruby
MrGando has joined #ruby
Sailias has joined #ruby
jxpx777 has joined #ruby
ikaros has joined #ruby
geekbri has joined #ruby
tatsuya_o has joined #ruby
yekta has joined #ruby
vaxinate has joined #ruby
nari has joined #ruby
Yusuke has joined #ruby
ChampS666 has joined #ruby
KristianDK has quit ["Linkinus - http://linkinus.com"]
drknus has joined #ruby
dyer has joined #ruby
dyer has joined #ruby
tatsuya_o has joined #ruby
araujo has joined #ruby
cantbecool has joined #ruby
cantbecool has quit [#ruby]
timonv has joined #ruby
nanderoo has joined #ruby
asobrasil has joined #ruby
wyhaines has joined #ruby
dark3rdre4ms has joined #ruby
andrewhl has joined #ruby
KristianDK has joined #ruby
CannedCorn has joined #ruby
carlyle has joined #ruby
nerded has joined #ruby
tbrock has joined #ruby
zastav has joined #ruby
<td123> hi, I see that ruby 1.9.3-p105 is out, but it's not listed on the website, in the github mirror tags, or the svn repository tags
<JonnieCache> exciting
pvgrif has joined #ruby
Mekkis has joined #ruby
<JonnieCache> td123: link?
<pvgrif> how can i make merge not reorder the keys?
<td123> JonnieCache: ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p105.tar.bz2
<pvgrif> i merge hash A with hash B and i like to hash B keys to stay at the back, is this possible?
<td123> I was wondering where the new version was announced, and how distrowatch got it before the svn or git repositories got it
<banisterfiend> phew
<banisterfiend> i hope the new 1.9.3 patchlevel is less buggy
<banisterfiend> 1.9.3 was pretty buggy in places
<banisterfiend> p0
<JonnieCache> lol im pulling 32 kb/s from ftp.ruby-lang.org
<JonnieCache> that cant be right
sobering has joined #ruby
adeponte has joined #ruby
MrGando has joined #ruby
theRoUS has joined #ruby
sonkei has joined #ruby
dv310p3r has joined #ruby
<shevy> JonnieCache hah you third world country connection dude!
uris has joined #ruby
<JonnieCache> nope its fast for everything else
dark3rdre4ms has joined #ruby
tomzx has joined #ruby
LMolr has joined #ruby
PragCypher has joined #ruby
PaciFisT has joined #ruby
fai|safe has joined #ruby
looopy has joined #ruby
PaciFisT has joined #ruby
robbinn has joined #ruby
bbttxu_ has joined #ruby
sobering has joined #ruby
sobering has quit [#ruby]
dandrinkard has joined #ruby
jxpx777 has joined #ruby
jxpx777_ has joined #ruby
IAD has joined #ruby
ryannielson has joined #ruby
iocor has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
dark3rdre4ms has joined #ruby
dark3rdre4ms has joined #ruby
achievbot has joined #ruby
Sailias has joined #ruby
tatsuya__ has joined #ruby
Sailias_ has joined #ruby
jordanstephens has joined #ruby
Sailias_ has joined #ruby
Sailias has joined #ruby
geekbri has joined #ruby
Guest35831 has joined #ruby
tai has joined #ruby
<tai> Is it canonical to omit or include parentheses in function calls? It seems to me that a function call can be written either of 2 ways [new to Ruby here, coming from a Python/Java background]
Targen has joined #ruby
bluenemo__ has joined #ruby
gvt has joined #ruby
tonini has joined #ruby
<rippa> tai: parens are usually used for disambiguation/method chaining/readability
<shevy> tai usually people omit it when there are no arguments
<shevy> cat.meow
<shevy> vs
<shevy> cat.meow()
adambeynon has joined #ruby
<shevy> but you can use them all the time if you want to
<JonnieCache> yeah nobody ever does meow()
<shevy> what I hate are method definitions that omit ()
<JonnieCache> but using them with arguments is a matter of taste really
<shevy> I mean, when there are arguments
<shevy> def foobar one, two, three
csherin has joined #ruby
<JonnieCache> shevy: thats rare too in my experience
* shevy looks around
<shevy> there are guilty people in here!
<tshirtman> i thought it was the way to do it in ruby when i started reading about it
<tshirtman> like removing everything superficial was the aim
<shevy> hmm
<shevy> I usually like being succint and short
<shevy> and then omit things that are not needed
dnyy has joined #ruby
<tshirtman> as long as it doesn't break readability, right?
<shevy> well yeah kinda
<shevy> or perhaps more importantly... when my brain has to think
seanstickle has joined #ruby
<tshirtman> that's the hard spot to find ^^
<shevy> For some reason, I have to think longer when I see "def foo bar" than "def foo(bar)" so I prefer the latter
<tshirtman> i agree
Amirh has joined #ruby
Hanmac has joined #ruby
<Amirh> hi people
<shevy> do you use the new -> operator in 1.9.x yet?
<shevy> My brain is not very happy with it so far, so I try to not use it :\
fayimora has joined #ruby
* tshirtman didn't do 1.9 yet
<tshirtman> quite new to ruby
<JonnieCache> if youre new just learn 1.9
<JonnieCache> dont encumber yourself with 1.8 thinking
<tshirtman> well, i'm doing redmine dev
<tshirtman> plugin*
senny has joined #ruby
<JonnieCache> ah ok
<tshirtman> so i learn what i need ^^
yakko has joined #ruby
hukl has joined #ruby
IrishGringo has joined #ruby
zenChild has joined #ruby
<Hanmac> can i turn a wchar_t character to an ruby string? (there are could also an UTF8 char)
Jake232 has joined #ruby
<linduxed> hey guys, anyone here using rbenv?
<shevy> linduxed heya
<shevy> still having fun with rbenv? :D
<linduxed> shevy: o/
<linduxed> shevy: sure am
jxpx777 has joined #ruby
<linduxed> shevy: noticed that some binaries are not added to the path. cucumber is, but some others arent
jxpx777 has joined #ruby
<linduxed> otherwise it's fine
<shevy> hmm
bobby has joined #ruby
asuka_ has joined #ruby
jaywastaken has joined #ruby
jds has joined #ruby
<JonnieCache> linduxed: yeah im using it
<JonnieCache> linduxed: you have to run `rbenv rehash` after you install new binaries
<JonnieCache> thats the only niggle about it
<JonnieCache> but oyu can fix it with some well placed aliases
<linduxed> i've done that, but it doesn't seem to add it
<linduxed> i've done "gem install rspec" for instance
<linduxed> actually i'm doing it again just for the sake of making sure
<linduxed> there, installed
<linduxed> now i'll do "rbenv rehash"
<linduxed> open up a new terminal...
<tai> What is considered the canonical standard for formatting Ruby code?
<tai> stylistically, I mean
<linduxed> and rspec is not there in shims...
<JonnieCache> linduxed: hmm obviously you are loading it in .bash_profile correctly?
<JonnieCache> thats weird
<linduxed> tai: i don't know if there are that many projects that do code formatting for ruby
<linduxed> tai: google doesn't give that much
<tai> I wasn't clear with my question
<tai> what I mean is, what is the generally accepted style guide for writing Ruby code?
<tai> thank you
<shevy> tai two spaces as indent ... a newline between methods ...
<shevy> logical grouping of code into methods whenever possible
snip_it has joined #ruby
<Hanmac> shevy: do you have an idea to convert an wchar_t?
lorandi has joined #ruby
<shevy> Hanmac nope sorry no idea
carlyle has joined #ruby
<burgestrand> Hanmac: create a new string with the regular rb_string_new(pointer, length) API and use force_encoding to set its’ encoding
<burgestrand> Would be my initial idea at least
denom has joined #ruby
jordanstephens has joined #ruby
<Hanmac> bugestrand: the problem is that i have a wchar_t not a char :/
<burgestrand> Hanmac: fairly certain that ruby stores its’ strings as chars internally; what encoding are your characters in?
<burgestrand> I mean, even if they’re wchar_t’s it’s just a sequence of bytes in the end
<linduxed> ok i found it
<linduxed> i found the line in rbenv that specifies what path contains the binaries
<linduxed> which is (according to the code) versions/*/bin/*
matti has joined #ruby
matti has joined #ruby
<linduxed> but a lot more can be found in "versions/*/lib/ruby/gems/*/bin/*"
eldariof has joined #ruby
<linduxed> although there are some that can be found in the former but not the latter, and vice versa
jamiejackson has joined #ruby
epaiffe has joined #ruby
<epaiffe> How can I crypt the stdin input ? For example, if an user type his password, I don't want to display it on the screen, I wanna see *** or nil
<Hanmac> burgestrand: because i writing itfrom the C side ... :/
<epaiffe> thanks
<burgestrand> Hanmac: yes, but even a wchar_t is just a sequence of bits, isn’t it?
<burgestrand> granted, it may be more bits than a char, but it feels like it could work converting it to a sequence of chars instead and just passing it to ruby ^^
<burgestrand> Hanmac: using wcstombs for example
jlogsdon has joined #ruby
Sliker has joined #ruby
ceej has joined #ruby
jordanstephens has joined #ruby
havenn has joined #ruby
Spockz has joined #ruby
ckrailo has joined #ruby
p0y has joined #ruby
theRoUS has joined #ruby
theRoUS has joined #ruby
daniel_hinojosa has joined #ruby
jlebrech has joined #ruby
ephemerian has joined #ruby
bertho_y has joined #ruby
looopy has joined #ruby
scrogson has joined #ruby
Azure|netbook|dc has joined #ruby
kf8a has joined #ruby
demet8 has joined #ruby
baroquebobcat has joined #ruby
iocor has joined #ruby
yoklov has joined #ruby
alex__c2022 has joined #ruby
pdtpatr1ck has joined #ruby
timonv has joined #ruby
Sliker has joined #ruby
eywu has joined #ruby
QaDeS has joined #ruby
mikepack has joined #ruby
notjohn has joined #ruby
mikewintermute has joined #ruby
fai|safe has joined #ruby
skaczor has joined #ruby
rippa has joined #ruby
denom has joined #ruby
r0bby has joined #ruby
stayarrr has joined #ruby
KristianDK has quit ["Linkinus - http://linkinus.com"]
zenChild has quit [#ruby]
r0bby_ has joined #ruby
tilde` has joined #ruby
straind has joined #ruby
al3xnull_ has joined #ruby
akem has joined #ruby
akem has joined #ruby
Targen has joined #ruby
phrame has joined #ruby
zigidias has joined #ruby
Axsuul has joined #ruby
Axsuul has joined #ruby
Axsuul has joined #ruby
virunga has joined #ruby
mackid has joined #ruby
Axsuul has joined #ruby
ElitestFX has joined #ruby
ElitestFX has joined #ruby
tayy has joined #ruby
sdwrage has joined #ruby
axl_ has joined #ruby
<sdwrage> Good morning all
dnyy has joined #ruby
mxweas_ has joined #ruby
<sdwrage> afternoon rather
<sdwrage> :P
fr0gprince_mac has joined #ruby
alx- has joined #ruby
axl_ has joined #ruby
banseljaj has joined #ruby
gvt has joined #ruby
j_i_g_o_L_o_BURS has joined #ruby
wmoxam has joined #ruby
colossal7 has joined #ruby
zen_ has joined #ruby
fayimora has joined #ruby
<davidpk> if i want to provide Enumerable capabilities over a class, instead of over instances of that class, how do I do that?
demian`_ has joined #ruby
<arturaz> davidpk, Foo.extend Enumerable
<n3m> is there some kind of header i can put into a file to get the correct syntax highlighting even if the file doesn't has the language-typic extension?
<davidpk> arturaz: *tries it*
<n3m> wrong channel. sry
<burgestrand> n3m: some editors can pick it up on the shebang of a file
macmartine has joined #ruby
chaitanya has joined #ruby
moted has joined #ruby
stringoO has joined #ruby
grouzen has joined #ruby
eldariof has joined #ruby
cbuxton has joined #ruby
<tshirtman> http://paste.ubuntu.com/840598/ i'm trying to add an attribute to redmine issues there is probably something i'm doing wrong, as i get an error when i try to use it
<tshirtman> any idea?
ph^ has joined #ruby
achievbot has joined #ruby
Synthead has joined #ruby
jwmann has joined #ruby
banseljaj has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
<JonnieCache> tshirtman: post the error as well
stef_204 has joined #ruby
<tshirtman> JonnieCache: well, it's a dumb "undefined method 'estimated_time_to_completion'"
josefig has joined #ruby
samsonjs has joined #ruby
bluOxigen has joined #ruby
albemuth has joined #ruby
fayimora has joined #ruby
gavit has joined #ruby
n3m has joined #ruby
ephemerian has joined #ruby
achievbot has joined #ruby
SegFaultAX|work has joined #ruby
larles has joined #ruby
<larles> hi
larles has quit [#ruby]
adeponte has joined #ruby
cyri_ has joined #ruby
savage- has joined #ruby
tmiller_ has joined #ruby
adeponte_ has joined #ruby
nowthatsamatt has joined #ruby
triptec_ has joined #ruby
phantomfakeBNC has joined #ruby
nowthatsamatt has quit [#ruby]
kmurph79 has joined #ruby
DrShoggoth has joined #ruby
maletor has joined #ruby
rflorianobr has joined #ruby
lateau_ has joined #ruby
gvt has joined #ruby
alek_b has joined #ruby
axl_ has joined #ruby
deryl_ has joined #ruby
pdtpatr1ck has joined #ruby
FlyingFoX13 has joined #ruby
p0y has joined #ruby
colint has joined #ruby
ihme-TTilus has joined #ruby
oddmunds has joined #ruby
altivec has joined #ruby
yakko has quit ["http://quassel-irc.org - Chat comfortably. Anywhere."]
adman65 has joined #ruby
philips has joined #ruby
ElitestFX has joined #ruby
ElitestFX has joined #ruby
TomJ has joined #ruby
TomJ has joined #ruby
JohnBat26 has joined #ruby
havenn has joined #ruby
vereteran has joined #ruby
cloke has joined #ruby
yoklov has joined #ruby
saurb has joined #ruby
luckyruby has joined #ruby
dasfugufish has joined #ruby
<davidpk> arturaz: thanks! works great
<arturaz> np
dark3rdre4ms has joined #ruby
kpshek has joined #ruby
gift has joined #ruby
n8ji has joined #ruby
enroxorz has joined #ruby
ly- has joined #ruby
<gift> i've got a hex string that i'd like to print as an ascii string. i.e. "41414141" => "AAAA". google is reluctant to give me a straight answer
dark3rdre4ms has joined #ruby
PragCypher has joined #ruby
Sliker has joined #ruby
internet_user has joined #ruby
hukl_ has joined #ruby
<td123> "%c" % "41".to_i(16)
enroxorz has quit [#ruby]
<td123> you'll have to modify that, but it should be easy from there :P
<frontendloader> thin's website actually makes me angry
<canton7> yeah... it's thing. OK. I get it. Now make it readable
<canton7> s/thing/thin
<frontendloader> I can understand having your main page be 'thin', but the docs too? I want to say so many nasty things.
cassarani has joined #ruby
musl has joined #ruby
<frontendloader> I've never been this angry about software before.
<cassarani> so say I'm returning JSON from a web service using Array#to_json, should I convert my characters into HTML entities as appropriate?
<Mon_Ouie> You can just generate the docs yourself though
<cassarani> in particular, I'm returning a JSON string that has "£" in it at one point - should it be "&pound;"?
Araxia has joined #ruby
<cassarani> or should JSON not know about HTML entities?
<cassarani> i.e. should the conversion happen on the server or on the client side?
fayimora has joined #ruby
<canton7> cassarani, I make the distinction between passing HTML and passing data over JSON. If you're expecting the JS to parse the received value, then it's data, and shouldn't be escaped. If it's just spitting it onto the page, it's HTML, and it should be escaped imo
<frontendloader> pass it as
<cassarani> canton7: I agree, the data is being sent to a Backbone.js client app
<cassarani> which is then displaying it inside an Underscore.js template
<cassarani> so it sounds like that's when the conversion should happen
<cassarani> at rendering time that is
rickmasta has joined #ruby
ghanima has joined #ruby
havenn has joined #ruby
<gift> td123: thats a solid start, can i perform that calculation on the entire string, or will I need to do it on a per-character basis? i can't seem to get the former to work
bwlang has joined #ruby
rtyler has joined #ruby
havenn has joined #ruby
<td123> no, when I said you have to modify it, I meant that it will only work on a per "2 char" basis
adamkittelson has joined #ruby
gavit has joined #ruby
fallen has joined #ruby
Sliker has joined #ruby
havenn has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
Sliker has joined #ruby
gilesw has joined #ruby
<gilesw> heya rubiers
adamkittelson has joined #ruby
<gilesw> i'm looking for some help debugging a library I'm using
gavit has joined #ruby
bwlang_ has joined #ruby
<gilesw> It works fine reading from google apps but when I try and create a user I get this stack http://pastie.org/3375172
mgm7734 has joined #ruby
t0mmyvyo has joined #ruby
stephenjudkins has joined #ruby
caution has joined #ruby
ReachingFarr has joined #ruby
<caution> what does @ before a variable mean?
auska has joined #ruby
<mackid> caution: instance variable. different values for every instance of the class
gloomer has joined #ruby
<auska> Hi! I'm looking for a function like the php ones var_dump() or print_r() on ruby. Which one can i use?
<cassarani> you can use p
<shevy> or pp var
<dark3rdre4ms> yep, 'p' or 'pp'
<cassarani> though I don't fully remember what those functions do in PHP
<shevy> but you must require 'pp' before you can use pp
GiambalaGiambala has joined #ruby
<caution> different values for every instance? so by default variables inside classes are shared between instances?
<heftig> no
<cassarani> caution: what other languages are you familiar with?
<heftig> "normal" variables are local
leoncamel has joined #ruby
<cassarani> I bet you they'll have the same concept, they'll just call it something different
<caution> python, php, C
<mackid> caution: that would be @@, class variables, those are shared with all classes. and what heftig said
<cassarani> ok, C doesn't have instance variables because it doesn't have classes
<mackid> shared with all instances, sorry
<ReachingFarr> Rake has decided that it should extend the Object class with the Rake::DSL module. This causes it to break when I load my code that has a class with a method named 'rule'. Does anyone know how to stop Rake from doing this hateful thing? It even says that global access to Rake::DSL methods is deprecated and yet they sill extend Object!
<cassarani> but Python has "data attributes" I think
<heftig> mackid: and all subclasses and their instances
<cassarani> unless that's not the name
<caution> is @var the equivalent to self.var?
<heftig> no, self.var would call a method "var" on self
<cassarani> caution: do you mean 'self.var' in Python?
<caution> self.var exists in Ruby?
<caution> yes
<cassarani> I don't know Python well enough
Synthead has joined #ruby
<cassarani> but it sounds like that's the idea, yeah
<cassarani> every instance of the same class will have its own value for the different @vars that the class defines
xastion has joined #ruby
<cassarani> class Foo ; def initialize(bar) ; @bar = bar ; end ; end
<cassarani> a = Foo.new("foo") ; b = Foo.new("bar")
<cassarani> a will have a value of "foo" for @bar and b will have a value of "bar" for @bar
<caution> what does 'self' mean in Ruby?
<heftig> current object
<mackid> caution: also, if you're familiar with python, this might be helpful: http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-python/
<caution> thanks I've read that
<mackid> self differs based on the caller
<heftig> no, the callee
<caution> so it's like 'this' in javascript?
<heftig> yes
Synthead has joined #ruby
<ReachingFarr> Does anyone know how to stop Rake from being a jerk and breaking when I require a class from my project?
rtyler has quit [#ruby]
xplorer00 has joined #ruby
<caution> is it standard to check if a variable is undefined using if (!var) ?
nfluxx has joined #ruby
<cassarani> that wouldn't work in Ruby
shadoi has joined #ruby
<pcboy_> ReachingFarr: task :your_task => :environment do blabla end
<cassarani> uninitialised variables will throw a NameError
robotmay has joined #ruby
<pcboy_> cassarani: I'm using defined?
<cassarani> pcboy_: I was answering caution's question
ElitestFX has joined #ruby
ElitestFX has joined #ruby
<pcboy_> cassarani: Oh right
<caution> how about "if (!@var)", is there a difference?
<caution> I see it in some code where @var can be undefined at that point
<heftig> undefined instance variables have the value "nil"
<caution> heh
<heftig> if defined?(@var)
Hanmac has quit [#ruby]
<heftig> defined?(@var) # => nil
<heftig> @var = nil
<heftig> defined?(@var) # => "instance-variable"
<caution> "defined?" is some kind of built in function?
<Mon_Ouie> It's a keyword
<Mon_Ouie> It could not be defined as a function, other
<Mon_Ouie> otherwise defined? Foo would raise an exception instead of returning false
<shadoi> caution: don't ever do that. :) use: unless @var
<Mon_Ouie> (and it should be method, not function)
<cassarani> caution: you can either use unless @var, or unless @var.nil?
<cassarani> use the former if @var is unlikely to be false, use the latter if it could be false
<cassarani> that's because in Ruby the only falsy values are false and nil
<cassarani> so when you say "unless @var" that means "unless @var == false || @var == nil"
akem has joined #ruby
akem has joined #ruby
bluOxigen has joined #ruby
ephemerian has joined #ruby
chaitanya has joined #ruby
blueOxigen has joined #ruby
<ReachingFarr> pcboy_: Close, but I didn't give you enough information to get the correct answer. Turns out I needed to set the TestTask.loader variable to :testrb to stop Rake from loading its stupid Rake::DSL module.
xplorer00 has quit [#ruby]
tvo has joined #ruby
nemesit has joined #ruby
apok has joined #ruby
<caution> is there a debug function I can use to list the methods of an object?
<caution> or all the attributes
<canton7> caution, like object.methods ? ;)
<caution> yes thanks
<cassarani> caution: also object.instance_variables to get all the instance variables (unsurprisingly)
<pcboy_> caution: I like to use the looksee gem too. It adds a nice ls method to your objects.
<mackid> protip: most stuff in ruby is named what makes sense :P
<canton7> pcboy_, that looks awesome cheers :)
nerded has joined #ruby
Russell^^ has joined #ruby
axl_ has joined #ruby
<caution> are methods that end in ?, standard methods that return a boolean?
cjlicata has joined #ruby
<mackid> yes
colint has joined #ruby
manizzle has joined #ruby
<caution> and ones that end in ! modify the object?
<mackid> specifically, they're "more dangerous" than the non-! version. but if there's only one version of the method, then it probably won't have an !, and could still modify the object
<caution> haha
<canton7> "potentially unexpected" is another way of interpreting it
<caution> I hope this wacky language doesn't interfere with my knowledge of other ones
<caution> I know I'm going to end up typing "elsif" in python all the time after this
<canton7> it tends to decrease your opinion of other languages imo
mengu has joined #ruby
<nate_h> is there a way to have gem print its repo?
<nate_h> that its using?
<mackid> when i have to go back to c++ I always forget semi-colons...
Sliker has joined #ruby
Skaag has joined #ruby
nobitanobi has joined #ruby
<nobitanobi> I'm getting a string and I need a Fixnum. How do I convert?
badabim has joined #ruby
<mackid> nobitanobi: .to_i will probably work
<canton7> nobitanobi, "string".to_i
stephenjudkins has joined #ruby
<nobitanobi> ok, thanks guys
kenperkins has joined #ruby
havenn has joined #ruby
<nobitanobi> ruby converts integer to big int when it overflows
zodiak has joined #ruby
<nobitanobi> right?
<auska> Is there any function that if I have a queue check if a var is on it?
baroquebobcat has joined #ruby
ikaros has joined #ruby
<mackid> auska: if you need to do that, you probably should be using a different data structure
CoverSlide has joined #ruby
<auska> mackid, which one would you advise me? I need to have on it all the links that i found while crawling a web site...
namidark has joined #ruby
dross_ has joined #ruby
<namidark> If I have a module Animal and a module Dog and include Dog inside animal, shouldn't I be able to access it via Animal::Dog? or is that a different syntax?
<mackid> auska: you just need to keep track of all the links you followed, then see if "x" is one of them?
<burgestrand> namidark: no, include does not do that
kirun has joined #ruby
mmokrysz has joined #ruby
mmokrysz has quit [#ruby]
<namidark> burgestrand: hmm is there some way to get that without mucking everything into one module :(?
<burgestrand> namidark: in essence; classes and modules will namespace constants defined inside them
<burgestrand> namidark: why would you do that?
<burgestrand> or, want to do that
bjensen has joined #ruby
<namidark> burgestrand: keep the module cleaner :\?
daglees has joined #ruby
crankycoder has joined #ruby
<auska> mackid, yes, i know it but the problem is how to " keep track of all the links you followed" ...
<burgestrand> namidark: I have no idea what you mean
<namidark> burgestrand: so instead of having 20 animals as sub modules inside animal, I could jus tinclude each one, and keep their code in a seperate file
lorandi has joined #ruby
<burgestrand> namidark: you can still keep their code in a separate file, you can reopen modules and classes in ruby
colint has joined #ruby
<mackid> auska: if you don't care about ordering, you can put them in a hash. then you don't have to worry about duplicates. or you could use an array, and use index("this/url.htm") to determine whether you've seen it before
zommi has joined #ruby
bwlang_ has joined #ruby
skrewler has joined #ruby
gavit has joined #ruby
samsonjs has joined #ruby
<namidark> burgestrand: OH! so for instance in dog.rb I'd just do module Animal; module Dog; etc?
<burgestrand> namidark: sure :)
<namidark> burgestrand: awesome :) thanks!
<burgestrand> namidark: http://codepad.org/P8PrKDs6
lkba has joined #ruby
<burgestrand> namidark: more or less that’s what that does
AndChat- has joined #ruby
<burgestrand> namidark: keep in mind Dog won’t include any behaviour from Animal; the only thing affected here is how you access the Dog constant (which is through Animal)
<namidark> burgestrand: forgot about how ruby does that ;) been to bogged down in rails
<frontendloader> http://bpaste.net/show/yZsful3gAl557lyUsPGs/ -- 10 LoC, what's the proper way to do this?
n3m has joined #ruby
<burgestrand> frontendloader: "super and @value%…"
<burgestrand> frontendloader: also if you use attr_accessor you might as well just lose the @value and access the ivar through the method "value" instead
jxpx777 has joined #ruby
<frontendloader> not sure what you meant by that second sentence, but I'm interested to know
PragCypher has joined #ruby
havenn has joined #ruby
airhorns has joined #ruby
danishkhan has joined #ruby
chimkan___ has joined #ruby
dibri has joined #ruby
llaskin has joined #ruby
<llaskin> what flag do you pass to the ruby executable to force it to ignore warnings?
zakwilson_ has joined #ruby
LMolr has joined #ruby
JanL has joined #ruby
<Mon_Ouie> -W0
sirdeiu has joined #ruby
<Mon_Ouie> Though I'd really answer, you fix the code that triggers warnings
<llaskin> yea i know Mon_Ouie, its a redeclaration warning
<llaskin> and tbh, i wanted to redeclare it...
sdwrage has joined #ruby
<Mon_Ouie> Well, you can still change the code
<Mon_Ouie> Undefining the constant before redefining
Phrogz has joined #ruby
hukl has joined #ruby
Jay_Levitt has joined #ruby
rfloriano has joined #ruby
phantomfakeBNC has joined #ruby
<llaskin> how do u undefine?
<Mon_Ouie> Module#remove_constant
<csherin> also remove_class_variable and remove_instance_variable
<llaskin> ok cool
<llaskin> thanks
adamkitt_ has joined #ruby
jgrevich has joined #ruby
ReachingFarr has quit [#ruby]
adamkittelson has joined #ruby
senj has joined #ruby
davidcelis has joined #ruby
thecreators has joined #ruby
axl_ has joined #ruby
alerticus has joined #ruby
colint has joined #ruby
philips has joined #ruby
Husel has joined #ruby
ctp has joined #ruby
pingfloyd has joined #ruby
wroathe has joined #ruby
cyri_ has joined #ruby
<burgestrand> frontendloader: I mean dropping the @ on @value :)
<burgestrand> frontendloader: it’ll work because you have defined attr_accessor :value
snearch has joined #ruby
conor_ireland has joined #ruby
kuzushi has joined #ruby
tensai_cirno has joined #ruby
<tai> So, ruby seems pretty well geared toward metaprogramming, is this really the case?
<tai> [DSL's and such]
<burgestrand> tai: yep
<tai> awesome! even more exciting then
<caution> what does it mean if a name starts with a colon?
<burgestrand> caution: it’s a symbol, a special kind of string that is never garbage collected (it stays in memory forever) and is very speedy to compare with
<burgestrand> tai: sinatra (http://sinatrarb.com/) is a good example of how DSLs are written and used in Ruby
bwlang_ has joined #ruby
shadoi1 has joined #ruby
thecreators_ has joined #ruby
Seppman has joined #ruby
ph^ has joined #ruby
userbard has joined #ruby
adamkittelson has joined #ruby
billy_ran_away has joined #ruby
<tai> thanks for the link burgestrand, this is quite an interesting read!
<billy_ran_away> I asked this in #rspec, but there's not very many people there so… I'm trying to spec a serialization class method… and I'm at complete loss as to how to do this… Can anyone point me in the right direction?
<burgestrand> billy_ran_away: take some value, run it through the serialization method, and look at the end result to make sure it’s what you expect.
18WABMEJB has joined #ruby
<burgestrand> billy_ran_away: Serializer.serialize(original_value).should eq expected_value
jxpx777 has joined #ruby
<billy_ran_away> Right, but I need to run a bunch of examples though, so will those different examples be in an example group with a shared context?
<burgestrand> tai: rspec is also a nice example, but it’s harder to look at the documentation for that to get a feel of how it looks. :)
<billy_ran_away> Or the different examples really different context that need to go though a shared example?
|bardoe| has joined #ruby
<burgestrand> billy_ran_away: I’m not sure why you need to nuke your egg when it sounds like you just need a spoon. Can’t you just wrap the different test cases in a describe block?
<billy_ran_away> Yea but I'm just not sure how to keep it DRY...
<billy_ran_away> burgestrand: Here's my 2nd attempt...
<burgestrand> I’m thinking something like this, billy_ran_away: http://codepad.org/zIR0zsF9
<burgestrand> But perhaps we need more context
<burgestrand> Um, pun not intended :d
<billy_ran_away> Here's my first: http://pastie.org/3375800
BrianE has joined #ruby
adamkittelson has joined #ruby
<burgestrand> Ah, I see.
<burgestrand> or rather, I see what you’re trying to do
<billy_ran_away> Well I'm working on the rails gem xml_active, right now it has two separate methods, many_from_xml and one_from_xml, I want to make them both use one method from_xml and test that it can handle all the associations of AR so I need to build examples of each.
<burgestrand> No idea if it’s what you should be doing though; take a look at the first example on https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples — it describes how you do that specific thing
jgarvey has joined #ruby
skaczor has joined #ruby
<billy_ran_away> That's what confuses me… it should really be shared_examples XmlActive do and the describe "one record" do
jgarvey has joined #ruby
maletor has joined #ruby
CannedCorn has joined #ruby
<billy_ran_away> I hate being paralyzed by questions like I am now...
jgarvey has joined #ruby
<billy_ran_away> Everything feels completely wrong
stayarrr has joined #ruby
<burgestrand> billy_ran_away: I’m still hesitant to believe you need a shared context at all; for one method on one object it sounds a bit like an overkill… but I guess it could be useful if you need more than one test for each input type. In that case what you have there looks okay to me.
<CannedCorn> hey guys what exactly happened to the hash implementation on the latest 1.8.7 patch level
<CannedCorn> does merge! call []= internally for all the key,value pairs that are being passed in, how would i figure out what is going on behind the scenes?
<billy_ran_away> burgestrand: Well because I want to be handle an array of many AR objects, and just one AR object, so every association test twice, and import test twice
<burgestrand> CannedCorn: it depends on the ruby implementation; I’d read the C source if you’re into that kind of thing
dazoakley has joined #ruby
pingfloyd has joined #ruby
<CannedCorn> thanks burgestrand
<burgestrand> billy_ran_away: what’s wrong with the example you showed us?
<CannedCorn> one more, if you are passing in an Array as a last argument how do you prevent it from becoming a hash
<billy_ran_away> Which one?
<billy_ran_away> The first or second?
<burgestrand> billy_ran_away: http://pastie.org/3375800
<burgestrand> I just saw one
akem has joined #ruby
akem has joined #ruby
kf8a has joined #ruby
TomJ has joined #ruby
TomJ has joined #ruby
<billy_ran_away> Here's my second one, http://pastie.org/3375790
<billy_ran_away> burgestrand: I'm looking though the first one… and it's funny I can't remember what was wrong with it now...
<billy_ran_away> I need to look at the output...
<burgestrand> billy_ran_away: :p
danishkhan has joined #ruby
axl_ has joined #ruby
jitesh_shetty has joined #ruby
<billy_ran_away> Oh I didn't like it was going to run all the association tests with just the one include...
<billy_ran_away> Hence I went to something like the 2nd, but I can't figure how to include shared_examples
<burgestrand> billy_ran_away: what do you mean; you want to include and run only half of the shared examples?
<burgestrand> the whole point of shared examples is that it runs all the tests within that shared example ^^
<billy_ran_away> burgestrand: No I want each individual association test to be run for both contexts...
<billy_ran_away> err no
bbttxu_ has joined #ruby
<billy_ran_away> I mean I need to set up different objects for each of those association tests
<billy_ran_away> so I want different contexts for each...
<billy_ran_away> I don't know I"m confused, I'm just going to go write some code and come back to the rspec in a minute
<billy_ran_away> I hate doing that though
<burgestrand> billy_ran_away: you mean the parameter book/books you pass in when you include the shared examples?
<billy_ran_away> Well not quite, because that model only has a has_many
<billy_ran_away> So there's some other models with the other associations that I need to instantiate and then test
<burgestrand> billy_ran_away: so, if I understand you right, each of those (has_many, has_one, belongs_to) it’s a different model under test?
<billy_ran_away> so I want to make one of say belongs_to in one context, and then make a bunch in another context and run them though the examples
<billy_ran_away> burgestrand: Yea
methodfree has joined #ruby
<burgestrand> billy_ran_away: do you need to write more than one test for each kind?
remink has joined #ruby
remink has joined #ruby
kmurph79 has joined #ruby
<burgestrand> billy_ran_away: or will the test look the same for each kind (with the exception of the model under test itself)?
<billy_ran_away> But not necessarily… by that I mean I could just add associations to say the book model and it'd be the same mode in that case
<billy_ran_away> I don't know, I could see arguments for both ways now… but I'd lean to separate tests for one record and many records of each kind of association
<billy_ran_away> Just to help isolate failures, this meta programming can get hairy fast
apok_ has joined #ruby
y3llow has joined #ruby
s0ber has joined #ruby
ChampS666 has joined #ruby
ciopte7 has joined #ruby
<burgestrand> Oh, I think I see now.
<burgestrand> … again.
<burgestrand> :p
adeponte has joined #ruby
<robacarp> exception reentered
<robacarp> does that mean what I think it means? It raised an exception in a rescue block?
c0rn has joined #ruby
llaskin has quit [#ruby]
<burgestrand> You have your method thing, that takes either a range of models or just one model — for both of these cases, you want to test that it does the right thing for a model that has: a has_one, a belongs_to, a has_many… etc.
<burgestrand> billy_ran_away: ^?
y3llow has joined #ruby
Sliker has joined #ruby
cableray has joined #ruby
<billy_ran_away> http://pastie.org/3375996
hooper_ has joined #ruby
<billy_ran_away> burgestrand: http://pastie.org/3375996
<billy_ran_away> burgestrand: Yea
skrewler has joined #ruby
<billy_ran_away> burgestrand: Took me a minute to grok what you said : )
y3llow has joined #ruby
<billy_ran_away> burgestrand: I wish I could so something like that : )
<burgestrand> billy_ran_away: you have no idea how long it took me to grok enough to write that sentence :P
PragCypher has joined #ruby
<burgestrand> or, actually, you’ve been here all the time
<billy_ran_away> *do
jordanstephens has joined #ruby
<RubyPanther> I love it when an interpreter is described with, "It maybe works (in near future)."
stephenjudkins has joined #ruby
<RubyPanther> If it does work, you can feel extra-lucky
<burgestrand> billy_ran_away: hm.
<RubyPanther> I have my lucky neko so it might work.
<billy_ran_away> So I think I can actually make it simpler… the test itself should be same...
<burgestrand> billy_ran_away: I take it the test case will look the same for each of the associations?
<billy_ran_away> imported_xml.should == exported_xml
<burgestrand> Yeah
virunga has joined #ruby
<billy_ran_away> So… just dry up the test!!!! : )
<billy_ran_away> Make a custom matcher or something like that
<billy_ran_away> burgestrand: Awesome, thank for helping me think though this shit
<billy_ran_away> *thanks
<billy_ran_away> and *through
bwlang_ has joined #ruby
* billy_ran_away slaps himself
<burgestrand> billy_ran_away: I didn’t provide you with a solution, but a rubber duck always helps to straighten out your thoughts :)
<billy_ran_away> burgestrand: Yep, thanks again!
nonotza has joined #ruby
danslo has joined #ruby
<shadoi1> anyone have the latest rubinius installed?
Mekkis has joined #ruby
<burgestrand> shadoi: you need something special?
Guest83591 has joined #ruby
manizzle has joined #ruby
josefig1 has joined #ruby
<shevy> sex
<RubyPanther> there's an app for that
<shevy> lol
<shadoi> burgestrand: I just needed to know how big the interpreter, etc. are
<shadoi> I'll install RVM later though. :)
<burgestrand> shadoi: alright :)
danishkhan has joined #ruby
ikaros has joined #ruby
dcl has joined #ruby
Mohan has joined #ruby
Tearan has joined #ruby
<fred> hi - I'm a vim fan (i.e. I want to keep the keybidnings) - any recommendations for an IDE that's good for quick refactoring? eg extracting methods, renaming variables/methods etc
zomgbie has joined #ruby
<fred> komodo and textmate (with plugin) seem releavnt, any others I should add to that list?
<shadoi> fred: vim.
<fred> in that case, any recommendations for plugins to get those features?
dazoakley has quit [#ruby]
indstry has joined #ruby
bwlang_ has joined #ruby
<shadoi> there's a vim-ruby/rails thing
<shadoi> those features are in vim though, just takes some digging to figure out the voodoo.
<fred> at the moment I do them with :%s/// which is kinda troublesome
<shadoi> troublesome in that you miss things, or troublesome in that you need to do it across a project or what?
<fred> hitting variables without hitting similar phrases in comments, dots, spaces, multilines - just regexps seem the wrong tool for the job
Targen has joined #ruby
<shadoi> never been an issue for me… *shrug*, textmate should fill the gaps though I suppose.
<shadoi> I just keep the changes granular, and use find/sed in the shell for bigger changes.
coucher has joined #ruby
chimkan has joined #ruby
ryannielson has quit [#ruby]
snearch has joined #ruby
ilyam has joined #ruby
nanderoo has quit [#ruby]
dr_bob has joined #ruby
<Eiam> how is "01/22/2012" an invalidte date? a="01/22/2012"; DateTime.parse(a).strftime("%m/%d/%Y")
<Mon_Ouie> There's are only 12 months in a year, not 22
rushed has joined #ruby
<Eiam> strftime should be dealing with that.. it explicitly says m/d/year
adamkittelson has joined #ruby
<Mon_Ouie> No, it's in Date.parse
<Mon_Ouie> You don't pass any format to Date.parse, it assumed DD/MM/YYYY
caili has joined #ruby
<dr_bob> Eiam: d = DateTime.strptime '01/22/2012', '%m/%d/%Y'
<Mon_Ouie> strptime allows you to pass a format
<Mon_Ouie> Like that, yeah
<Eiam> oh
<dr_bob> Eiam: strftime is for formatting a DateTime, that does not affect parsing which happens before
namidark has joined #ruby
<Eiam> right parse is barfing on the bad format
<Eiam> that im reformatting after its bad
<Eiam> (since i knew it was bad) yeah, go me. anyway
<Eiam> thanks..
<namidark> Is there an elegant way of checking if something is nil, and then checking if empty, without doing a nested if block? unless foo.nil? && foo.empty? is borking when foo is nil
anon117 has joined #ruby
<Mon_Ouie> You want ||, not &&
<Eiam> .blank?
<Eiam> (in rails)
waazzuup has joined #ruby
jingoro has joined #ruby
bwlang_ has joined #ruby
savage-_ has joined #ruby
<namidark> Mon_Ouie: thanks!
<havenn> def blank?; respond_to?(:empty?) ? empty? : !self; end
<namidark> Eiam: yeah I'm in rails :\ ... blank is the same as empty isnt it?
conor_ireland has joined #ruby
cableray has joined #ruby
<Eiam> no
<Eiam> blank does empty & nil
bwlang has joined #ruby
<dr_bob> nil? || empty? ?
odinswand has joined #ruby
<namidark> ah thanks Eiam :)
<Eiam> np
jingoro1 has joined #ruby
caili has quit [#ruby]
Aquilas has joined #ruby
tilde` has joined #ruby
<Aquilas> Hey guys quick question. I need to pull a bunch of files off of links on a website. Can I use ruby to write a script that will download the files all at once for me?
ilyam has joined #ruby
<RubyPanther> yes
n8ji has joined #ruby
<Eiam> maybe not "all at once"
<Aquilas> well not all at once
<Eiam> but certainly all of them =)
<Aquilas> but at least download all the files
danishkhan has joined #ruby
<Aquilas> Ah great
<Aquilas> I program but I haven't used ruby yet haha
<Eiam> someone wrote it for you already
xastion has joined #ruby
<Eiam> sovled problem
<Eiam> =)
linoj_ has joined #ruby
<Aquilas> Hmm I see
<Aquilas> Thanks a lot I'll try and work with this
<Eiam> there were a few examples provided so
<Eiam> you should be able to suss out something
hippyphysicist has joined #ruby
davidpk has joined #ruby
colint has joined #ruby
Ferdev has joined #ruby
<zomgbie> if i wanted to build a small restful web service with sinatra which test framework should i use? i have been really inspired by tom preston werners article on "readme driven development" and wanted to go a step further to use the occasion and really dive into test driven development...
<dr_bob> Aquilas: I think Mechanize may help you as well.
<Aquilas> I'll take a look thanks!
<zomgbie> is bdd "overengineering" within the realm of test driven development? it's a little hard to grasp for me but it somehow *seems* as if this could be really what i am looking for..
enherit has joined #ruby
<burgestrand> zomgbie: everybody have a different definition of bdd, what’s yours?
<zomgbie> burgestrand: honestly, I don't have any ... yet ... I just want to write the docs for my API before writing the code ( http://tom.preston-werner.com/2010/08/23/readme-driven-development.html ) but also would like to maybe leverage that with an existing test library to even further the cause... so in short I don't know for sure what I am searching for because I lack the experience (only dabbled with some default unit::test once..)
Azure has joined #ruby
scelis has joined #ruby
asobrasil has quit [#ruby]
<zomgbie> so opinionated hints on the current best practices are very welcome
<zomgbie> something like that...
<burgestrand> zomgbie: in my opinion; as long as you are writing tests for your code, and write your tests first, you’re at least halfway there; the reason you write your tests first is the same rationale for RDD
<burgestrand> zomgbie: personally, I prefer rspec over minitest (1.9 test::unit), but it’s a personal preference and more of a stylistic choice
Micgo has joined #ruby
hobodave has joined #ruby
<havenn> hrmm, better practice to use respond_to? rather than rescuing NoMethodError, or just stylistic preference?: class Object; def blank?; begin; empty?; rescue NoMethodError; nil? end end end
<burgestrand> havenn: use respond_to?
<burgestrand> havenn: exceptions are not for control flow
fridim_ has joined #ruby
stephans has joined #ruby
<havenn> burgestrand: that makes sense... thanks! will do
<zomgbie> burgestrand: thanks - so what is the real difference between rspec and say cucumber? the "english" decided feature descriptions integrated into a "rigid" development process? do i understand this correctly?
<davidcelis> cucumber is for integration testing
robotmay has joined #ruby
<burgestrand> zomgbie: cucumber another layer on top of rspec/minitest
<davidcelis> spec testing really just provides an alternative syntax/ideology to test the same sorts of things as unit tests
<davidcelis> but cucumber is specifically for testing user interaction with your app
<burgestrand> zomgbie: so, when using cucumber, you will use rspec/minitest to write your assertions
milkpost_ has joined #ruby
<havenn> class Object; def blank?; if respond_to?(:empty?); empty?; else; nil? end end end #=> Less fail** =P
<milkpost_> is there a way to make ruby evaluate an expression like "5/10" but make it use floats to do it?
<milkpost_> will I have to split and then convert things to floats?
bwlang_ has joined #ruby
<zomgbie> davidcelis, burgestrand: I get it now, cucumber is just "topping" on rspec/minitest/etc for integration testing.. so i've got to get my definitions right (still don't know exactly what unit testing, functional testing differentiates... will fix that now :))
<havenn> milkpost_: hrm, you mean like?: require 'mathn'
<zomgbie> thanks in any case!
<burgestrand> zomgbie: frankly, all the frickin' terms confuse me as well, not to mention that every single person has a different opinion on what is what
apok has joined #ruby
<milkpost_> havenn: yes, thank you
lorandi has joined #ruby
<zomgbie> burgestrand: that feels good to hear, i keep struggling for some years now %-) will set that straight once and for all as i think especially when building a webservice the whole tdd thing can be really satisfying and useful.
rudyl313 has joined #ruby
colint has joined #ruby
<milkpost_> havenn: where can I find out more about this library, ruby-doc is kinda lame about explaining what it all does
<burgestrand> zomgbie: personally, when building web applications, I write tests that simulate user behavior with capybara and rspec (and sometimes cucumber on top of that, sometimes just capybara and rspec themselves), and then I write tests for my models (the business logic) in addition to that
<zomgbie> burgestrand: thanks for the pointers, i will check out capybara as well! i was already getting a little depressed because of the whole issue, this helps - thanks a lot :)
<burgestrand> Then there’s also controller tests and view tests; I don’t do either of those. Have had my fair share of cleaning up after other peoples’ applications which use them two and a few other ones and it always brings issues for me with little benefit. Keep in mind this is my opinion; some people are bound to think I’m a moron for thinking like this and that view tests are the shit.
c0rn has joined #ruby
<burgestrand> zomgbie: and a final note about readme driven development; the idea is to think of what you want to do before writing code. to have a plan, more or less.
nerded has quit [#ruby]
<zomgbie> burgestrand: yeah exactly what i'm aiming for. getting rid of that vague idea thing and really be sure *before* beginning to code.
Sliker has joined #ruby
hubub has joined #ruby
<milkpost_> havenn: thanks!
<havenn> Would be nice to have 'click to toggle source' be a bit more prominent on new ruby-doc design, easy to miss.
bwlang_ has joined #ruby
tatsuya_o has joined #ruby
andrewhl has joined #ruby
badelat has joined #ruby
jaywastaken has joined #ruby
ada2358 has joined #ruby
tatsuya_o has joined #ruby
yekta has joined #ruby
daglees has joined #ruby
fridim_ has joined #ruby
TomJ has joined #ruby
TomJ has joined #ruby
Squarepy has joined #ruby
Squarepy has joined #ruby
xastion has joined #ruby
esmaxwill has joined #ruby
sdwrage has joined #ruby
xastion has joined #ruby
tbrock has joined #ruby
banseljaj has joined #ruby
banseljaj has joined #ruby
ubercore has joined #ruby
scelis has quit ["Leaving..."]
PragCypher has joined #ruby
sythe has joined #ruby
nerdy has joined #ruby
sythe has joined #ruby
xastion has joined #ruby
ChampS666 has joined #ruby
jergason has joined #ruby
waazzuup has joined #ruby
hippyphysicist has joined #ruby
ph^ has joined #ruby
cableray has joined #ruby
zykes-_ has joined #ruby
savage- has joined #ruby
JanL has joined #ruby
dasfugufish has joined #ruby
cloke_ has joined #ruby
<luckyruby> god damn edifact
<luckyruby> somedays i really hate working in the travel industry
fayimora has joined #ruby
stephenjudkins has joined #ruby
dibri has joined #ruby
burgestrand has joined #ruby
ixti has joined #ruby
azureye has joined #ruby
sawjig has joined #ruby
yoklov has joined #ruby
tktiddle has joined #ruby
<shevy> luckyruby poor you
pingfloyd has joined #ruby
banisterfiend has joined #ruby
<yoklov> blarg. module_function never works the way i think it will
statarb3 has joined #ruby
statarb3 has joined #ruby
<shevy> hehe
hmans has joined #ruby
fr0gprince_mac has joined #ruby
<yoklov> is there a diference between SomeModule::a_method and SomeModule.a_method ?
Dreamer3 has joined #ruby
lewix has joined #ruby
hippyphysicist has joined #ruby
* yoklov gives up and just defines everything with self.whatever
badabim_ has joined #ruby
fr0gprince_mac has joined #ruby
<fr0gprince_mac> fuck ik wil military time
<fr0gprince_mac> oops disregard that
alex__c2022 has joined #ruby
randym has joined #ruby
<frontendloader> yoklov: I think the double colon is used when referring to a class
<yoklov> hm.
<yoklov> they both seem to work with both?
<yoklov> or do you mean by convention
punkrawkR has joined #ruby
<mikepack> Who knows what object oriented programming is?
colint has joined #ruby
Axsuul has joined #ruby
ctp_ has joined #ruby
Axsuul has joined #ruby
ctp- has joined #ruby
Axsuul has joined #ruby
_obiJuan has joined #ruby
ctp has joined #ruby
<yoklov> frontendloader, interesting, that helps. thanks
<yoklov> mikepack: probably most of the people here to various extents. what's your question?
<mikepack> yoklov: My question is: What is OOP :) (I'm trying to gather opinions/takes)
lorandi has joined #ruby
yfeldblum has joined #ruby
<mikepack> yoklov: It's quite generic, but I'm trying to draw out discrepancies be common practice and Alan Kay's vision of OOP
<yoklov> i'd say that it's a programming technique/paradigm where the execution of your program is some sort of model.
<banisterfiend> mikepack: so thta you can be condescending and start pontificating when people get it wrong? :)
<yoklov> or models some sort of situation.
<yoklov> something like that.
<mikepack> banisterfiend: haha, like you just did?
S1kx has joined #ruby
schlecht has joined #ruby
<mikepack> banisterfiend: If you must know, the opposite. I'm trying to figure out how we can produce better code through OOP
hippyphysicist1 has joined #ruby
QaDeS has joined #ruby
<frontendloader> at the most basic level, to me, OOP is the blissful marriage of data structures with functions
<schlecht> Oh dear.
<mikepack> ie. Is an object supposed to contain all the functions it can ever perform?
Illiux has joined #ruby
<frontendloader> that's up to the compiler/interpreter
<mikepack> frontendloader: Good explanation. How are the data structures/functions supposed to be joined?
<mikepack> frontendloader: I guess a typical answer would be "at class definition"
<mikepack> I'm wondering if anyone ever joins structure with function outside of class definition.
<frontendloader> functions are aware of the instance which they're a member of, selfness
<yoklov> mikepack, are you familiar with paradigms other than oo?
<mikepack> yoklov: Sure, which ones specifically?
<yoklov> functional programming is very much about joining data structures with functions in a manner which has no classes whatsoever.
<frontendloader> if oop is marriage, functional programming is the consummation
<yoklov> lol
h4mz1d has joined #ruby
<mikepack> yoklov: Data structure are very basic in functional programming, no?
<yoklov> what do you mean by that
<mikepack> yoklov: I mean to say that if you refer to a particular data structure, it doesn't also contain actions it can perform.
<yoklov> you don't organize your code that way.
chimkan has joined #ruby
<yoklov> your data structures don't perform actions on itself.
<yoklov> *themselves
<yoklov> you write functions which perform actions on them.
<mikepack> yoklov: You pass data structures to atomic functions which manipulate your data
vraa has joined #ruby
<mikepack> yoklov: Yeah, that's my understanding
<yoklov> it depends what you mean by atomic?
<yoklov> often your fucntions will just be compositions of other functions.
<yoklov> the largest difference between FP and OO is that with OO you think in terms of interacting objects, and with FP you think of it in terms of the flow of your data.
<mikepack> yoklov: What manages state in functional languages?
<yoklov> you pass the state to the next function.
<mikepack> yoklov: Your state is represented as basic data structures? A hash for instance.
<schlecht> yoklov: Enjoying your book?
<yoklov> mikepack: in a functional language if you have { :foo => :bar }, and you set :foo to be something else, the actual value of the object never changes, but instead you get a new hash which contains the new value.
<yoklov> schlecht, yeah, it's pretty awesome. needed a good reference for ruby.
<schlecht> yoklov: Cool
<mikepack> yoklov: Is that a strict requirement? That the object can't be manipulated.
<yoklov> it depends on the language.
<yoklov> in "pure" functional programming, yes.
kmurph79 has joined #ruby
<yoklov> in something like scheme, or lisp (whcih I'm more familiar with), no
<mikepack> yoklov: When you say functional programming is about joining data structure with functions, what do you mean? Data is just passed to functions which return data.
<schlecht> yoklov: You're familiar with java!
colint has joined #ruby
<yoklov> mikepack: I mean that the functions which manipulates the data structure will likely be in the same file as the code which defines the data structure?
<yoklov> FP is very much about thinking about your code in terms of its data structures
Gekz has joined #ruby
<yoklov> schlecht, lol, I was quite offended when whoever said that said that. I've written much more lisp than java :p
<schlecht> It's very much about thinking about your code in terms of space, where procedural thinks in terms of time. I'd say.
<schlecht> yoklov: I said that. We spoke at length in query about how I hadn't showered in weeks.
denom has joined #ruby
<yoklov> oh that was you, haha
<yoklov> it was extremely late
<schlecht> I was extremely baked.
stephenjudkins has joined #ruby
<yoklov> i could sorta tell
<yoklov> i might have been sorta high? i don't know. i don't remember.
<schlecht> )
supergiantrobot_ has joined #ruby
<yoklov> Anyway, mikepack: if you think the fact that data structures don't include functions in FP somehow less makes it less of a joining of functions and data structures, I recommend you go write some functional code.
Sivart has joined #ruby
thecreators_ has joined #ruby
<yoklov> (and in fact, a lot of times you will have a function in your data structure, however it will be part of the data, and not part of the function which manipulates the data)
<mikepack> yoklov: I've written a little functional programming, mostly trivial stuff.
<yoklov> write a larger program
<mikepack> That makes no sense
<mikepack> "I've written a little functional programming"...
<mikepack> Anyway, I guess I'm intrigued by concepts which simplify the idea of objects in OO languages
<yoklov> have you written much javascript?
<mikepack> As opposed to objects which contain everything they could ever perform
<mikepack> Yeah, a ton of JS
<yoklov> i mean function prototypes are certainly a simlification of objects/classes.
<Asher> how do you figure?
<mikepack> Are you alluding to the idea that objects in JS are simple to create literally?
<yoklov> not at all
<yoklov> i'm talking about implementing the object systems
<yoklov> function prototype is, for all intents and purposes, a hashtable of functions and values.
<mikepack> objects in JS can grow quite monolithic
<yoklov> every language has bad code written in it.
<yoklov> classes and objects have complicated semantics (access, overriding, etc). classical inheritance is much more difficult to implement than prototypal inheritance
<mikepack> Interesting, why do you say that? They're both just modifying the lookup table.
alx- has joined #ruby
<Asher> this sounds to me like a bunch of talk
<mikepack> That's all it is :)
<Asher> they're two different models not sure why one is easier/harder than the other
* yoklov isn't talking about in terms of use
<schlecht> Asher: What were you doing before ruby?
<Asher> i do a bunch of C/Obj C in addition to ruby
<schlecht> Was that before ruby?
<Asher> before ruby would be i guess C, Obj C, Javascript, PHP
<Asher> but i've been doign ruby a while now
snip_it has quit [#ruby]
c0rn has joined #ruby
Spockz has joined #ruby
<mikepack> yoklov: I think that statement needs a context. In JS it's much easier to do prototypal inheritance than it is classical.
<mikepack> In ruby I would say it's the opposite, or at least less obvious
<mikepack> my_object.extend SomeModule might be considered prototypal inheritance
bwlang has joined #ruby
<mikepack> yoklov: thanks for entertaining my questions :) I'm just shootin the shit
<yoklov> a while ago i extended a toy scheme to support prototype based inheritance which was fairly easy (add a object primitive, add functions for get, set, delete, etc. make it have a prototype). whenever i've tried to implement a classical object system, the only way i've been able to think about doing it was basically "do a prototype based one and nerf it"
TheTFEF has joined #ruby
Indian has joined #ruby
<yoklov> and maybe that's how its done.
<yoklov> idk, classical inhertiance just has a lot of complicated semantics not present in prototypes
<yoklov> which is why i say the prototype one is simpler.
<Asher> i don't see why one is ahrder than the other
<Asher> they're both just ways of structurig the lookup chain
wyhaines has joined #ruby
<mikepack> Maybe because classical systems need support of the compiler/interpreter
<yoklov> well i was writing the interpreter
<Asher> as opposed to?
<mikepack> What i mean to say is that you can't build a true classical system without the compiler/interpreter
<yoklov> Asher: classes tend to have access modifiers, for one thing
<mikepack> You can build a makeshift classical system through protypes
<mikepack> prototypes*
<mikepack> JS is a prime example
<mikepack> All classical implementations in JS use prototypes to mimic the lookup table
<yoklov> Asher, you don't think that prototypes are a more basic system than prototypes?
<Asher> to me prototypical or classical inheritance are both just ways of structuring the lookup chain