Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
<drbrain> simon_d: that installs the gems from 1.8 cache dir into 1.9
<simon_d> ahhh nice. Right I'm going to give it a good. I'll make sure I back up cos I'm expecting to break half the stuff I've been installing the last week or so!!
<simon_d> ^ give it a go
<whitequark> manveru: what's wrong with bundler?
<whitequark> it's awesome imo
<bougyman> it's bundler
<bougyman> nuff said
darkf has joined #ruby-lang
<Harzilein> btw, is it possible to do "real" rasterbars with opengls? probably with shaders?
<Harzilein> opengl*
mark_locklear has joined #ruby-lang
vesan has joined #ruby-lang
S1kx has joined #ruby-lang
<lianj> Harzilein: you can do most of the old demo effects using fragment shaders
<Harzilein> what i want is render some white text on black background and xor r, g and b rasterbars over it, so when they meet there is a white rasterbar and black text, or if red and blue meet, there is a purple rasterbar and green text
<mrb_bk> burgestrand: still around?
jobicoppola has joined #ruby-lang
srbartlett has joined #ruby-lang
Oloryn_lt1 has joined #ruby-lang
<erikh> hey all; what's the new hotness regarding coverage tools? still simplecov?
<andrewvos> Coverage is for little girls
<seanstickle> Don't forget to use Hexawise
<erikh> heh
<erikh> also, I just broke reek I think
<erikh> drbrain: rdoc -C is pretty awesome, thanks for writing it
Natch| has joined #ruby-lang
ReinH has joined #ruby-lang
S2kx has joined #ruby-lang
vesan has joined #ruby-lang
Karmaon has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
artOfWar has joined #ruby-lang
replore has joined #ruby-lang
havenn has joined #ruby-lang
tomzx has joined #ruby-lang
havenn has joined #ruby-lang
fayimora has joined #ruby-lang
MistyM has joined #ruby-lang
niklasb has joined #ruby-lang
slyphon has joined #ruby-lang
slyphon has joined #ruby-lang
<erikh> oh yeah
<erikh> Total: 52 (0 undocumented)
<erikh> 100.00% documented
<injekt> \o/
havenn has joined #ruby-lang
<andrewvos> Boohbah: TDD
<whitequark> Boohbah: at line 35 you probably meant .map { ... }.join, not .each
<whitequark> and you can use str << s instead of str << "#{s}"
<whitequark> and please, please, please use &&, || and ! instead of the words.
<andrewvos> That's my answer and I'm sticking with it
<Boohbah> thanks all :)
<andrewvos> Anyway night everyone, thanks for helping me today whitequark appreciate it
<andrewvos> .
<whitequark> you're welcome
<Boohbah> s << @cards.map { |card| card.name }.join
tla has joined #ruby-lang
<Boohbah> whitequark: is there any way to eliminate the s variable in my Deck.to_s method?
wilo has quit [#ruby-lang]
<whitequark> just append #{@cards.map ...} after #{cards.first.class}: <here>"
skipper has joined #ruby-lang
<Boohbah> ahh i see, thanks
artOfWar has joined #ruby-lang
h4y4shi has joined #ruby-lang
<h4y4shi> bnagy: Hey want to see my new rpg version 8?
looopy has joined #ruby-lang
srbartle_ has joined #ruby-lang
<Boohbah> whitequark: i like each better than map :)
gix has joined #ruby-lang
<mrb_bk> If anyone wants to comment, I wrote my first ruby C extension: https://github.com/mrb/hash-ring/commit/85d673f723fb803596a78c595b2368437098a725
<mrb_bk> wrapping it up as a gem now
neoesque has joined #ruby-lang
takaokouji has joined #ruby-lang
<Asher> what's the best way to have a gem's bin in the path?
<Asher> like i have two CLI utilities in bin/ to use the gem
<Asher> how should i have it auto-setup when the gem is instlaled?
<whitequark> Boohbah: each and map are doing different things
rpowell has joined #ruby-lang
h4y4shi_ has joined #ruby-lang
<whitequark> each returns the original Enumerable
<whitequark> map returns the array of things which the block returned
<whitequark> compare
<whitequark> %w{a b c d}.each { |s| s.upcase }
<whitequark> %w{a b c d}.map { |s| s.upcase }
dreinull has joined #ruby-lang
<josh9> I benchmark agent.get(url) multiple times with mechanize and get about 1.5 seconds on each one. isn't mechanize suppose to persist the connection and therfore be slow only at the first run?
yadav has joined #ruby-lang
wyhaines has joined #ruby-lang
<josh9> # => "1.392266259"
<Boohbah> i like my Cards with no quotes around them
rpowell has joined #ruby-lang
flip_digits has joined #ruby-lang
<josh9> http://pastebin.com/aD9maHpM - can someone explain those benchmarks? it looks like my connection is not persisted.
znz_jp has joined #ruby-lang
Andrevan has joined #ruby-lang
rivaler has joined #ruby-lang
MistyM has joined #ruby-lang
havenn has joined #ruby-lang
dv310p3r has joined #ruby-lang
fozze has joined #ruby-lang
fayimora has joined #ruby-lang
huxley_sparks has joined #ruby-lang
nebbie`` has joined #ruby-lang
muzone_ has joined #ruby-lang
cyndis_ has joined #ruby-lang
publicvoid_ has joined #ruby-lang
sj26 has joined #ruby-lang
dRbiG has joined #ruby-lang
sinuc has joined #ruby-lang
sinuc has joined #ruby-lang
lucas has joined #ruby-lang
jmeeuwen has joined #ruby-lang
tdubz has joined #ruby-lang
DefV has joined #ruby-lang
shyouhei has joined #ruby-lang
Tick-Tock has joined #ruby-lang
dabradley has joined #ruby-lang
Aengus has joined #ruby-lang
duckinator has joined #ruby-lang
srbaker has joined #ruby-lang
zoo-zed has joined #ruby-lang
anthony has joined #ruby-lang
rivaler has joined #ruby-lang
imperator has joined #ruby-lang
andkerosine has joined #ruby-lang
<andkerosine> Alive?
jacktrick has joined #ruby-lang
<jacktrick> ~sNo4oKEr3*
t4nk363 has joined #ruby-lang
t4nk363 has quit [#ruby-lang]
havenn has joined #ruby-lang
savage- has joined #ruby-lang
capcook has joined #ruby-lang
gokul has joined #ruby-lang
flip_digits has joined #ruby-lang
andkerosine has quit [#ruby-lang]
flip_digits has joined #ruby-lang
rpowell has joined #ruby-lang
flip_digits has joined #ruby-lang
znz_jp has joined #ruby-lang
flip_digits has joined #ruby-lang
capn_kryptonite has joined #ruby-lang
flip_digits has joined #ruby-lang
rippa has joined #ruby-lang
flip_digits has joined #ruby-lang
gianlucadv has joined #ruby-lang
<josh9> how to monitor open http connections that opened by my ruby script?
<josh9> i am trying to figure out the reason for slowliness of agent.get (mechanize) and according to some devs here mechanize using a persistant connection and therefor should be faster after the first time being used. this is not what i experience in my code.
RomyRomy has joined #ruby-lang
<postmodern> josh9, you could try using wireshark to watch network activity
RomyRomy has joined #ruby-lang
<postmodern> josh9, also the persistent connections will only make the requests quicker, but if the server is overloaded or your connection is slow it wont help
<drbrain> josh9: a) turn on logging in mechanize
<drbrain> b) (not recommended) turn on raw logging in net/http/persistent
<postmodern> josh9, also it could be your DNS server is slow at resolving the hostname to an IP
<josh9> postmodern: drbrain ok. i'll start with logging of mechanize. thanks
<drbrain> josh9: the first connection is going to be the same speed as open-uri
<josh9> if anyone got mechanize installed and would like to try my benchmarks - http://pastebin.com/aD9maHpM
<drbrain> the second connection will be much faster
<josh9> drbrain: look at my script. i got almost 1 second for each agent.get i use.. it's so slow!
bojicas has joined #ruby-lang
<drbrain> josh9: that's because walmart.com is slow
<drbrain> in Safari I'm seeing up to 1.5s for those pages
<drbrain> just for the HTML to show up
<drbrain> josh9: try multiple threads and a Queue
Tref has joined #ruby-lang
<josh9> drbrain: yeh! first time using threads in ruby
<josh9> drbrain: so we were wrong about the persistent connection of mechanize?
Sailias has joined #ruby-lang
mdel has joined #ruby-lang
MistyM has joined #ruby-lang
kp666 has joined #ruby-lang
ei-dale has joined #ruby-lang
ei-dale has quit [#ruby-lang]
<drbrain> josh9: note that the second and third requests are faster than the first
<drbrain> this is the advantage of the persistent connection
<postmodern> drbrain, question about mechanize, do you have plans to support executing javascript in a JS VM?
<drbrain> postmodern: personally, I don't
sideshownz has joined #ruby-lang
<postmodern> drbrain, something like capybara's JS integration
<drbrain> postmodern: I would like to see the feature as part of mechanize, but I don't have the time or interest in implementing the DOM in ruby
<drbrain> tenderlove already burnt himself out doing that
<postmodern> drbrain, yeah i remember that Taka project
<drbrain> it's a big task and it needs a motivated maintainer
<drbrain> mechanize is very mature already, so it's much easier to maintain
priteshjain has joined #ruby-lang
kp666 has joined #ruby-lang
<josh9> drbrain: so my best option is to parallelize my scraping script?
<josh9> drbrain: using threads?
<drbrain> josh9: yes
postmodern has joined #ruby-lang
<drbrain> josh9: since walmart.com takes ~1s per page no matter the user-agent
<drbrain> josh9: you can probably use a pipeline
<josh9> drbrain: what user agent should i use with mechanize?
<drbrain> 1 thread feeding a URL queue
<josh9> drbrain: what's pipline?
<drbrain> N threads reading from the URL queue and fetching pages then writing the page to a pages queue
<drbrain> then 1 thread reading from the pages queue and searching for things
<drbrain> josh9: whichever works
<josh9> drbrain: i didn't define anything
<drbrain> josh9: if the default UA fails to work you can use 'Mac Safari'
<drbrain> josh9: if you didn't define anything you get the mechanize UA
<drbrain> wikipedia.org doesn't allow the mechanize UA, so you have to set it to 'Mac Safari'
<drbrain> if you get pages back I wouldn't bother changing it
nuclears1ndwich has joined #ruby-lang
andkerosine has joined #ruby-lang
<andkerosine> I'm taking a JSON object and converting it to an OpenStruct for easier access.
<josh9> drbrain: great. also, thaks for mentioning the pipeline. looking into this pattern.
<andkerosine> Is it possible to add an actual method to it after the fact, or do I have to rethink my approach?
erpuds has joined #ruby-lang
<drbrain> andkerosine: you can add methods at any time
Axsuul has joined #ruby-lang
<andkerosine> drbrain: Mind taking a look?
<andkerosine> That's a method of my Subreddit class, but it only returns the data about each of the posts in a given sub. Am I going about it wrong?
<drbrain> andkerosine: #@name bleeeeeh
<andkerosine> Whyzat?
<drbrain> use #{@name}, it'll save someone's sanity
<andkerosine> Duly noted.
<drbrain> most people don't know you can do that, and that's a good thing
<andkerosine> Mm-hmm.
<freedrul1> woah you can do that
<freedrul1> ?
<drbrain> andkerosine: this seems fine, I'm unsure of your problem
<andkerosine> Well, for instance...
<drbrain> freedrul1: yes ☹
<andkerosine> Right now, you can do Client.r('programming').submissions[0].body
<andkerosine> But I'd like to be able to replace .body with .comments
<andkerosine> Once it's converted to an OpenStruct, there doesn't seem to be a way to add to it.
<drbrain> andkerosine: I see
<andkerosine> At least, not without it being interpreted as a value rather than a method.
<drbrain> I would follow a more activerecord-like pattern instead of what you have, then
nuclearsandwich has joined #ruby-lang
<andkerosine> Alas, I'm unfamiliar with what that might constitute.
<drbrain> instead of creating an OpenStruct, create a Submission object from s['data']
<drbrain> the Submission object can know how to fetch comments (I'm assuming that's a separate request)
<andkerosine> Mm-hmm.
<drbrain> also, OpenStruct is not very suitable for Serious Business
<drbrain> it is very, very memory heavy since it creates methods per-instance, not per-class like a Struct
<drbrain> for throw-away scripts it's very convenient, though
<andkerosine> Well, there'll be a lot of chaining on the user's end. I'd like for them to be ably to do .x.y.z instead of ['x']['y']['z'].
<andkerosine> *able
<drbrain> yeah, but since the domain shouldn't change much, making Real Objects shouldn't be too much work
<andkerosine> Via method_missing?
<drbrain> you can do it with a Struct and Hash#values_at
<andkerosine> Will do, but I'm still having trouble seeing where a new method goes in. Just... reopen the Struct-created class?
<drbrain> yes
<andkerosine> Excellent. : )
<andkerosine> Thank you.
rpowell has joined #ruby-lang
<drbrain> you can also S = Struct.new :a, :b do def foo() end; end
h4y4shi_ has joined #ruby-lang
<andkerosine> Recommended?
Tref has joined #ruby-lang
<andkerosine> Along the same lines as bracket-lass interpolation, I mean.
<drbrain> it's a matter of preference
<andkerosine> *less
<drbrain> I think either is fine
<drbrain> you can also class S < Struct.new(:a, :b) … end
<drbrain> just so you have options :D
<drbrain> I often use this last one ^^
<andkerosine> Ruby is beautiful.
<drbrain> even though it leaves an anonymous class floating around
<Tref> guys, I'm playing around in a rails console and trying to get comfortable with inspecting objects and such. When I set @request_struct with an initializer then call the instance from the console I see something like: "#<MLSRETS::Client:0x007fd2314ca0f8 @request_struct=#<MLSRETS::Client::Requester:0x007fd2314ca058>"
<Tref> my question is what is that @request_struct
<theconartist> did you just drop a triple-dot
<Tref> it looks like an instance variable but i can't access it with client.request_struct
<drbrain> Tref: probably something internal to the MLSRETS library
<drbrain> theconartist: an elipsis?
<drbrain> yes‼
<andkerosine> It's a very useful syntactic construct.
<Tref> drbrain: what does that @ stand for there?
<drbrain> Tref: instance variable inside MLSRETS::Client
<Tref> right so how do i access it now?
<andkerosine> You can't access it because it's either private or protected.
<andkerosine> Only that instance of MLSRETS::Client can touch it.
<Tref> but client.request_struct returns undefined method `request_struct'
<Tref> shouldn't i be able to access it through the instance I just created
<andkerosine> Private and protected methods.
<Tref> its neither private nor protected
<drbrain> Tref: instance variables only have accessor methods when the class author explicitly creates them
<drbrain> Tref: you're just peeking under the covers
<Tref> so if i create an attr_accessor for it I can take a look at it then?
<Tref> drbrain: ok so you were right I needed an accessor for that
<Tref> now that I can access that object inside there, how do I take a look at it's state?
RomyRomy has joined #ruby-lang
JohnBat26 has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
nemesit has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
savage- has joined #ruby-lang
frangiz has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
<drbrain> Tref: pull up the source so you know what the things in instance_variables do
<Tref> ok
<burgestrand> mrb_bk: now I am ^^
<Tref> isn't there a way to use inspect or something along those lines/
<erikh> Object#instance_variable_get
<Tref> inspect on that just returns a string
<Tref> ah..
<erikh> be careful with that one
<erikh> THAR BE DRAGONS
<Tref> its cool I'm wearing a helmet
<erikh> hockey or viking?
<erikh> the best thing is that neither of those choices really say you're doing something smart
<drbrain> I have my dragon-slaying dagger, it's +8 against dragons!
<erikh> Tref: one other thing that may or may not matter -- in 1.8 instance_variable_get expects a string as input, in 1.9 it expects a symbol
<erikh> e.g., foo.instance_variable_get("@bar") is 1.8, foo.instance_variable_get(:@bar) is 1.9
<erikh> there, lecture over. have fun
<Tref> neither, hocker nor viking. beer
<erikh> oh ye olde crazy helmet
<erikh> good man
<Tref> which is +9 against fat chicks
<Tref> lol
<erikh> hahah
<erikh> more like -9.
<Tref> that's my rib count once they roll off me
<Tref> hahaha
<erikh> lord. what have I done.
<Tref> lol
<Tref> anyway, I'll give that a shot - I'm -somewhat- new to ruby so I'm still getting these basics down
<erikh> well just remember you're looking up someone's skirt and there are consequences to your actions
<Tref> I'm using 1.9
<andkerosine> What's your take on an RPG that revolves around encountering and fighting other players if you're both on the same page of the Internet?
<erikh> heh, like highlander!
<erikh> I like it.
<andkerosine> ...?
<erikh> haven't you seen the movie 'highlander'?
<andkerosine> Only familiar in name. : /
<erikh> where's your nerd badge? I think it needs recycling.
<andkerosine> I recall there being a cage fight?
<erikh> that's mad max: beyond thunderdome - you can hand it over now.
<andkerosine> I am become shame.
<andkerosine> Is Highlander the source of "Inconceivable!"?
<andkerosine> *hands badge*
<drbrain> andkerosine: no, that's Princess Bride
<andkerosine> So it would seem.
<drbrain> andkerosine: have you not seen Beyond Thunderdome?
<drbrain> It's got Tina Turner!
<andkerosine> Bits and pieces.
<drbrain> you can't go wrong with Tina Turner‼
<drbrain> she's 72 and can crush you with one magnificent leg!
<andkerosine> I will grant her magnificent legs and hair.
<whitequark> drbrain: "‼". I see what you did there
<drbrain> What did I do‽
<whitequark> ¡‽¿!
Karmaon has joined #ruby-lang
<andkerosine> Skeuomorph.
<whitequark> andkerosine: oh. did you happen to read the discussion on skeuomorphs here?
<andkerosine> I could always check your logs...
<whitequark> my logs?
<andkerosine> I only recall going to bed upset that we hadn't yet gotten the answer.
yxhuvud has joined #ruby-lang
<whitequark> well, I recall telling someone the answer
<whitequark> that might be you
<andkerosine> You don't own whitequark.org?
<whitequark> I do
<andkerosine> Thus... your logs.
<whitequark> I'm just a bit surprised that someone else knows about irclogs.wq.org
<andkerosine> I Google myself more than is healthy.
<whitequark> ah.
<whitequark> the logs unfortunately omit a few days
<drbrain> the URL has floated around a few times in here too
<whitequark> due to flaky IPv6 at this host
<andkerosine> Odd that that would have an effect?
<whitequark> and I think the whole skeuomorph discussion is gone too :/
<whitequark> well
<whitequark> I think it forced my logger to reconnect a lot
<whitequark> and it got out of nicks
<andkerosine> Mm.
pcboy_ has joined #ruby-lang
<whitequark> I don't really know what has happened these times. the logs of logger I had weren't really helpful
<whitequark> but I know that IPv6 here is a bit flaky
<whitequark> and that the logger reconnects quite frequently
<whitequark> anyway, I think I've fixed it by just making it more robust.
levifig has joined #ruby-lang
<whitequark> I hope I did.
<andkerosine> "Robust" here meaning faster revival?
<whitequark> "robust" means reconnecting on IRC error packet receiving and waiting 60s before reconnect attempt
<whitequark> instead of doing it immediately
<whitequark> so that old connections (and hence nicks) could expire
<andkerosine> Makes sense.
<whitequark> I'll see how it will go. If the error pattern would remain the same, it should die today or tomorrow
<andkerosine> Tail your logs?
<whitequark> huh?
<whitequark> how that'll help?
<andkerosine> Ah, I suppose your use of the term "logger" threw me.
<andkerosine> You said that your logs weren't helpful; I assumed that was because they were missing data?
<whitequark> ah.
<whitequark> look
<whitequark> there are two kinds of logs
<whitequark> IRC logs, and the logger bot logs, with the debug info
<whitequark> I was talking about the latter
<andkerosine> Yep, that was my assumption. But... how does data go missing from there?
<whitequark> I'm just using a ready-made gem
<erikh> cinch?
<whitequark> and I did not have enough probe points to determine the cause
<whitequark> nope
<whitequark> net-yail
<erikh> oh, heh.
<whitequark> erikh: cinch is for bots. too complicated for me, really
<whitequark> I've looked at it
<erikh> here's some fun trivia
<andkerosine> Inapt name.
<erikh> net-yail's author and ruby-irc's author used to work together
<erikh> and I used to work at the same company at one point.
<whitequark> heh
<whitequark> anyway, gotta go
<whitequark> bbl
<erikh> later.
<andkerosine> Module variables strike me as generally a bad idea, but I think they make sense here.
<andkerosine> I need them to be accessible from all derivative classes, but globals are for pussies.
daglees has joined #ruby-lang
<andkerosine> How does one go about having a module variable accessible as a Hash?
<erikh> like being able to query the symbol table of variables of the module?
<andkerosine> No, disregard. That was moronic.
<andkerosine> Used a string in one place and a symbol in another.
Sailias has joined #ruby-lang
<andkerosine> Curse you and your conveniences, 1.9
<erikh> anyone know the latest coverage tool hotness?
<burgestrand> erikh: simplecov or coverme, both are kind of meh imo
<erikh> yeah, I'm not looking for perfection, just an idea of what I still need to test
<erikh> I'll give simplecov a shot
rpowell has joined #ruby-lang
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
senthil has joined #ruby-lang
<andkerosine> Is require anywhere but the top frowned upon?
<senthil> Is there a xit eqiuvalent for context?
<senthil> *equivalent
srbaker has joined #ruby-lang
<erikh> andkerosine: no, but the use cases for otherwise are much rarer
<andkerosine> I've run into what seems to be a need for it.
<senthil> andkerosine: now that autoload is deprecated (or will be), i'll probably use it more in methods to avoid loading everything
<senthil> andkerosine: i googled to see if there's an alternative, all i got was easyload gem
gokul has joined #ruby-lang
<andkerosine> Why is it being deprecated?
<erikh> it's not threadsafe, so matz said "f it"
dc5ala has joined #ruby-lang
<andkerosine> Mm-hmm.
<andkerosine> No worries, Ruby 3 comes out next decade.
<jaska> right after perl6:D
<andkerosine> If a module's classes rely on self methods of the module, isn't the only option to require them after the module has been declared?
Jarred has quit [#ruby-lang]
Heimidal has joined #ruby-lang
ramonmaruko has joined #ruby-lang
brownies has joined #ruby-lang
tla has joined #ruby-lang
tbuehlmann has joined #ruby-lang
flak has joined #ruby-lang
<senthil> this is odd, are attr* not available in subclasses?
<senthil> i mean if i've attr_writer :data in base class, shouldn't data= method be available in subclasses?
gokul has joined #ruby-lang
<rippa> senthil: works for me
<senthil> rippa: odd, me too now
<senthil> rippa: must've been some other error, thanks
Carnage\ has joined #ruby-lang
zmack has joined #ruby-lang
nemesit has joined #ruby-lang
<erikh> drbrain: (while true; do rake || break; done) # heisenbug tracker!
<drbrain> erikh: hehe
<erikh> been running for about 10 minutes now, I think I found it
<erikh> I guess I should just use autotest
<drbrain> you should tweet that ^^
<drbrain> anyhow, bed time for me
<erikh> I did
<erikh> good night!
<drbrain> converting rake tasks to testable chunks can be a bitch
<drbrain> huh, twitter unfollowed you for me
<drbrain> THANKS TWITTER‼ ☹
<erikh> nah, I killed my account a long time ago
<erikh> and then restarted it
<erikh> long story -- I was having a day
solars has joined #ruby-lang
<shevy> lol
<shevy> sounds like a Texas Cheeseburger massacre day
andkerosine has quit [#ruby-lang]
roadkith has joined #ruby-lang
qpingu has joined #ruby-lang
cyri_ has joined #ruby-lang
fritzek has joined #ruby-lang
<erikh> what can I say -- I'm an unapologetic, moody bastard
Asher has joined #ruby-lang
charper has joined #ruby-lang
<yorickpeterse> Morning
Wardrop has joined #ruby-lang
<andrewvos> drbrain: Why would you test rake tasks?
<chendo_> andrewvos, why wouldn't you test rake tasks?
<chendo_> if you had rake tasks performing actions that affect a production database
<chendo_> you'll want to test them
csherin has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
JohnBat26 has joined #ruby-lang
gnufied has joined #ruby-lang
ioga_wrk has joined #ruby-lang
gianlucadv has joined #ruby-lang
NARKOZ has joined #ruby-lang
tekin has joined #ruby-lang
senthil has joined #ruby-lang
<roadkith> you guys think a gui sftp client would be a nice introductory project to get into gui programming?
takaokouji has joined #ruby-lang
<masterkorp> i dont like guys
molgrew has joined #ruby-lang
csherin has joined #ruby-lang
ramonmaruko has joined #ruby-lang
burgestrand has joined #ruby-lang
<ddfreyne> chendo_: agreed
<ddfreyne> chendo_: I don't test the tasks themselves, but my tasks invoke code that's tested (and often the rake task is only a tiny wrapper)
<chendo_> yeah
<chendo_> just move it into a model
roha has joined #ruby-lang
srbartlett has joined #ruby-lang
shevy has joined #ruby-lang
gregmoreno has joined #ruby-lang
SubSpawn has joined #ruby-lang
priteshjain has joined #ruby-lang
ReinH has joined #ruby-lang
gentz has joined #ruby-lang
abuiles has joined #ruby-lang
dkannan has joined #ruby-lang
bryno has joined #ruby-lang
turboladen has joined #ruby-lang
listrophy has joined #ruby-lang
nick_h has joined #ruby-lang
hugsy_ has joined #ruby-lang
jMCg has joined #ruby-lang
flori has joined #ruby-lang
mitchty has joined #ruby-lang
logankoe1ter has joined #ruby-lang
andman_ has joined #ruby-lang
manveru has joined #ruby-lang
jmcphers has joined #ruby-lang
ammar has joined #ruby-lang
tpope_ has joined #ruby-lang
hackeron has joined #ruby-lang
spuk has joined #ruby-lang
threedaymonk has joined #ruby-lang
LanceHaig has joined #ruby-lang
Xzyx987X_ has joined #ruby-lang
vbatts has joined #ruby-lang
yorickpeterse has joined #ruby-lang
stepnem has joined #ruby-lang
fireglow has joined #ruby-lang
tasiu has joined #ruby-lang
ChloeD has joined #ruby-lang
t0h has joined #ruby-lang
Caius has joined #ruby-lang
fvollero has joined #ruby-lang
kalleth has joined #ruby-lang
gentz has joined #ruby-lang
zmack has joined #ruby-lang
tbuehlmann has joined #ruby-lang
rivaler has joined #ruby-lang
neoesque has joined #ruby-lang
gix has joined #ruby-lang
amerine has joined #ruby-lang
sora_h has joined #ruby-lang
FiXato has joined #ruby-lang
Y_Ichiro has joined #ruby-lang
imajes has joined #ruby-lang
queequeg1_ has joined #ruby-lang
hagabaka has joined #ruby-lang
timbleck has joined #ruby-lang
Arsen7 has joined #ruby-lang
werwolf has joined #ruby-lang
robgough has joined #ruby-lang
schroedinbug2 has joined #ruby-lang
babinho has joined #ruby-lang
valeri_ufo has joined #ruby-lang
seich_ has joined #ruby-lang
ruskie has joined #ruby-lang
matled has joined #ruby-lang
RegEchse has joined #ruby-lang
darix has joined #ruby-lang
Foxmaste1 has joined #ruby-lang
znz_v has joined #ruby-lang
jasiek has joined #ruby-lang
nwonknu has joined #ruby-lang
Muz has joined #ruby-lang
fatprog has joined #ruby-lang
erikh has joined #ruby-lang
felipe has joined #ruby-lang
KillerFox has joined #ruby-lang
robotmay has joined #ruby-lang
fayimora has joined #ruby-lang
mitchty has joined #ruby-lang
kain_ has joined #ruby-lang
Bwild has joined #ruby-lang
daglees has joined #ruby-lang
fayimora has joined #ruby-lang
andkerosine has joined #ruby-lang
<andkerosine> %s[something or other] isn't meant to work like %w, right?
<andkerosine> Just a convenience for converting a string to a single symbol?
<rippa> yes
<rippa> like :"herp derp"
<andkerosine> I think to_sym was just fine.
jasiek has joined #ruby-lang
<andkerosine> It'd be nice to be able to quickly create an array of symbols like you can with strings.
priteshjain has joined #ruby-lang
<rippa> andkerosine: %w[herp derp].map(&:intern)
zmack has joined #ruby-lang
tbuehlmann has joined #ruby-lang
rivaler has joined #ruby-lang
gix has joined #ruby-lang
amerine has joined #ruby-lang
sora_h has joined #ruby-lang
FiXato has joined #ruby-lang
Y_Ichiro has joined #ruby-lang
imajes has joined #ruby-lang
queequeg1_ has joined #ruby-lang
timbleck has joined #ruby-lang
Arsen7 has joined #ruby-lang
werwolf has joined #ruby-lang
robgough has joined #ruby-lang
schroedinbug2 has joined #ruby-lang
babinho has joined #ruby-lang
valeri_ufo has joined #ruby-lang
seich_ has joined #ruby-lang
ruskie has joined #ruby-lang
matled has joined #ruby-lang
RegEchse has joined #ruby-lang
darix has joined #ruby-lang
Foxmaste1 has joined #ruby-lang
znz_v has joined #ruby-lang
nwonknu has joined #ruby-lang
Muz has joined #ruby-lang
fatprog has joined #ruby-lang
erikh has joined #ruby-lang
felipe has joined #ruby-lang
KillerFox has joined #ruby-lang
<andkerosine> Very nice.
mitchty has joined #ruby-lang
sirfilip has joined #ruby-lang
<kalleth> hmm
<andkerosine> ?
<kalleth> if i wanted to monitor the number of subscribers to a faye stream
<kalleth> how would i attempt that
<kalleth> each client subscribes to an 'i'm here' feed and sends a PING every X seconds to say 'i'm listening to the main stream' ?
<andkerosine> Congratulations?
<kalleth> i asked a question, then found the answer myself and let people know what it was
<kalleth> how is that worthy of a sarcastic response
<andkerosine> And again, congratulations.
<andkerosine> Lighten up.
<kalleth> i mean, would you prefer i idle
<andkerosine> Certainly not.
<kalleth> cool
<kalleth> so, the superbowl
<rippa> what is that?
<erikh> it's a very big bowl
<andkerosine> Really massive thing.
<Tasser> I freaking hate metaproblems
<Tasser> (pry):116: [BUG] Segmentation fault
csherin has joined #ruby-lang
<Tasser> http://pastie.org/3372960 <- I suppose it's curb?
havenn has joined #ruby-lang
<shevy> Tasser looks like a C extension problem
<Tasser> indeed
<Tasser> what other http post libs are out there? net/http doesn't work the server is too broken
<manveru> oO
<manveru> what part is broken?
<Tasser> they don't send a response code
<andkerosine> What does that impede?
futurechimp has joined #ruby-lang
<yorickpeterse> The server doesn't send a response code? What moron is in control of that?
<yorickpeterse> HTTP is pretty much useless without response codes
<manveru> i guess your option is netcat then...
<manveru> or a socket
<Tasser> manveru, chromium can deal with it :-/
<manveru> then use selenium
<yorickpeterse> Given the server is fixed and sends status codes Net::HTTP should be fine, if you want to use less "raw" code I can recommend HTTPArty
<yorickpeterse> * HTTParty
<yorickpeterse> Although I'm not a huge fan of it using class methods
<Tasser> yorickpeterse, net/http breaks
<Tasser> manveru, curl can deal with it I suppose...
<Tasser> so that's why I use curb
<Tasser> yorickpeterse, "Are you uploading the file using the form?" <- first response. I didn't dig further
<yorickpeterse> So just to recab, you're trying to talk to an HTTP server that doesn't send HTTP response codes?
<Tasser> aye
<Tasser> curl can deal with it, so I use curb.
<yorickpeterse> Then it's not an HTTP server according to the spec
<yorickpeterse> Though I find it strange that Curl can deal with that
<yorickpeterse> I would've imagined it would just bail out like Net::HTTP
<Tasser> it's resilient - although that guy doesn't have any clue about http as it looks like :-/
<yorickpeterse> Given he doesn't know about status codes that seems the case
<yorickpeterse> If possible I'd highly suggest to yell at him for that :)
<yorickpeterse> Either way, I'm not sure if Curb is a C extension or anything but try to make sure that it's loaded in the same environment as it was compiled in
<yorickpeterse> e.g. if it is compiled for 1.8 it will break in 1.9
<Tasser> don't worry, I know about that stuff ;-)
<Tasser> and yes, it's a C extension
<Tasser> Curl::Err::OutOfMemoryError: Curl::Err::OutOfMemoryError
<Tasser> hum.
<Tasser> looks like it doesn't play well with jruby
<yorickpeterse> heh
<Tasser> is net/http written in ruby?
<Tasser> yep
Stalkr_ has joined #ruby-lang
<andkerosine> It's... crucial that you get the response from your POST?
sirfilip has joined #ruby-lang
<yorickpeterse> Not sure if sarcastic or not
Yabes has joined #ruby-lang
<yorickpeterse> Either way, how else are clients supposed to validate a request without having to support every body format people come up with?
<Tasser> andkerosine, indeed
<kalleth> Tasser: page = `curl url`
<kalleth> :P
* kalleth hides
<shevy> most people are not quite helpful today!
<andkerosine> *`curl -s url`
gianlucadv has joined #ruby-lang
<kalleth> always with the 1ups, andkerosine =[
* shevy downvotes both kalleth and andkerosine for the fun of it
<andkerosine> I like kalleth; she knows how to use the nominate of address comma.
<kalleth> she
<andkerosine> That's, like, thirty-odd cool points in my book.
<kalleth> _she_
<kalleth> fuck it
<kalleth> im out
Yabes has quit [#ruby-lang]
<andkerosine> My bad.
<andkerosine> Name + super quick on the defensive.
<andkerosine> I went with instinct.
<andkerosine> *nominative
<molgrew> the nickname alone doesn't imply any gender to me, should it?
<kalleth> no, no, it shouldn't
<kalleth> it stems from kalashnikov
<kalleth> (ex-gamer)
<andkerosine> Double-L and "th" are both pretty "soft" sounds is all...
<kalleth> ancient history
<shevy> you are all gun nuts!
* shevy wields a katana
<kalleth> oh god, weeaboo alert
futurechimp has joined #ruby-lang
sirfilip has joined #ruby-lang
sirfilip has joined #ruby-lang
sirfilip has joined #ruby-lang
vdrab has joined #ruby-lang
Stalkr_ has joined #ruby-lang
uniqanomaly_ has joined #ruby-lang
fritzek has joined #ruby-lang
sirfilip has joined #ruby-lang
denysonique__ has joined #ruby-lang
ryez has joined #ruby-lang
toretore has joined #ruby-lang
mccraig has joined #ruby-lang
carlosgaldino has joined #ruby-lang
kurko_ has joined #ruby-lang
priteshjain has joined #ruby-lang
dous has joined #ruby-lang
nemesit has joined #ruby-lang
chimkan has joined #ruby-lang
sirfilip has joined #ruby-lang
chimkan_ has joined #ruby-lang
<shevy> isnt that the police academy dude
sirfilip has joined #ruby-lang
<shevy> yay!
<shevy> ruby is out
<shevy> ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p105.tar.bz2
niklasb has joined #ruby-lang
heftig has joined #ruby-lang
malev has joined #ruby-lang
fayimora has joined #ruby-lang
<Asher> anyone have any cites on ruby web framework usage statistics? like marketshare % estimates?
thone has joined #ruby-lang
<shevy> wheee... ruby 1.9.3p105 (2012-02-13 revision 34579) [i686-linux]
<shevy> hmm no idea Asher
<shevy> it's probably still fairly low
<Stalkr_> Hello People
<Stalkr_> Ruby on Rails or Sinatra? What would be best suited for a newbie?
sirfilip has joined #ruby-lang
<shevy> sinatra is easier and smaller
<Stalkr_> so you would recommend Sinatra to a newbie?
<tobiasvl> Stalkr_: i would absolutely recommend sinatra to a newbie :)
<tobiasvl> rails is a huge framework
malev has joined #ruby-lang
<shevy> "menu.rb:15: warning: duplicated when clause is ignored"
<shevy> oh nevermind
<Stalkr_> Sweet, I have a fairly simple site in mind - need to learn more HTML, CSS and JavaScript tho before I dig into Sinatra :)
<shevy> just realized I can scan and find out which one is duplicated
<Stalkr_> Do you have any books on those subjects that you would recommend? My experience is pretty limited, but I know the basics
fayimora has joined #ruby-lang
<shevy> ArgumentError: invalid byte sequence in US-ASCII
<shevy> gaaaah
<shevy> how do I change the encoding of a data structure, when I already loaded it?
<shevy> a long string
<rippa> force_encoding
<rippa> #encode
dv310p3r has joined #ruby-lang
<shevy> hmm
<shevy> Encoding::InvalidByteSequenceError: "\xE4" on US-ASCII
<shevy> y.encode("ASCII-8BIT")
<rippa> force_encoding then
<rippa> it doesn't try to transcode anything
<shevy> cool
<Tasser> it should be named #declare_encoding imo
<shevy> that seems to have worked
carlosgaldino has joined #ruby-lang
<shevy> z = y.force_encoding("ASCII-8BIT")
<shevy> no error
NARKOZ has joined #ruby-lang
sirfilip has joined #ruby-lang
<Tasser> shevy, begin; <code>; rescue; end <- no error
<shevy> well
sirfilip has joined #ruby-lang
<shevy> I'd have to add lots of this whenever I load my yaml files
<shevy> force_encoding worked nicely, I found the faulty parts in the case/when menu
<shevy> not a lot of fun to fix it though :(
<andkerosine> Stalkr_: How familiar are you with the language?
<Stalkr_> With Ruby or HTML/CSS?
<andkerosine> Ruby.
<Stalkr_> Only the basic, classes, functions, methods etc
<andkerosine> Protip: HTML and CSS aren't languages. : P
<Stalkr_> variables, loops
<tobiasvl> andkerosine: sure they are! but they're not programming languages
<tobiasvl> (the L in HTML even stands for "language")
<andkerosine> Fair enough.
<Stalkr_> HyperText Markup Language
<andkerosine> Mm-hmm.
<Stalkr_> Anyway, that's my experience in Ruby :)
<andkerosine> Given Ruby's wonderful obsession with object orientation, I'm not sure you classes should be considered "the basics".
<andkerosine> -you
<andkerosine> But, hell, even if you know them only by name, Sinatra is incredibly easy to jump into.
codewrangler has joined #ruby-lang
<Stalkr_> tobiasvl: Would that teach me Ruby or Sinatra?
<tobiasvl> ruby
<Stalkr_> andkerosine: Can you recommend a book or screencasts to have a look at?
<tobiasvl> sinatra almost comes by itself when you know ruby :)
<Stalkr_> Cheers, I'll check it out tobiasvl :)
<andkerosine> It's very basic, but once you get the hang of the standard markup, everything else in your Ruby repertoire is yours to use on the Web.
<andkerosine> I wrote a file host in ~20 lines. ^_^
<Stalkr_> damn
<andkerosine> I imagine it could be done in far less, really.
<Stalkr_> Seems powerful
<Stalkr_> I had a look at RoR - my mind was blown, just a look at the structure
<andkerosine> It's not pleasant.
<andkerosine> I've still not taken the plunge given that Sinatra suits all my needs at the moment.
<andkerosine> When creating a project drops ~200 files on you by default, it's my opinion that something is wrong.
<Stalkr_> With Sinatra, is HTML/CSS a prerequisite?
MistyM has joined #ruby-lang
<andkerosine> Well, they're a prerequisite for the Web, so...
<andkerosine> If you've picked up Ruby, I can't imagine HTML/CSS giving you much trouble.
ramonmaruko has joined #ruby-lang
<Stalkr_> How about just basic HTML/CSS knowledge? Do I have to dive into books, read hundreds of pages before I can get into Sinatra?
<Stalkr_> I don't mind reading and learning at all, I just rather do it right from start and read good stuff :)
<andkerosine> You could probably pick up HTML in a few hours, in all honesty.
<andkerosine> It's not "functional", it's markup. You learn when, where, and why to use certain tags, and there's little more to it.
<andkerosine> CSS is a fair bit nastier, given the discrepancies between browsers, but it's still essentially just rote memorization mixed with a little bit of figuring out what works/"looks good".
<andkerosine> http://tizag.com/ is an excellent resource for beginners.
sirfilip has joined #ruby-lang
<Stalkr_> Thanks
<Stalkr_> I'll deff take a look a little later
kurko_ has joined #ruby-lang
sirfilip has joined #ruby-lang
Sailias has joined #ruby-lang
sirfilip has joined #ruby-lang
yfeldblum has joined #ruby-lang
sirfilip has joined #ruby-lang
Sailias has joined #ruby-lang
<darix> Stalkr_: if you want to have a decent starting place for an app. you could go with twitter bootstrap. there is even a sinatra base app for that (https://github.com/ghostandthemachine/sinatra-haml-bootstrap-fluid )
<Stalkr_> Thanks for the link, but care to explain what it is about? How do I use it? :)
dejongge has joined #ruby-lang
<Stalkr_> Is it something like scaffold for RoR?
wyhaines has joined #ruby-lang
andrewhl has joined #ruby-lang
<burgestrand> Stalkr_: twitter bootstrap is a set of styles, to quickly get a website up and not have it look like crap from the start, which is useful if you’re testing ideas out
sirfilip has joined #ruby-lang
<burgestrand> Stalkr_: the link itself points to an application written in sinatra, and serves as a starting point for a new application
<burgestrand> it’s a bit… heavy for a beginner though
<darix> burgestrand: well beginners can copy paste from their components page :)
<burgestrand> darix: mostly talking about the sinatra application, not twitter bootstrap :)
<Stalkr_> I heard that Sinatra would be a better approach for a newbie than RoR
<burgestrand> Stalkr_: indeed it is, but that particular example has a lot of things set up; some of it you don’t need, some of it is good if you learn how to do yourself
<darix> Stalkr_: better. dunno. let's say different.
priteshjain has joined #ruby-lang
<burgestrand> it’s like having somebody else do your homework
<Stalkr_> So this https://github.com/ghostandthemachine/sinatra-haml-bootstrap-fluid is a little bit too much for a newbie?
outoftime has joined #ruby-lang
dv310p3r has joined #ruby-lang
<shevy> Stalkr_ you should stop being afraid of the task ahead ;)
<shevy> look at the dependency listing of it: - Bundler - Shotgun - Rack - Haml - Vlad the Deployer
<shevy> that is awfully much
<shevy> start with simple sinatra and extend
<Stalkr_> I will try that, but I still has to learn it though - can you recommend me something that can get me started? :)
<shevy> yes but only one thing
<shevy> work through http://pine.fm/LearnToProgram/?Chapter=00 as fast as you can, then instantly start to write ruby scripts on your own
<shevy> 95% of the things in ruby you'll pick up automatically as you get into the habit of writing code, but without the 5% start you'll not learn much
<Stalkr_> Sweet, they even have it translated http://sites.google.com/site/gcarst/komgodtigang :)
akahn has joined #ruby-lang
<Stalkr_> So if I know Ruby well enough, I will also know Sinatra well enough?
petercooper has joined #ruby-lang
tomzx has joined #ruby-lang
<shevy> of course not
<shevy> in order to learn sinatra, you must use it
<shevy> but it's the same thing with rails
<shevy> if you don't want to learn, don't :)
JEG2 has joined #ruby-lang
<Stalkr_> I want to learn, I just don't know how to learn or rather, where to learn it :)
<shevy> knowing ruby very well will help though
frem has joined #ruby-lang
<shevy> there are quite some folks who use rails, but don't really know ruby
<shevy> well write something that is useful to you
<shevy> my first two projects in ruby were an IRC bot and a game
<shevy> I managed to break my IRC bot ... and I tried to redesign the game and stopped in the middle :\
looopy has joined #ruby-lang
<Stalkr_> You don't use Sinatra or Ror?
<shevy> hmm not really
<Stalkr_> So you just do desktop apps?
<Stalkr_> /scripts
<shevy> nah
<shevy> I do everything in ruby without any limitation
<Stalkr_> Also web apps?
<shevy> sure
<shevy> the core of what sinatra does is very small
<Stalkr_> So you can write a full-blown web application (Facebook, Twitter, Google, Netflix etc) without any framework like Sinatra, RoR?
<Stalkr_> Only with pure Ruby?
<shevy> get '/hi' do; "Hello World!"; end
<shevy> Stalkr_, well, what is "pure" ruby. of course I use tons of addons
<lianj> shevy prolly still uses pure webrick
<shevy> I hate webrick
<shevy> it's an unusuable pile of crap
<Stalkr_> AddOns = Gems, right?
<lianj> shevy: orly?
<shevy> Stalkr_ gems are just like tarballs ... foobar-1.0.0.gem
<shevy> Stalkr_ but sure, I use Gems too
<shevy> lianj yes! it must die
<shevy> lianj what do you use for web stuff?
RomyRomy has joined #ruby-lang
<Stalkr_> Let's say I have a list of URLs - at the bottom there is a form/input and a submit button. Would there be a Ruby Gem that would add the URL I entered in the form automatically to the list?
<burgestrand> Stalkr_: no, that gem would not be awfully useful
slyphon has joined #ruby-lang
<lianj> shevy: rack
<Stalkr_> burgestrand
<Stalkr_> upps, so I would have to do that myself?
<burgestrand> Stalkr_: in addition, there comes a lot of decisions to make for even such a small thing :)
<shevy> even in rails you'd have to do some form-thingy
<burgestrand> Stalkr_: so while there certainly would be ways to make a gem for that, that specific gem would be useful to very few people
<shevy> god :/ I hate things like '<%= form_tag("/search", :method => "get") do %>'
<Stalkr_> So I would have to code a gem that myself or is it not a Gem I would for then?
<Stalkr_> would look for*
<burgestrand> Stalkr_: gems are more keen to what we call libraries
tekin has joined #ruby-lang
Aphelion has joined #ruby-lang
<burgestrand> Stalkr_: they package up functionality that’s commonly used; they could provide you with a way to make a call to a website, login with facebook or lay down the foundation for creating your own website like Sinatra or RoR
<Stalkr_> so Sinatra is a gem?
<Stalkr_> or a framework?
<burgestrand> Stalkr_: both :)
<Stalkr_> o:
Spooner has joined #ruby-lang
<shevy> gem is a way to package something for distribution
<shevy> you can then do:
<shevy> gem install sinatra
<shevy> on your machine
<shevy> and it will install sinatra
<burgestrand> Stalkr_: gems is how you distribute things; instead of the sinatra authors giving you all of the source code for sinatra for you to put somewhere in your project, you declare that your project is using the gem 'sinatra' and you can use it from there right off the bat
<shevy> and download sinatra*.gem into a cache dir
<shevy> on my system this cache dir is /usr/lib/ruby/gems/1.8/cache/
<shevy> Stalkr_ have you installed Ruby yet?
<Stalkr_> So if I wanted to do something like above, add something to a list, it would be easier to just code it myself?
<Stalkr_> Yes, IRB
<burgestrand> Stalkr_: you’d most likely have to code it yourself
<shevy> Stalkr_ ok good :)
<Stalkr_> Would it be hard to code? Would something like that take a long time to learn?
<burgestrand> Stalkr_: I’d say it’s the perfect starter project if you want to learn web development
<shevy> define 'long'
<Stalkr_> Weeks or maybe months
<shevy> yeah
<shevy> I'd say it takes a long time to learn :)
<burgestrand> Stalkr_: you could get the first version up and running in under a day with some mentoring, but to build your own facebook it’d take months
<shevy> but there are different levels to achieve
<shevy> Level 1 Stalkr_
<shevy> Level 2 Stalkr_
<shevy> Level 3 Stalkr_
<shevy> you need experience points man
<Stalkr_> Oh, I am not interested in making something hardcore like Facebook, my project is very simple
<shevy> ok so you only want to reach Level 1
<burgestrand> Stalkr_: indeed, I’m just trying to put it into scope :)
<shevy> that's not so hard
<Stalkr_> Yeah, I guess Level 1 for know
<Spooner> I remember when I used to mod games, the first thing newbies used to ask is "So how do I make the game into an MMO" :) FIRST THING, every time.
<Stalkr_> Then keep on adding things for my page
<lianj> Spooner: hehe, so how? :P
<shevy> haha
<burgestrand> Stalkr_: is ruby your first programming language?
<shevy> well at least they WANT to learn
<Stalkr_> Yup
<Spooner> lianj: How do you get to Carnegie Hall? :D
<burgestrand> Stalkr_: sweet, how long have you been at it?
<shevy> oh and
<Stalkr_> Only a few days tbh
<shevy> Stalkr_, how did you find ruby?
<Stalkr_> Actually, I really wanted to develop for the iPhone - I looked into Objective-C, but was told to learn a high-level language first. People recommended Python and Ruby, but Ruby stood more out for me
<Stalkr_> So now I want to give Ruby a shot, try to do simple web apps and see how I go from there
<burgestrand> Sound plan.
<Harzilein> Stalkr_: ruby seems to fit a tiny bit better with wanting to learn objc too.
<Stalkr_> I just liked the idea that everything is an object, so I thought Ruby might give a better idea of OOP than Python :) I am not saying this is true, just a thought
<Spooner> I've started using Sinatra for the first time this week. Certainly nice and straightforward compared to Rails :)
<Harzilein> Stalkr_: it's not _all that_ smalltalkey, but neither is python.
<roadkith> i dont know why ppl recommend learning a high level language first
<Stalkr_> I did take a look at C first, but I quickly NOPEd out
<Spooner> Because starting in C++ won't reward you with anything any time soon.
<burgestrand> I started with C back in the day, almost scared me off.
<roadkith> hmm
<burgestrand> Low level languages require too much effort to get something up and working. High-level languages are especially good for prototyping which is helpful when you want to see what you’re doing has some impact.
<Spooner> I started in BASIC, then at University, Fortran! Fortran made me learn C in my spare time instead of going to physics lectures :)
thegeekinside has joined #ruby-lang
Sailias has joined #ruby-lang
<roadkith> i learned pascal as first language
<roadkith> then c++
<roadkith> admittedly both pissed me off so baldy i thought i'd never programm for money :D
<burgestrand> :p
<roadkith> but then it helped with learning ruby
<shevy> Stalkr_ I came from PHP. PHP kinda sucked, so I wanted a better language. The choice was between python and ruby, and an old interview by matz decided it for me back then
<roadkith> actually made it somewhat pleasant
Sailias_ has joined #ruby-lang
<shevy> I think we learned pascal in school back then
<shevy> I dont remember what we had to do... some simple math calculations... circle... rectangular... some more things
<Stalkr_> PHP seems like a horrible language to learn
<shevy> yeah PHP is terrible. It's however also fairly easy for a newcomer and you get fast results in a browser too
<darix> php is an horrible language
Sailias_ has joined #ruby-lang
<Stalkr_> Is it easy to setup Sinatra/RoR on a web host?
<darix> Stalkr_: depends on your webhost
Sailias has joined #ruby-lang
<shevy> Stalkr_ it is probably easier to setup PHP on a web host
Guest35831 has joined #ruby-lang
<shevy> so
<shevy> learn PHP
<shevy> :>
<shevy> you'll switch to a better language eventually anyway ;)
<roadkith> and i dont like php and perl for ther C-ish syntax
<darix> shevy: you are mean!
<darix> very mean!
<lianj> yea
<roadkith> why learn a high level language that tries to mimic C-ish syntax?
<darix> Stalkr_: there are ruby specialized hosters
<shevy> roadkith well perl has been around since the stoneages
<rippa> С++ mimics C syntax too
<rippa> also C is high-level language
<shevy> almost everything mimics C-like syntax :(
<roadkith> compared to asm :D
<roadkith> shevy: yeah and i dont get that
<shevy> when I first saw haskell I found the syntax very cool
<roadkith> i thought haskell was rather cryptic
<shevy> but soon came the monad barrier
<Spooner> PHP is a dead end, since it is web-only. Ruby works on the Web, as well as on the CLI or in GUI apps or games (the latter, not so well, but it does work).
<shevy> and I am too dumb to understand monads
judofyr has joined #ruby-lang
malev_ has joined #ruby-lang
<rippa> PHP works not only on the web
<rippa> like ruby
<roadkith> its used mostly for web tho
bglusman has joined #ruby-lang
<Spooner> I know you _can_ use PHP anywhere, but who the hell would?
adambeynon has joined #ruby-lang
<rippa> like ruby
<lianj> php-gtk must be awesome
<roadkith> nah ruby isnt mostly used on the web i'd think
<rippa> it is
csherin has joined #ruby-lang
<rippa> mostly used on teh web
<rippa> as rails
<Spooner> I found use for Ruby a long time before Rails.
<Spooner> And I will a long time after Rails is obsolete :D
<judofyr> rippa: [citation needed]
<roadkith> theres quite a few non-web related ruby projects
<rippa> judofyr: [1]
<judofyr> I see what you did there
capn_kryptonite has joined #ruby-lang
<skryking> puppet as a non rails based project comes to mind.
tjadc has joined #ruby-lang
<roadkith> limechat
seanstickle has joined #ruby-lang
<whitequark> hm
<whitequark> metasploit
<roadkith> my config parser :D
<whitequark> my static analysis framework
<judofyr> tons of vim plugins
<roadkith> freebsd admin scripts
<whitequark> macosx internal tools
<roadkith> didnt they replace perl entirely with ruby?
<whitequark> yes
<judofyr> and not a single brace was missed
<roadkith> cool eh1? ;)
<Spooner> They still only ship with 1.8.7 though :(
fayimora has joined #ruby-lang
<shevy> oh
<shevy> Spooner, how did you come to ruby? you used another language?
<shevy> my long time goal is still to replace javascript as the language number one on github, with ruby
<shevy> but I will fail :(
<seanstickle> That's my goal too!
<seanstickle> Except with APL.
<seanstickle> You are more likely to win.
<shevy> hehe
* whitequark aims for brainfuck, of course
<seanstickle> Aw, don't make fun of APL
<seanstickle> It's beautiful
<Spooner> I can't remember now. It was a very long time ago; maybe 10 years.
<roadkith> brainfuck is too simple
<lianj> shevy: you have not a single repo, get started ;)
<whitequark> seanstickle: I don't. that note was not related to APL :)
zenChild has joined #ruby-lang
malev has joined #ruby-lang
Jake232 has joined #ruby-lang
<Spooner> shevy: Yeah, just fork a few of the popular repos to make yourself seem like a hipster.
<shevy> lianj hey I am doing lots of changes lately! it's just hard to integrate git into my workflow... it still seems easier to rm -rf .git which kinda defeats the point of using it heheheh
<lianj> shevy: crazy fellow :)
fritzek has joined #ruby-lang
beiter has joined #ruby-lang
<shevy> btw txus on #rubinius showed a nice slide -> http://talks.codegram.com/object-oriented-nirvana#/ hitting the spacebar is fun :P
erpuds has joined #ruby-lang
<shevy> https://github.com/sinatra/sinatra/contributors hmm lots of contributors
rayners has joined #ruby-lang
bitrot has joined #ruby-lang
zenChild has quit [#ruby-lang]
<andkerosine> Is there no clean/clever way to alias a method several times?
<darix> andkerosine: put the replacement in a module and include the module. then you can call the old method with super?
<csherin> shevy: btw the slide was a nice read :)
<darix> something like that
<darix> shevy: nice slides
<andkerosine> I need only alias by name.
<andkerosine> And it's for something really trivial, so if it's not tiny and neat, no big.
<darix> andkerosine: doesnt mean the module way wouldnt work for you
<rue> andkerosine: Just do it?
<lianj> "use only one dot per line" meh
matti has joined #ruby-lang
matti has joined #ruby-lang
<darix> lianj: he violates it in the example already
<darix> :)
<rue> %w[name another yay wee].each {|n| alias_method n, :moomin }
<andkerosine> Hm... didn't work with alias.
<judofyr> yeah, alias is syntax
<andkerosine> Ah.
<andkerosine> No, that doesn't work.
<judofyr> hard to meta-program with it
<rue> andkerosine: Sure it does
<andkerosine> Ah, comma required for alias_method but /must/ be left out for alias. That's not very least-surprise.
<rue> One's syntax, one's a method
<tobiasvl> andkerosine: what do you mean?
<tobiasvl> comma just means there are two parameters?
<andkerosine> Disregard.
<andkerosine> Is alias_method heavy at all?
<rue> tobiasvl: alias doesn't have a comma
<andkerosine> I'm not trying to retain the old functionality, just offer a convenience for the end user.
<rue> andkerosine: It's unlikely to be the bottleneck in your program, let's put it that way.
<andkerosine> That'll do. : )
<Spooner> andkerosine: You should use alias_method anyway. It does the same as alias, but can be hooked into and is more "normal" in syntax.
<andkerosine> Mm-hmm. I really didn't like that lacking comma.
<andkerosine> What's the distinction, exactly?
<andkerosine> I can't recall any other feature of the language that behaves that way.
<Spooner> As someone said, alias is a keyword like "if". alias_method is itself a method that uses alias.
robbrit has joined #ruby-lang
<dreinull> wow my rack tests are 4 times slower in 1.9 than in 1.8
<shevy> hehe
<shevy> natural evolution!
carlosgaldino has joined #ruby-lang
<dreinull> devolution I'd call it
havenn has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
takaokouji has joined #ruby-lang
<shevy> :)
zmack has joined #ruby-lang
molgrew has joined #ruby-lang
looopy has joined #ruby-lang
slimfit has joined #ruby-lang
sirfilip has joined #ruby-lang
Stalkr_ has joined #ruby-lang
sirfilip has joined #ruby-lang
QaDeS has joined #ruby-lang
rippa has joined #ruby-lang
r0bby has joined #ruby-lang
r0bby_ has joined #ruby-lang
<rue> 1.9.3?
setmeaway2 has joined #ruby-lang
zigidias has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
virunga has joined #ruby-lang
Axsuul has joined #ruby-lang
darkf has joined #ruby-lang
SubSpawn has joined #ruby-lang
sirfilip has joined #ruby-lang
wmoxam has joined #ruby-lang
fayimora has joined #ruby-lang
bglusman has joined #ruby-lang
artOfWar has joined #ruby-lang
bglusman has joined #ruby-lang
macmartine has joined #ruby-lang
anjen has joined #ruby-lang
necromancer has joined #ruby-lang
<TTilus> dreinull: have you profiled?
<dreinull> TTilus: no, actually a good idea to do so
<TTilus> dreinull: =D
enebo has joined #ruby-lang
<TTilus> dreinull: my guess is a _lot_ of exceptions thrown and catched somewhere
<TTilus> dreinull: erm, raised and rescued... of course
<dreinull> TTilus: why?
malev_ has joined #ruby-lang
<TTilus> dreinull: thats one of the very few thing which is significantly slower on yarv compared to mri
<TTilus> s/thing/things/
<dreinull> TTilus: can't think of reasons why there should be exceptions raised in my tests
<TTilus> dreinull: you know your code, i dont, just profile and you shall know =D
ivanoats has joined #ruby-lang
tekin has joined #ruby-lang
stef_204 has joined #ruby-lang
<darix> l
malev has joined #ruby-lang
<TTilus> ?
skiz has joined #ruby-lang
<darix> wrong window
fayimora has joined #ruby-lang
nofxx has joined #ruby-lang
cyri_ has joined #ruby-lang
sirfilip has joined #ruby-lang
savage- has joined #ruby-lang
bglusman_ has joined #ruby-lang
dfr|mac has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
<andkerosine> My fixation on lining up comments is becoming a sickness.
<shevy> I like code formatting
<shevy> including comments
darkf_ has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
slimfit has joined #ruby-lang
sternicus has joined #ruby-lang
deryl_ has joined #ruby-lang
chendo__ has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
ihme-TTilus has joined #ruby-lang
oddmunds has joined #ruby-lang
jarib has joined #ruby-lang
curtism has joined #ruby-lang
dejongge has joined #ruby-lang
<andrewvos> PSA: delete all the comments
<andkerosine> But... they're so informative!
<Spooner> x += 1; # Add one to the value x had before.
JohnBat26 has joined #ruby-lang
havenn has joined #ruby-lang
vereteran has joined #ruby-lang
<andkerosine> # By default, build initializes a Subreddit with its about data attached as methods via Struct. /r/all, as well as any combined ('books+music') or filtered ('programming/new') names, lack about.json pages, and must therefore be built with only their names passed to the Struct. Posts and comments can still be accessed as usual.
dous_ has joined #ruby-lang
bojicas has joined #ruby-lang
Heimidal has joined #ruby-lang
gnufied has joined #ruby-lang
dfr|mac has joined #ruby-lang
quatauta has joined #ruby-lang
qpingu has joined #ruby-lang
_bryanp has joined #ruby-lang
musl has joined #ruby-lang
sirfilip has joined #ruby-lang
fayimora has joined #ruby-lang
solars has joined #ruby-lang
havenn has joined #ruby-lang
sirfilip has joined #ruby-lang
grough has joined #ruby-lang
optikalmouse has joined #ruby-lang
<Spooner> Is there a way to clean up broken gemspecs? I have some that managed to be saved as empty files by gem, which it complained about every time I ran it, so I deleted the .gemspecs and now it won't install anything :(
<optikalmouse> is design by contract possible in ruby?
havenn has joined #ruby-lang
<shevy> what is design by contract
<Spooner> optikalmouse: Yes, but people generally use tests instead.
lordofthedance has joined #ruby-lang
havenn has joined #ruby-lang
sirfilip has joined #ruby-lang
<optikalmouse> Spooner: okay, so it recommends using tests and rspec. I've not used rspec, is that close to design by contract at all?
sirfilip has joined #ruby-lang
<manveru> rspec is just the slowest way to run tests :)
<Spooner> optikalmouse: Not directly, but you can certainly do with it what you can in DBC (I haven't used DBC, but I read up about it once and may have tried to implement it in Ruby at one time, but I gave up).
<manveru> unless you use cucumber...
dfr|mac has joined #ruby-lang
<Spooner> I've moved around a bit in frameworks. Went rspec (too slow)->riot (terse but not that readable)->bacon (fast, but a bit basic). Still wondering if I shouldn't jump again :D
<manveru> been using bacon for years now
<optikalmouse> Spooner: those are all like test frameworks?
<futurechimp> optikalmouse: people tend to use tests in ruby where people in other languages would use dbc - those are all test frameworks, yeah
<Spooner> Yes. The other main one is Minitest which is the one included in Ruby as standard.
sirfilip has joined #ruby-lang
<futurechimp> optikalmouse: there are a lot of ruby test frameworks: https://www.ruby-toolbox.com/categories/testing_frameworks
<futurechimp> jeez there are even more than i've ever heard of
H2H has joined #ruby-lang
<optikalmouse> ugh, too many
<optikalmouse> I think we're using whatever rails uses at work
<optikalmouse> and someone on the team has TRIED to introduce rspec I think, but yeha, I want some DBC! :/
<futurechimp> well, most people use rspec, test::unit/shoulda
GiambalaGiambala has joined #ruby-lang
<futurechimp> minitest is now the test framework bundled with ruby 1.9
<futurechimp> but the bottom line is, if you want dbc you'll have to write it yourself probably
<futurechimp> i'd be interested to see what it looks like actually
<manveru> i'm not sure where you'd even start doing that in ruby :P
<optikalmouse> it should be straight forward
<shevy> at the bottom
<shevy> always start at the bottom guys
<futurechimp> good luck with it, whichever way you go :)
<optikalmouse> you can probably use a mixin? XD
<Spooner> I think you'd want to add class methods like pre & post that are run aroudn the next defined method.
<optikalmouse> right but you need to store old values too
<optikalmouse> and the other conditions that can be wrapped around a class need to be there too...
<optikalmouse> this is making me hungry for pizza, I'll be back lol
<andkerosine> Haha.
<Spooner> Of course, all that does is: raise ArgumentError, "Divisor must be non-zero" unless b != 0 (which is the usual Ruby way of checking inputs).
banderson623 has joined #ruby-lang
robotmay has joined #ruby-lang
banderson623 has joined #ruby-lang
lordofthedance has joined #ruby-lang
slimfit has joined #ruby-lang
nemesit has joined #ruby-lang
Waldteufel has joined #ruby-lang
Waldteufel has quit [#ruby-lang]
symm- has joined #ruby-lang
publicvoid has joined #ruby-lang
<optikalmouse> Spooner: that's too simple a DBC library....
<andkerosine> It's almost a joke.
sirfilip has joined #ruby-lang
<optikalmouse> andkerosine: it is if it refers only to the wikipedia page rather than a book ;p
<Spooner> optikalmouse: Yes. What it needs is hooks that run during development but do nothing in the real thing. The problem is that the same thing is possible with the same amount of syntax in native ruby.
havenn has joined #ruby-lang
<Spooner> But it is probably easier to do with testing in Ruby and you don't have to roll your own.
<optikalmouse> exactly
banderson623 has joined #ruby-lang
sideshownz has joined #ruby-lang
dfr|mac has joined #ruby-lang
CoverSlide has joined #ruby-lang
fritzek has joined #ruby-lang
sirfilip has joined #ruby-lang
daglees has joined #ruby-lang
hagabaka has joined #ruby-lang
outoftime has joined #ruby-lang
HW42 has joined #ruby-lang
<Tasser> is there an ENV variable I can specify for ruby to include into the LOAD_PATH?
<Mon_Ouie> RUBYLIB
<outoftime> Tasser: you can also use the -i flag, if that's more helpful
<outoftime> Tasser: -I, that is
havenn has joined #ruby-lang
chimkan___ has joined #ruby-lang
outoftime has joined #ruby-lang
grough has quit [#ruby-lang]
Phrogz has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
<Phrogz> I have a string of bytes in ASCII-8BIT. I have a guessed encoding (rchardet19 gem). If I force_encoding to the guessed encoding, and turns out not to be a valid_encoding?, what's my next step? force back to ascii and then #encode to the guessed with invalid:replace/undef:replace?
<Phrogz> Or (if you have experience with this gem) will it never supply a guess that is an invalid encoding?
twittard has joined #ruby-lang
outoftime has joined #ruby-lang
andkerosine has quit [#ruby-lang]
qpingu has joined #ruby-lang
senj has joined #ruby-lang
alerticus has joined #ruby-lang
outoftime has joined #ruby-lang
benanne has joined #ruby-lang
cyri_ has joined #ruby-lang
<hagabaka> Phrogz: data = cd.confidence > 0.6 ? Iconv.conv(cd.encoding, "UTF-8", data) : data # as in README?
<Phrogz> hagabaka: I think not. That confidence level seems artificially high to me. Since I have *no* idea what encoding the data is supposed to be in, any guess it makes is likely to be better than mine. Further, I can't leave it as ASCII-8BIT; I have to get it into UTF-8 for pushing into the DB at the end.
<hagabaka> so just skip the confidence check?
banderson623 has joined #ruby-lang
<burgestrand> Phrogz: it’d be odd if it could give you an encoding that’s not valid for the string; feels like it defeats the whole purpose of encoding detection. Granted, I’ve been surprised before so don’t take my word on it.
rivaler has joined #ruby-lang
<Phrogz> burgestrand: Yeah, I'm starting to believe that. Gonna email the author nonetheless.
<hagabaka> I think it only does detection with basic patterns without converting the whole string, since there are other tools to convert
userbard has joined #ruby-lang
<dreinull> Phrogz: can't you just always force it to be utf8?
<burgestrand> I’ve had times when it guessed the character set of an UTF8 string to be some kind of russian encoding; just remember you’re likely to end up with some very funny data if you’re unlucky.
<Phrogz> Well, at hundreds of tens of thousands of lines per day, I don't really mind if it gets a few wrong. :)
<Phrogz> Better than me attempting it manually. :p
|bardoe| has joined #ruby-lang
BadQuanta has joined #ruby-lang
brian_anderson has joined #ruby-lang
tbuehlmann has joined #ruby-lang
<hagabaka> iconv will raise exception if the string can't be in that encoding
Danzer has joined #ruby-lang
srbaker has joined #ruby-lang
<Danzer> pls, whats wrong lines 30,31,32 : http://pastie.org/3375801
<skryking> probably not the right place to ask, but does anyone know if websockets can be client to client, or can a browser act as a server?
<burgestrand> skryking: no, websockets are client-to-server
qpingu has joined #ruby-lang
cyndis has joined #ruby-lang
<burgestrand> I saw something recently though that allowed client-to-client communication, if only I could find it…
<skryking> burgestrand, is there any way to make the browser act like a server?
<Phrogz> dreinull: I suppose I might be able to, storing the occasional string filled with ��� in my DB. It feels better, though, to at least try to get it right.
<dreinull> Phrogz: I had so much trouble with encodings, I don't think there is a way to get it right 100%
<Phrogz> I'm annoyed/weirded out that Ruby does not "properly" handle s.force_encoding( "foo" ); s.encode( "foo", invalid: :replace, undef: replace ) unless s.valid_encoding? though
<Phrogz> dreinull: No, with these log files I'm sure I won't get it right. But CharDet might stumble upon a weird chinese encoding that would preserve what the user actually typed instead of me just throwing it away because I'm a dumb Unicodian.
<Phrogz> I guess it would be hard for Ruby to be sure where to start throwing away bytes if you tried to re-encode from a bad encoding.
<burgestrand> skryking: everything’s possible when it comes to software and limitations, but for this specific case I don’t think there’s a good way to do that, no
<Phrogz> Danzer: Looks OK to me (except I *always* use the block form of File.open.). What *is* wrong with those lines/.
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
mytrile has joined #ruby-lang
erpuds has joined #ruby-lang
woody2shoes has joined #ruby-lang
slimfit has joined #ruby-lang
<Danzer> Phrogz if i run that script. return to me a exception error: undefined method `[]' for nil:NilClass (NoMethodError) from line 8.
Skif has joined #ruby-lang
roha has joined #ruby-lang
petercooper has joined #ruby-lang
kamui_ has joined #ruby-lang
kamui_ has joined #ruby-lang
kamui_ has quit [#ruby-lang]
kamuiGT has joined #ruby-lang
outoftime has joined #ruby-lang
tbuehlmann has joined #ruby-lang
y3llow has joined #ruby-lang
s0ber has joined #ruby-lang
<skryking> burgestrand, is this what you were talking about client to client? http://www.w3.org/TR/webrtc/
<burgestrand> skryking: https://github.com/oyvindkinsey/easyXDM#readme <- that thing
y3llow has joined #ruby-lang
<burgestrand> But, I’m no longer sure it was that.
djcercone has joined #ruby-lang
<burgestrand> If you want to talk between your clients, I’d have both sides initiate a websocket connection with your server; and then have your server pass messages back and forth.
djcercone has quit [#ruby-lang]
y3llow has joined #ruby-lang
<burgestrand> (look at, for example, beaconpush, pusherapp or pubnub for hosted versions of that)
<Phrogz> Danzer: Pastie your entire exception and backtrace.
<skryking> I've done that already. just being curious... no real goal at mind for using it.
virunga has joined #ruby-lang
bradland has joined #ruby-lang
qpingu has joined #ruby-lang
lsegal has joined #ruby-lang
<Phrogz> Danzer: You may note that you originally asked for someone to look at lines 30-32, but you said that you're getting an exception on line 8...and yet what you just pasted shows that this error is on line 16, not line 8.
<burgestrand> I love it when this happens!
<Phrogz> Danzer: The error "undefined method `[]' for nil:NilClass (NoMethodError)" means that on line 16 you did something[] but something was nil. In this case, your latitude is a nil value. Debug from there.
<shevy> Danzer use pastie.org with your full .rb script pls
<Danzer> ok,
hagabaka has joined #ruby-lang
<Phrogz> shevy: He did: http://pastie.org/3375801
hagabaka has joined #ruby-lang
Heimidal_ has joined #ruby-lang
<shevy> hmm
<Phrogz> Does oo.cell( 0, "k" ) work? Is it not 1-based like Excel?
<shevy> Danzer, always make sure that the indent is coherent. it makes it easier to spot mistakes. after the line "10.upto(oo.last_row) do |line|" the indent should be 2 spaces
<Phrogz> Er, ignore my last comment.
<Danzer> shevy but, "if ignition|| longitude || latitude" filter that.
<Danzer> these coordinates, will be included in a kml file for viewing on google earth.
<shevy> Danzer, see a little reworked, I think it has a slightly better structure: http://pastie.org/3376097
<shevy> btw
<shevy> you use position = [] twice
<shevy> I mean positions = []
<shevy> one of that is probably useless
<shevy> I'd also recommend you to do require 'pp'
<shevy> and pp your datastructure
<shevy> like pp positions
<shevy> something is nil there
postmodern has joined #ruby-lang
<chris2> btw, can one make irb always use pp?
<petercooper> why pp when ap?
<chris2> ap?
<shevy> hmm
<shevy> let's see ...
* shevy digs into IRB source code ...
<petercooper> but yeah, you can switch in any case
indstry has joined #ruby-lang
<indstry> is there a way to print out all installed gems from a ruby script?
<chris2> that looks awful :P
<shevy> awesome print is a bit too much
<shevy> colour explosion
<theconartist> indstry: `gem list` is an easy hack of that works for you
<petercooper> Gem.source_index.map(&:first) will help
<shevy> hmm
<shevy> irb has a method called:
<shevy> def foo(format)
<shevy> I kid you not... :\
<theconartist> shit that way is way better
<shevy> defined in class OutputMethod ... and with 0 documentation
<shevy> puts [f, p, pp, pos, new_pos, c].join("!")
<chris2> IRB.conf[:INSPECT_MODE] = :pp
<petercooper> or that. I fudged mine from the way you have to do it with ap, lol.
zmack has joined #ruby-lang
* chris2 also defines a P which does p and returns nil
chimkan has joined #ruby-lang
<Danzer> This xls is sent monthly by a company vehicle tracking.
<Danzer> I will use to plot on google earth. in the future, google maps api
<Danzer> shevy thx for restructure
<shevy> :)
ilyam has joined #ruby-lang
dr_bob has joined #ruby-lang
rushed has joined #ruby-lang
malev_ has joined #ruby-lang
savage-_ has joined #ruby-lang
Skif has joined #ruby-lang
_bryanp has joined #ruby-lang
dr_bob has quit [#ruby-lang]
robbrit has quit [#ruby-lang]
ilyam has joined #ruby-lang
roha has joined #ruby-lang
waazzuup has joined #ruby-lang
lupo20 has joined #ruby-lang
lupo20 has quit [#ruby-lang]
srbartlett has joined #ruby-lang
robotmay has joined #ruby-lang
Stalkr_ has joined #ruby-lang
tenderlove has joined #ruby-lang
rpowell has joined #ruby-lang
Wardrop has joined #ruby-lang
bradland has joined #ruby-lang
JoL1hAHN has joined #ruby-lang
andrewhl has joined #ruby-lang
<optikalmouse> can I define functions within functions in RUby?
<optikalmouse> or should I define a method in my class that's private?
<yxhuvud> I'd vote for 'neither'
<drbrain> you can put functions in functions, but what yxhuvud said
<drbrain> just make another regular method (or object to hold a group of methods)
<yxhuvud> or a method that takes a block.
<optikalmouse> no blocks.
<optikalmouse> another regular method meaning non-private.
<optikalmouse> why not a private method if it's a helper method or something?
<drbrain> private methods are annoying to test
<drbrain> and (to me) indicate you have another object waiting to escape into a new class
<yxhuvud> post what you are trying to achieve and we could give you actual hints
<outoftime> private methods are not supposed to be tested. that's why they're annoying to test.
<outoftime> they're implementation details.
<optikalmouse> I don't want to test the function.
<optikalmouse> I'm using rails and breaking out a controller action method into multiple smaller methods
<drbrain> optikalmouse: ☹
<drbrain> outoftime: TATFT
<outoftime> drbrain: sorry -- not meant to be tested *directly*. the public methods that exercise them should certainly be tested.
<drbrain> optikalmouse: an implementation detail is a just a behavior waiting to be specified
daglees has joined #ruby-lang
<drbrain> but, usually it's specified by your users and prevents you from a sane refactoring
<optikalmouse> drbrain: what does that even mean? lol
<outoftime> that's like saying methods should never be more than one line long because it's hard to test the middle lines of a method.
<optikalmouse> outoftime: they shouldn't be longer than 10lines! :p
<outoftime> optikalmouse: quite so : )
<drbrain> outoftime: so if you can only test private methods through their public counterpart, and a public method calls two private methods, that's 30 lines I've got to run for a test?
<drbrain> that's ridiculous, and why so many test suites take > 5s to run
<drbrain> "don't test private methods" is a great strategy for surfing the internet all day
<outoftime> in my experience, lifecycle hooks and observers are why so many test suites take a long time to run.
<outoftime> but anyway, i find this conversation a bit too baffling to continue -- let's agree to disagree.
<optikalmouse> drbrain: I'm not doing ANY unit-testing :D
<drbrain> optikalmouse: ☹
<optikalmouse> it's wonderful, *goes to reddit.com for the rest of the day* ;)
<drbrain> outoftime: sounds like poor implementation stacked atop poor tests ☹
<outoftime> drbrain: sorry to hear you feel that way
<rue> There's no sane reason not to test private methods
<rue> Other than not having any.
<andrewvos> hmm
<outoftime> rue: your tests should break when your code breaks. private methods aren't part of the external interface you're exposing, so you should be able to change them as much as you want as long as your class obeys its behavioral contract by way of its public API.
<andrewvos> rue: Wait, what?
<outoftime> rue: again, that's not to say that the behavior encoded in a private method shouldn't be tested, only that it should be tested by way of the public API, because the public API is all that matters.
Heimidal has joined #ruby-lang
<rue> External interface is completely orthogonal to testing
* andrewvos steps away slowly
<drbrain> outoftime: you seem to be proposing only Functional Testing, not Unit Testing
<drbrain> I Unit Test
Spooner has joined #ruby-lang
<outoftime> drbrain: I think it's debatable whether unit testing includes accessing non-public parts of a class's interface, but I would concede that one can define it that way. and if you want to define it that way, then in my opinion unit testing is unhelpful. tests should only fail when your code is broken, not because you've changed an implementation detail.
<rue> Haha, c2
<rue> outoftime: That makes no sense
<outoftime> rue: really?
<rue> If #a calls #b, there's nothing stopping you from specifying what #b accepts and returns
<drbrain> outoftime: it's not debatable, it's defined like so: "Under the strict definition, for QA purposes, the failure of a UnitTest implicates only one unit. You know exactly where to search to find the bug."
davpoind has joined #ruby-lang
<drbrain> if you test private methods through the public interface you do not know exactly where to search to find the bug when one fails
<drbrain> so it isn't a unit test
WillMarshall has joined #ruby-lang
<outoftime> ok folks! let's all just keep doing things the way we've been doing them : )
<outoftime> i get the sense that that will be the outcome of this discussion whether it ends now or in half an hour : )
slimfit has joined #ruby-lang
<yxhuvud> it seems this discussion got a bit side tracked away from finding ways of not having to do ugly stuff like private methods :)
<optikalmouse> private methods aren't ugly, so I'm def using them ;p
h4y4shi has joined #ruby-lang
waazzuup has joined #ruby-lang
savage- has joined #ruby-lang
fayimora has joined #ruby-lang
Carnage\ has joined #ruby-lang
gregf has joined #ruby-lang
Heimidal_ has joined #ruby-lang
dfr|mac has joined #ruby-lang
banderson623 has joined #ruby-lang
<lsegal> gotta love when people quote wiki-style debates as evidence
<rue> C2, dude.
<lsegal> srsly.
burgestrand has joined #ruby-lang
bglusman has joined #ruby-lang
srbaker has joined #ruby-lang
srbaker_ has joined #ruby-lang
Slackwise has joined #ruby-lang
<shevy> I have no idea what the discussion was about
<shevy> but I do know that I disagree with ALL OF YOU!
Dreamer3 has joined #ruby-lang
<erikh> shevy: I'm disagreeing with your rationale for the disagreement
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
yfeldblum has joined #ruby-lang
S1kx has joined #ruby-lang
schlecht has joined #ruby-lang
QaDeS has joined #ruby-lang
chimkan has joined #ruby-lang
kyrylo has joined #ruby-lang
Gekz has joined #ruby-lang
Heimidal has joined #ruby-lang
erpuds has joined #ruby-lang
erpuds has joined #ruby-lang
Tref has joined #ruby-lang
Indian has joined #ruby-lang
wyhaines has joined #ruby-lang
zenspider has joined #ruby-lang
<zenspider> rawr
<zenspider> autotest-rails 4.1.2 released