apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
kenperkins has joined #ruby
jitesh_shetty has joined #ruby
shaggy2dope has joined #ruby
charlenopires has joined #ruby
<rking> The Koans are great. If you want a similar thing but for regexes, join #regex, then /msg pork !help
<rking> I'm working through them now.
<species> maybe ill make pong first though
<species> thats always funny
blueadept` has joined #ruby
Synthpixel has joined #ruby
wallerdev has joined #ruby
byronb has joined #ruby
eywu has joined #ruby
jameshyde has joined #ruby
dwon has joined #ruby
booginga has joined #ruby
<Boohbah> species: i really like the ruby quizzes, but i haven't done the koans yet
mbriggs has joined #ruby
hobbyist has joined #ruby
byronb has joined #ruby
dnyy has joined #ruby
hobbyist has joined #ruby
davidcelis has joined #ruby
Rishi_ has joined #ruby
ninor has joined #ruby
SeanTAllen has joined #ruby
Zolrath has joined #ruby
<voodoofish430> how can I list out the headers of an http request when using Net::HTTP?
eywu1 has joined #ruby
eywu has joined #ruby
shevy2 has joined #ruby
Hsparks has joined #ruby
iamjarvo has joined #ruby
booginga has quit ["Leaving"]
wmoxam has joined #ruby
<senthil> voodoofish430: from within Net:HTTP or outside?
<frontendloader> http://bpaste.net/show/ISAz6OhxCzJzryaCPyBB/ this doesn't do what I had hoped (allow you to push_or_create into a key)
<voodoofish430> within I guess....it's from a response
<voodoofish430> I found a way though....to_hash
<voodoofish430> or response.to_hash
<senthil> frontendloader: h[:k] << "value", assumes :k is an array
<senthil> or string, you probably need h[:k] = "value"
ZAZEN_co1pute has joined #ruby
<frontendloader> thats what I was hoping h.default = [] would do, if a key doesn't exist, treat it like an array
<frontendloader> so I can push things into it whether it exists or not
<senthil> frontendloader: use fetch(:k, []) << "value"
<frontendloader> well put.
samgranieri has joined #ruby
<frontendloader> that doesn't appear to work either
wookiehangover has joined #ruby
ZachBeta has joined #ruby
samgranieri has joined #ruby
seanstickle has joined #ruby
<frontendloader> I guess the reference it gives you back isn't actually pointing at anything inside the hash
<senthil> frontendloader: specifics please
<senthil> frontendloader: oh right, umm
<frontendloader> if it did, any time you did a fetch with a default value, that value would get created in the hash I'm guessing
<senthil> frontendloader: store the result in another var, and then set that var to hash
<senthil> b = a.fetch(:k, []) << "value"
<senthil> a[:k] = b
<senthil> [] << "value" returns the entire array, so it should work
<frontendloader> even smarter
Sailias has joined #ruby
krusty_ar has joined #ruby
<senthil> Maybe you can create Hashes with default values
CannedCorn has joined #ruby
<senthil> frontendloader: a.default = []
MrGando has joined #ruby
<frontendloader> that was the original case in which it didn't work in the bpaste >_>
lgbr has quit [#ruby]
<frontendloader> a.default behaves exactly like fetch without storing in a temp var
<frontendloader> I'm going the temp var route
<senthil> nvm then, just use the other way
<frontendloader> thanks for the insight
samgranieri has quit [#ruby]
dfamorato has joined #ruby
tommyvyo has joined #ruby
EvanR has joined #ruby
rking has joined #ruby
rking has joined #ruby
wroathe has joined #ruby
samnang has joined #ruby
<wookiehangover> in rspec how do I check if a method has been called?
qos_ has joined #ruby
qos has joined #ruby
artOfWar_ has joined #ruby
qos_ has joined #ruby
<senthil> wookiehangover: should_receive(:method)
<wookiehangover> getting "undefined method" should_recieve
CheeToS has joined #ruby
<senthil> receive
<senthil> not recieve
<wookiehangover> senthil: haha just saw that
<wookiehangover> thanks
<Boohbah> i before e, except after c
<wookiehangover> I can't read, apparently
<wookiehangover> or remember rhymes
<Boohbah> english strikes again! :)
* wookiehangover retreats back into his shame-cave
<senthil> Boohbah: we need "EnglishLite" language, without all the silly rules from dead languages
phantasm66 has joined #ruby
freeayu has joined #ruby
h4mz1d has joined #ruby
<senthil> like receive, but receiving
<Boohbah> senthil: i disagree. rules from dead languages add flavor
<senthil> Boohbah: confusion if you ask me
Banistergalaxy has joined #ruby
redgetan has joined #ruby
charlenopires has joined #ruby
liluo has joined #ruby
<shadoi> "force push my package to anl"
<shadoi> actually just heard those words spoken.
<Spaceghostc2c> shadoi: Did you "TWHS"?
<shadoi> didn't have to, everyone cracked up
brngardner has joined #ruby
<Spaceghostc2c> Awesome.
stringoO has joined #ruby
nvez has joined #ruby
nvez has joined #ruby
adamkittelson has joined #ruby
kvirani has joined #ruby
ZachBeta has joined #ruby
charlenopires has joined #ruby
apok_ has joined #ruby
vjacob has joined #ruby
mattyoho has joined #ruby
Araxia has joined #ruby
Clordio has joined #ruby
Chryson has joined #ruby
nari has joined #ruby
patrick99e99 has joined #ruby
macmartine has joined #ruby
<patrick99e99> Hi ruby friends.. I am really stuck on an annoying problem.. Basically, I have a gem in a rails app that is ruining my life. It has a method called "setup" in a module which is destroying my I18n stuff during application initialization. I manually went into the gem and wrapped the setup methody body in an ActiveSupport::on_load(:after_initialize) block, and that fixed the problem.. So then I wanted to make my own initia
<species> ive installed rubygame via gem, and im wondering where to access the samples it comes with
<species> i guess the first step is determining if they were installed
<patrick99e99> and so-- I made an initailizer file and did module ActiveAdmin; def self.setup; puts "HELLO!"; end; end; --- and I never see hello...
<senthil> species: i use pry for that
<species> if I look at the project structure on github, the samples are in the same dir as the docs; is that useful to know here?
<senthil> species: "gem install pry; pry; gem-cd rubygame; .pwd; *copy output; exit; cd *paste.
nif has joined #ruby
<species> intersting
<senthil> patrick99e99: what do you mean initializer file?
huismon has joined #ruby
<species> that fails. ive run "gem install rubygame" but pry tells me "rubygame not found"
husimon___ has joined #ruby
<senthil> species: find the location of another installed gem with pry and then navigate with cd
radic_ has joined #ruby
dagnachewa has joined #ruby
<patrick99e99> senthil: rails_app/config/initializers/some_file.rb
td123 has joined #ruby
hydrozen has joined #ruby
sacarlson has joined #ruby
havenn has joined #ruby
hobbyist has joined #ruby
<havenn> Anyone know of a script that will minify Ruby code? (Just curious.)
Teddy2steper has joined #ruby
kevinbond has joined #ruby
lninyo has joined #ruby
shadoi has joined #ruby
<seanstickle> havenn: jrubyc
lninyo has quit ["Leaving"]
dbgster has joined #ruby
chico has joined #ruby
maletor has joined #ruby
robdodson has joined #ruby
dagnachewa has joined #ruby
dv310p3r has joined #ruby
hobbyist has joined #ruby
ed_hz_ has joined #ruby
<robdodson> could someone explain the difference between templates and partials to me..? i just started using Sinatra and I'm not quite sure where one would prefer one over the other. thank you!
stephenjudkins has joined #ruby
<Boohbah> robdodson: #sinatra might know
Banistertab has joined #ruby
<senthil> robdodson: are you talking about Rails templates or templates in general
strict9 has joined #ruby
<senthil> robdodson: partials are just half templates that you can include into other templates
<senthil> robdodson: say your header/footer, you put that in a partial and require them in other templates, so less duplication
ed_hz_ has joined #ruby
<robdodson> senthil: ok.. is it impossible to have a header/footer template which would do the same thing?
<strict9> Hello. Any idea why "@results.each do |r|" prints out results even if there's nothing in the loop at all, just an "end"? @results is an array of hashes
<robdodson> senthil: like could i require a header template inside an index template? if not then I understand why you would use a partial instead
<senthil> robdodson: partials are just a special term for templates that you reuse, its the same thing
scientes has joined #ruby
chioque has joined #ruby
<robdodson> senthil: ok cool thanks that makes sense
Teddy2steper has joined #ruby
robdodson has quit [#ruby]
robdodson has joined #ruby
savage- has joined #ruby
swittenkamp has quit [#ruby]
Banistertab has joined #ruby
robdodson has joined #ruby
robdodson has joined #ruby
blueadept` has joined #ruby
robdodson has quit [#ruby]
robdodson has joined #ruby
baroquebobcat has joined #ruby
codezombie has joined #ruby
robdodson has joined #ruby
robdodson has joined #ruby
robdodson has joined #ruby
freeayu has joined #ruby
josefig has joined #ruby
josefig has joined #ruby
ryan0x2 has joined #ruby
ed_hz_ has joined #ruby
redgetan has quit ["Leaving"]
tommyvyo has joined #ruby
mmokrysz has joined #ruby
seivan has joined #ruby
yoklov has joined #ruby
Bosma has joined #ruby
adeponte has joined #ruby
joaoh82 has joined #ruby
lewis has joined #ruby
lewix has joined #ruby
macmartine has joined #ruby
savage- has joined #ruby
k04n has joined #ruby
beilabs has joined #ruby
libertyprime has joined #ruby
cap10morgan has joined #ruby
abstrusenick has joined #ruby
rohit has joined #ruby
sub_stantial has joined #ruby
recycle has joined #ruby
deobald has joined #ruby
SpitfireWP has joined #ruby
Hsparks has joined #ruby
mdw has joined #ruby
Houdini has joined #ruby
sectionme has joined #ruby
Teddy2steper has joined #ruby
ABK has joined #ruby
rippa has joined #ruby
steg132 has joined #ruby
senthil has joined #ruby
hobbyist has joined #ruby
shaggy2dope has joined #ruby
nikhgupta has joined #ruby
Animawish has joined #ruby
<Animawish> i've got a program where I open a file (File::open) and later I use gets, but instead of asking for input in terminal, the gets just pulls the first line of the file
williamcotton has joined #ruby
zeroeth has joined #ruby
<Animawish> here's a gist of my program https://gist.github.com/2316868
banjara has joined #ruby
<Animawish> I don't understand why it's doing it or how to fix it
vandemar has joined #ruby
m_3 has joined #ruby
<shadoi> you probably want $stdin.gets
adamkitt_ has joined #ruby
phipes has joined #ruby
zeroeth has joined #ruby
<Animawish> thanks shadoi
ben225 has joined #ruby
Animawish has quit [#ruby]
<species> so im doing the ruby koans and im failing on this test: assert_equal 0, false.object_id
<species> ive got a seperate file with puts false.object_id and that gives me "0"
lkba has joined #ruby
<species> as a fixnum
<species> so how come its failing?
ABK has joined #ruby
deobald has joined #ruby
savage- has joined #ruby
<species> in fact, puts false.object_id == 0 gives me "true"
<species> this points to assert_equal doing something stupid
CheeToS has joined #ruby
<species> lol false alarm I hadn't saved the file >_<
hobbyist has joined #ruby
tommyvyo has joined #ruby
tommyvyo has joined #ruby
artm has joined #ruby
wallerdev has joined #ruby
nikhgupta1 has joined #ruby
MrGando has joined #ruby
ryanf has joined #ruby
kenneth has joined #ruby
gtuckerkellogg has joined #ruby
a_a_g has joined #ruby
<kenneth> hey, you know when you do `bundle gem` and it creates a directory structure for you, it goes through files if they're already there and offers to overwrite them, diff them, etc
<kenneth> is that a standard gem i can use in my own project, or should i re-invent the wheel
gokul has joined #ruby
Vert has joined #ruby
abionic has joined #ruby
Asher1 has joined #ruby
dwon_ has joined #ruby
Indian has joined #ruby
lewix has quit ["Leaving..."]
Indian has joined #ruby
nari has joined #ruby
Asher has joined #ruby
<kenneth> other question, in ruby, if i assign a block to a variable, is it aware of that variable in that scope
<kenneth> i.e., can i do `test = lambda { |arg| test.call(arg+1) }`, use a lamda recursively
neurotech has joined #ruby
sacarlson has joined #ruby
eldariof has joined #ruby
gtuckerkellogg has joined #ruby
kenichi has joined #ruby
rckts has joined #ruby
sam113101 has joined #ruby
indeterminate has joined #ruby
djdb has joined #ruby
<rippa> kenneth: yes you can
x0F_ has joined #ruby
jankly has joined #ruby
vectorshelve has joined #ruby
nfluxx has joined #ruby
phantomfakeBNC has joined #ruby
geekygator has joined #ruby
sspiff has joined #ruby
andrewhl has joined #ruby
BrianJ has joined #ruby
kawa_xxx has joined #ruby
Helius has joined #ruby
nfluxx_ has joined #ruby
shruggar has joined #ruby
Clordio has joined #ruby
mistergibson has joined #ruby
senthil has joined #ruby
alem0lars has joined #ruby
<mistergibson> I'm attempting to work with File and IO modes numerically. to set 'wb' do I ( File::Constants::WRONLY + File::Constants::BINARY ) ? xor? anyone know?
stephenjudkins has joined #ruby
nikhgupta1 has quit [#ruby]
arturaz has joined #ruby
arturaz has joined #ruby
seivan has joined #ruby
liluo has joined #ruby
shtirlic has joined #ruby
zeroeth has joined #ruby
Houdini has joined #ruby
alup_ has joined #ruby
apeiros_ has joined #ruby
io_syl has joined #ruby
Akuma has joined #ruby
stephenjudkins has joined #ruby
c9s has joined #ruby
LMolr has joined #ruby
JohnBat26 has joined #ruby
Helius has joined #ruby
artm has joined #ruby
InBar has joined #ruby
seivan has joined #ruby
neersighted|AFK has joined #ruby
trivol has joined #ruby
davidpk has joined #ruby
vectorshelve has joined #ruby
yxhuvud has joined #ruby
<RubyPanther> mistergibson: Foo ^ Bar
looopy has joined #ruby
<mistergibson> RubyPanther: thx :)
<_ack> I think you need and (|) not xor for that.
johndbritton has joined #ruby
<mistergibson> oh?
<_ack> I meant to say or.
<_ack> mistergibson you are trying to put together those constants right?
ukwiz has joined #ruby
<mistergibson> yup
d3c has joined #ruby
zeroeth has joined #ruby
<_ack> well that in C/stdlib file api is done by or'ing them together. So later on can be checked by doing somthing like if (flag & BINARY), if (flag & WRONLY), etc..
<mistergibson> _ack: ok, I see -- thanks
mrmist_ has joined #ruby
ben225 has joined #ruby
DuoSRX has joined #ruby
ephemerian has joined #ruby
KL-7 has joined #ruby
kawa_xxx has joined #ruby
ben225 has joined #ruby
BiHi has joined #ruby
nemesit has joined #ruby
nemesit|osx has joined #ruby
bhavesh_a_p has joined #ruby
Asher has joined #ruby
timonv has joined #ruby
trivol has joined #ruby
<shevy2> when will there be ruby 2.0?
<apeiros_> it came out yesterday. didn't you read the news?
snearch has joined #ruby
roolo has joined #ruby
<shevy2> :(
trivol has joined #ruby
<RubyPanther> shevy: yugui already said, next is 1.9.4, and then 2.0. And it will be less change than 1.8->1.9
<RubyPanther> so probably 6 months or more
<shevy> aha
<shevy> okay
maasha has joined #ruby
<maasha> Hey, do we have a constant for the number of bits in uint64_t ?
<apeiros_> eh, are you serious?
<apeiros_> uint64_t says it's 64bit…
<RubyPanther> That means it can hold a 64 bit number, it doesn't mean it isn't actually bigger though, right?
<maasha> apeiros_: well, I guess I meant what is the size of unsigned int? that depends on OS.
<maasha> or CPU
<apeiros_> maasha: no, if you say uint64_t you explicitly request a 64bit wide integer
<RubyPanther> Normally you don't care unless you're writing a C extension, and then you can check in C
<maasha> that is why we have uint64_t, no?
<apeiros_> and by stating you want it unsigned, you just say that you don't want an initial 1 to mean the number is negative.
<maasha> RubyPanther: I am fiddling with Inline C.
<apeiros_> so an uint64_t will always have 64bits. otherwise it is not an uint64_t
BiHi has joined #ruby
<maasha> apeiros_: right. but does ruby have a constant for the size of int?
<apeiros_> why would ruby have one? ruby doesn't expose architecture internals…
<apeiros_> sizeof(int) in C
<Mon_Ouie> Ruby can deal with arbitrarily large integers transparently
two- has joined #ruby
bier has joined #ruby
<maasha> apeiros_: I wanted a bitmap encoded as an array of uint64_t, but the easy way is to initialize that as a ruby string - I just need the size of the int for correct padding.
<maasha> so a mix of Ruby and C using inline ...
<apeiros_> maasha: you realize that int != uint64_t ?
<maasha> i need blocks of 64 bits for my bit map.
<maasha> happens to be unsigned int on my mac.
<apeiros_> …
<maasha> not portable, though. on a 32 bit system it will go haywire.
vandemar has joined #ruby
kawa_xxx has joined #ruby
batmanian has joined #ruby
blacktulip has joined #ruby
ABK_ has joined #ruby
emilkarl has joined #ruby
havenn has joined #ruby
scientes has joined #ruby
<mistergibson> maasha: can you use two uint32 in tandem?
scientes has joined #ruby
<mistergibson> if it is merely a bitmap basket
d3vic3 has joined #ruby
<mistergibson> sounds like some hooley you can pull in the .h
ikbenhet has joined #ruby
lessless has joined #ruby
trivol_ has joined #ruby
Brendan_ has joined #ruby
quest88 has joined #ruby
sgronblom has joined #ruby
<sgronblom> Does it really make sense for every HTTP response status code to be a subclass of HTTPResponse?
<sgronblom> Why aren't the codes just simple constants?
riginding has joined #ruby
<apeiros_> it's not the status codes that are subclasses
<apeiros_> the whole response is
<sgronblom> That's true. But still?
<apeiros_> and yes, it makes sense
seivan has joined #ruby
<apeiros_> enables a couple of possibilities in dealing with the response. also enables to add custom methods for different responses.
<apeiros_> doesn't mean it's the only meaningful way to deal with those problems.
<sgronblom> but do the classes take advantage of that?
<apeiros_> why don't you just open the source code and see?
<sgronblom> well I'm checking out the docs
Gekz has joined #ruby
Gekz has joined #ruby
Gekz has joined #ruby
Gekz has joined #ruby
<mistergibson> its seems the philosophy with Ruby is: the source *is* the documentation
<sgronblom> yeah and even then figuring out what parameter to give to Net::HTTPResponse's constructor is unclear
<sgronblom> Because whee, lib/net/http.rb is a single file of 2.2kloc with multiple classes
<sgronblom> Internal use only
<sgronblom> So how did they expect me to create a response if I am mocking net http?
<vectorshelve> I have an rspec test case -> https://gist.github.com/2318432 which I recorded using selenium IDE... I added into my Gemfile installed gem rspec rails and selenium-webdriver. When I run rspec from the console a firefox window pops up stays there for a while and exits...the error message I am getting is -> https://gist.github.com/2318427 please help with where am I going wrong.. thanks
<vectorshelve> The test cases are running properly while I ercorded it in the Selenium IDE and re ran it... I then exported it to rpsec... Now I am having trouble running the test cases from rpsec.. please help me get it right.. thanks
mengu_ has joined #ruby
spasbot has joined #ruby
__main__ has joined #ruby
pkkm has joined #ruby
__main__ has joined #ruby
Spring___ has joined #ruby
<pkkm> Hello. I need to execute an external program from a Ruby script. I don't need its output. Should I use %x[/path/to/program arg1 arg2], system("/path/to/program arg1 arg2") or system("/path/to/program", "arg1", "arg2")?
<matled> pkkm: should the output be printed to stdout anyway?
<pkkm> matled, I don't care, the program I want to call doesn't print anything to stdout.
<matled> pkkm: I prefer any method that takes the command arguments as separate arguments, like system. if the arguments are static that's not so important but it's very helpful if the arguments are dynamic.
<matled> pkkm: in this case I'd use system.
<pkkm> matled, I don't need to escape arguments when using system("/path/to/program", "arg1", ...), right?
<matled> pkkm: no, the arguments are passed as they are to the program
<pkkm> matled, OK, thanks for help.
<matled> pkkm: system("/path/to/program arg1 arg2") is actually system("sh", "-c", "/path/to/program arg1 arg2") and sh will interpret the string. therefore you need to take care of the arguments when passing them as a single string
ddoucette has joined #ruby
CodeFriar has joined #ruby
shell0x_ has joined #ruby
SPYGAME has joined #ruby
looopy has joined #ruby
<sgronblom> The "joy" of TIMTOWDY :)
kaiwren has joined #ruby
rushed has quit [#ruby]
crazed has joined #ruby
akem has joined #ruby
Jackneill has joined #ruby
<artm> what's a vim script to auto insert 'end' where appropriate?
ben225 has joined #ruby
zeroeth has joined #ruby
iocor has joined #ruby
aibo has joined #ruby
bwwrd has joined #ruby
<artm> ah, found it
etehtsea has joined #ruby
sohocoke has joined #ruby
abionic has joined #ruby
liluo has joined #ruby
KL-7 has joined #ruby
ABK has joined #ruby
kaiwren has joined #ruby
ABK_ has joined #ruby
KL-7 has joined #ruby
falena has joined #ruby
<pkkm> Is there a shortcut for things like 'if my_string == "option1" or my_string == "option2" or my_string == "option1" or my_string == "option4"' ?
<apeiros_> if options.include?(my_string) then
<rippa> if [o1,o2,o3,o4].include? my_string
<pkkm> Thanks
mcwise has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
byronb has joined #ruby
davidcelis has joined #ruby
<Mon_Ouie> string.start_with? "option" and string[-1].between? "1", "4"
<Mon_Ouie> Ok, doesn't work actually
Rishi- has joined #ruby
<apeiros_> my_string =~ /\Aoptions[1-4]\z/
<apeiros_> my_string =~ /\Aoption[1-4]\z/ # whoopsie, an 's' too much…
LMolr has joined #ruby
orbus5 has joined #ruby
alem0lars has joined #ruby
Rishi_ has joined #ruby
<canton7> apeiros_, hrm. His passes for 'optionyay1', yours fails
kirun has joined #ruby
<orbus5> Hi.. why does nil print from my object? http://dpaste.com/727729/
<apeiros_> canton7: "his" you mean Mon_Ouie's? I stick to pkkm's original "spec"
<apeiros_> canton7: and that didn't include optionyay1
<canton7> aah oops, I missed that. My bad
<apeiros_> orbus5: yay, start with properly indenting your code
<apeiros_> it's a PITA to read such code…
<apeiros_> orbus5: puts disc[1].display <-- why `puts` there?
<orbus5> ah guess I dont need to put it since its a method anyway
<apeiros_> wrong reason, correct conclusion…
waxjar has joined #ruby
<apeiros_> correct reason: you don't need to puts there because your display method already puts.
<rippa> why can't people just gg=G
gokul has joined #ruby
<apeiros_> reason for nil being printed: display returns nil. so puts disc[1].display --> puts nil --> which prints nil
<orbus5> newbism?
<apeiros_> rippa: not everybody uses an OS as editor :-p
<orbus5> great thanks, I'll clean up the indents
<orbus5> it works now of course, no nil
<apeiros_> orbus5: discs.to_i --> discs.size
greenarrow has joined #ruby
<apeiros_> oh, it seems…
<apeiros_> where does discs come from?
JohnBat26 has joined #ruby
<orbus5> apeiros_: coding tower of hanoi for practice
<apeiros_> orbus5: I meant the variable :)
<apeiros_> you never assign to it in the pasted code
<orbus5> its before the class, discs = gets
<apeiros_> I'd do the to_i there then, once. instead of every iteration.
<apeiros_> I'd also use Integer(gets) instead of gets.to_i
<apeiros_> that'll raise if the user enters something that is not an integer
<apeiros_> Integer(gets, 10) if you want to enable entries like 009 (Integer would consider it to be octal otherwise)
davidpk has joined #ruby
steg132 has joined #ruby
pshah1 has joined #ruby
bawerd has joined #ruby
<pshah1> hi
<pshah1> hello
<pshah1> pls reply hi
pshah1 has joined #ruby
<pshah1> hiiiiii
<apeiros_> hi
pshah1 has joined #ruby
<apeiros_> pshah1: yes, your irc client works…
<pshah1> hi
<pshah1> means ur work is irc
nari has joined #ruby
pshah1 has joined #ruby
<apeiros_> pshah1: stop joining & parting every minute.
rohit has joined #ruby
<pshah1> y?
<pshah1> stop joining & parting every minute
pshah1 has joined #ruby
<Afal> [6~+
strife25 has joined #ruby
fr0gprince_ has joined #ruby
<vectorshelve> when I start my test cases using rspec command the browser pops up and asks for proxy username and password... I cant type it over the field.. so the test case fails eventually... how can I get out of this issue ?
arussel has joined #ruby
<arussel> I have a Hash my_hash = {"foo" => "bar"} , and a string "ddd#{foo}", and I would like to output the string as "dddbar". How can I do this ?
<apeiros_> arussel: use %{foo} instead of #{foo}
<apeiros_> then you can use String#%: "ddd#%{foo}" % {"foo" => "bar"}
<arussel> nice, what is the english name for this operation ?
<apeiros_> oh, seems that wants the keys of the hash to be a symbol too
<rking> Perl has -mre=debug, which shows its interpretation of your regex as an indented tree. Is there a similar Ruby tool?
<apeiros_> sprintf with keywords
<apeiros_> "ddd%{foo}" % {:foo => "bar"} # => "dddbar"
<arussel> apeiros_: no sprintf, I don't know the variable used
<arussel> apeiros_: nice, thanks.
ofcan has joined #ruby
nanderoo has joined #ruby
<arussel> apeiros_: works perfect, thanks again.
<apeiros_> arussel: you asked for the name, I told you the name.
<ofcan> what is the best ruby cheatsheet/ poster/ reference/ overview? with object hierarchy, common mehtods, all in color, layed out nice and clearly?
alem0lars_ has joined #ruby
<arussel> apeiros_: I thought you were offering another solution based on printf :-)
<apeiros_> my brain :-p
<apeiros_> arussel: String#% *is* sprintf
<apeiros_> a % [b,c,d] --> sprintf(a, *[b,c,d])
<apeiros_> a % b --> sprintf(a, b)
lolmaus has joined #ruby
<lolmaus> Reading the Pickaxe. Got a question. There's a sample method like this: def price_in_cents; Integer(price*100 + 0.5); end
<lolmaus> "price" is a local variable, it's not defined!
<rking> lolmaus: That's not in the context of some class that has a "def price"?
<apeiros_> lolmaus: it can also be a method
<apeiros_> ruby doesn't require you to add parens to call a method. i.e., foo() and foo are equivalent
<lolmaus> rking, apeiros_: ah! I thought i should point to it like self.price... But then it would be a class method, not an instance one?
<apeiros_> (a local variable `foo` however will take precedence over a method `foo` if you just write `foo`)
<apeiros_> lolmaus: no, self.foo is a longer way of saying foo
<apeiros_> self.class.foo would call the class method foo
<lolmaus> apeiros_, so i should use self.foo for method when i have both a method and a local variable with the same name?
<apeiros_> I prefer foo()
<lolmaus> Oh
<apeiros_> note that self.foo will not work with private methods
<lolmaus> apeiros_, while foo() will?
<apeiros_> yes
dotemacs has joined #ruby
<lolmaus> Nice! Thanx for sorting that out
<apeiros_> private in ruby means "no explicit receiver" (even if that receiver is self, which would be allowed in other languages)
<apeiros_> lolmaus: also, if you have arguments, that counts as unambiguous too. so `foo = "hi"; foo "bar"` will work.
<lolmaus> apeiros_, unless i had a "foo=" method? ;)
<apeiros_> no
<apeiros_> foo = "bar" will *always* assign to the lvar foo
<lolmaus> Okay
<apeiros_> foo= methods must be invoked with a receiver
`brendan has joined #ruby
<lolmaus> So, foo=("bar") then?
<apeiros_> no
<apeiros_> self.foo = "bar"
<Mon_Ouie> No, self.foo = "bar", which works even if foo= is private
<lolmaus> OMFG
<apeiros_> Mon_Ouie: wha? they special cased that?
<lolmaus> Now i'm confused
<apeiros_> great…
<Mon_Ouie> Yes
<apeiros_> lolmaus: understandable…
<apeiros_> that's stupid IMO. should make that the same for all methods.
<lolmaus> So self.foo is also valid for private?
<Mon_Ouie> No, that's only for setters= methods
<lolmaus> =-O
<Mon_Ouie> Because there's no way to call them without an explicit receiver
<rippa> send
<lolmaus> Why is `foo=("bar")` invalid?
<Mon_Ouie> That's explicit
<rippa> at least it's not special case
<Mon_Ouie> foo = ("bar") is valid, but it's different
<mistergibson> lolmaus: for a private method, simply call the method with no receiver
<Mon_Ouie> It sets the local variable foo to "bar"
<mistergibson> as if it were a keyword of the language
<lolmaus> mistergibson, we've been discussing a case with a local variable with the same name as the method. The variable would prevent you from calling the method implicitly.
<rking> Wait, I am thinking foo=("bar") is allowed, same as foo = "bar"
_null has joined #ruby
<mistergibson> lolmaus: oic, ok
_null has joined #ruby
<ofcan> rking: hello mate :)
<rking> Howdy. =)
<lolmaus> Mon_Ouie, so why can't i use `foo=("bar")` to call a private method?
<rking> ofcan: Did F10 work?
<ofcan> rking: will test your silly printing yellow code now :)
<rking> =P
_null has joined #ruby
_null has joined #ruby
_null has joined #ruby
<rippa> lolmaus: because it assigns to a local var
d3c has joined #ruby
_null has joined #ruby
<lolmaus> rippa, oh... simple assignment is a method itself >_<
<apeiros_> no
_null has joined #ruby
<apeiros_> assigning to variables is not a method.
<lolmaus> Is it equal to `foo.=("bar")`?
<apeiros_> no
<rippa> no
<rippa> assignment is hardcoded
_null has joined #ruby
Foxandxss has joined #ruby
<lolmaus> rippa, hardcoded with parenthesis too?
<rippa> yes
_null has joined #ruby
jbw has joined #ruby
<lolmaus> rippa, so it kinda imitates a method?
<rippa> foo= is always an assignment
_null has joined #ruby
<rippa> foo.bar= is a mthod call
_null has joined #ruby
<LMolr> what about hsh[key] ||= value ? I am trying to figure out how it works.
_null has joined #ruby
SoKoot has joined #ruby
_null has joined #ruby
<lolmaus> rippa, but i can create a method with a name "=", right?
iamjarvo has joined #ruby
_null has joined #ruby
<rippa> no
_null has joined #ruby
Squarepy has joined #ruby
_null has joined #ruby
Squarepy has joined #ruby
_null has joined #ruby
SoKoot has joined #ruby
<rippa> funny
<SoKoot> hi
_null has joined #ruby
<rippa> def d=; end; self.d=() # error
<rippa> ArgumentError: wrong number of arguments (1 for 0)
<apeiros_> actually, you can
_null has joined #ruby
<lolmaus> I'm so confused :(
<apeiros_> o = Object.new; o.define_singleton_method := do "weee!" end; o.send(:'=') # => "weee!"
<apeiros_> you just will never be able to call it without send.
_null has joined #ruby
gokul has joined #ruby
<lolmaus> OMGF
SoKoot has quit [#ruby]
_null has joined #ruby
<rippa> SyntaxError: unexpected keyword_end, expecting $end
pu22l3r has joined #ruby
<rippa> o = Object.new; o.define_singleton_method :'=' do "weee!" end; o.send(:'=') # => "weee!"
<rippa> works
_null has joined #ruby
FeLove has joined #ruby
_null has joined #ruby
gokulnath has joined #ruby
<apeiros_> rippa, yeah, copied the wrong line
linduxed has joined #ruby
fr0gprince_mac has joined #ruby
delinquentme has joined #ruby
kaiwren has joined #ruby
gokul has joined #ruby
<delinquentme> im looking for an example list of applications where recursion functions happen to be exceedingly more effective than comparison non-recursive algos
<Mon_Ouie> You can always rewrite the recursive program iteratively by using an array or something similar instead of using the call stack
mattyoho has joined #ruby
<rking> delinquentme: I default to recursion when I have to walk a tree of data. In my opinion it comes out simpler than trying to manually keep track of the stack.
<delinquentme> rking, wise.
CodeFriar has joined #ruby
Natch| has joined #ruby
sbanwart has joined #ruby
tommyvyo has joined #ruby
<apeiros_> walking directories, parsing (not all grammars), searching/printing hierarchical data
davidd___ has joined #ruby
<lessless> somebody have yesterdays talks log? :)
<delinquentme> rking, you want me to tweet that at you:D
<delinquentme> im about to post it
kvirani has joined #ruby
<rking> delinquentme: Hehe, nah. Thanks though. =)
<rking> delinquentme: I don't want the FBI knowing I like to program.
<delinquentme> HA awesome
<rking> Hehe
<delinquentme> i can claim that as my own!
tommyvyo has joined #ruby
linoj has joined #ruby
<arussel> how can I say I want to use File from io and not from another module ?
hobbyist has joined #ruby
<apeiros_> ::File
<rking> Is there maybe a gem that will cause Ruby to display the internal regex parse? I'm trying to find a ruby equivalent of perl -mre=debug
<apeiros_> rking: you can recompile ruby with onigiruma debug flags
geekbri has joined #ruby
<rking> Though seeing the regex parse would only get me half-way to the functionality -f pmre=debug, it also shows the execution of the matching/failing
<tommyvyo> rking- www.rubular.com
<rking> apeiros_: Hrm, interesting.
<arussel> apeiros_: thanks
<apeiros_> that article might be of interest to you
<rking> tommyvyo: Heh, actually. I'm working on a vim port of rubular.com So far it's coming along really well, but I'm trying to add a \d command for when you get stuck.
<tommyvyo> oyyyy!
<rking> apeiros_: Oh, excellent. I don't think I'll be able to solve the immediate problem with this, but it's still something I want to know about.
silverhand has joined #ruby
<silverhand> What's the best way to get "ModelName" into "model_name"? I've been trying with gsub for half an hour and I can't get it without having to reverse and chop and reverse again to remove a leading underscore.
td123 has joined #ruby
<rking> silverhand: Hrm, good question..
shaggy2dope has joined #ruby
dbgster has joined #ruby
<silverhand> canton7: Thanks! It seems there is already a function built into Rails. :)
<ofcan> rking: f10 doesn't work :)
<rking> ofcan: Change the "!chrome --print" to "!echo chrome --print" and tell me what it says. In #vim
dql has joined #ruby
<rking> ofcan: And this is no time for :), this is time for :|
zeroeth has joined #ruby
<silverhand> How can I create a new method object, and pass it arguments?
<ofcan> rking: i have this, and it does nothing... :map <f10>:TOhtml<cr>:%/#ffff00/#aaaa00/g<cr>:w<cr>:!echo chrome --print %<cr>
<rking> ofcan: You're missing the space after <f10>, and #vim
Mohan has joined #ruby
* rking covers the eyes of the poor TextMate users.
<ofcan> rking: ah, ok, switching to #vim
wroathe has joined #ruby
wmoxam has joined #ruby
<rking> OK guys, I'm doing a small exercise to get better at exploring implementations, stemming from the discussion about RoR's "underscore". I am in pry, and I did 'gem "rails"' ...but now I can't cd to ActiveSupport
<rking> How do I get the ActiveSupport to be loaded?
<wroathe> require 'rubygems'
<wroathe> require 'activesupport'
<rking> I tried that, but: LoadError: cannot load such file -- activesupport
<rking> It behaves the same from irb and also directly to ruby.
<wroathe> require 'active_support'
<rking> Also, I don't have to say require 'rubygems'... I can do gem 'rails' right away. How come?
ryanlabouve has joined #ruby
fmcgeough has joined #ruby
<rking> wroathe: Oh, duh. Thanks. =) I should have run .underscore on it! =D
<wroathe> I didn't actually check before I typed those :P
<wroathe> You forced me to not be lazy.
mrwalker has joined #ruby
<rking> Do you happen to know the answer to the "not having to do require 'rubygems'" thing?
CannedCorn has joined #ruby
<rking> BTW: Run pry then type "get-naked". Weird.
jankly_ has joined #ruby
<apeiros_> lol?
<apeiros_> but taking off the clothes of a pretty girl is pretty much the definition of "having a good time" :D
<matti> Um.
<matti> Or killing space aliens in Crysis 2
bbttxu_ has joined #ruby
<apeiros_> or sending masses of zerg into their certain death :D
<matti> Yes!
<matti> Zerg Rush \o/
<canton7> pry/lib/pry/default_commands/easter_eggs.rb for more
<rking> If you want to ruin the surprises I found the rest in .,,/pry-0.9.8.4/lib/pry/default_commands/easter_eggs.rb
* rking looks at canton.
<canton7> win! :)
<rking> lose. =(
* apeiros_ declares canton7 the winner
<apeiros_> you won you one internet! congratulations!
<canton7> and there was much rejoicing
<apeiros_> you won yourself?
<apeiros_> meh, I really have to take the advanced or proficiency :-/
* canton7 is one internet
<apeiros_> s/is/has/
* canton7 won one internet... and won himself :P
<apeiros_> -.-
* apeiros_ turns off the internet
<rking> NOO!!
emmanuelux has joined #ruby
* rking hopes you an read this message, still. Please do not turn off the internet.
<apeiros_> I already turned it off.
<apeiros_> the internet is that blue thingy that looks a bit like an 'e', right?
<apeiros_> damit, why is it not enough that I reinvent other's wheels? why do I have to reinvent my own ones too? >:-(
<apeiros_> others'
riginding has quit [#ruby]
tk___ has joined #ruby
<canton7> NIHAN
<canton7> (not invented here and now)
<apeiros_> NRR - not recently reinvented
<rking> NIQE - Not Invented Quite Enough
<apeiros_> oooh, nice
* apeiros_ goes back and reinvents a bit
<Spaceghostc2c> NIL - Not Invented Lethargically
netrealm has joined #ruby
strife25 has joined #ruby
<matti> We should have
<matti> NFW
<matti> foo == nfw
<matti> NFW -- No F* Way
CannedCo_ has joined #ruby
<Spaceghostc2c> FUCK - Further Understanding Convinces the Knowledgeable
headius has joined #ruby
<matti> Spaceghostc2c: Wooo...
* matti takes a note.
<matti> Spaceghostc2c: Profound!
qos has joined #ruby
<rking> NoMethodError: undefined method `convince' for #<Knowledge:0x2342234>
<apeiros_> try .stubborn?, if it returns true, just run .convince until .convinced?
<matti> Haha
<matti> apeiros_: +1
actwitty_ has joined #ruby
<actwitty_> thanks to rails for bringing up www.actwitty.com - the complete you !!! I am live for invites to private beta!
<Spaceghostc2c> actwitty_: Cool! And nice domain.
<apeiros_> actwitty_: so basically you enable normal users to know what dataminers know about us already? :)
silverhand has joined #ruby
yoklov has joined #ruby
alek_b has joined #ruby
steg132 has joined #ruby
phantasm66 has joined #ruby
jgarvey has joined #ruby
asteve_ has joined #ruby
d3c has joined #ruby
<shevy> dataminers know that swiss like chocolate
<asteve_> me still no understand self
<Spaceghostc2c> asteve_: Self is the current object in scope.
<asteve_> why would I create a method with self.?
<matti> asteve_: Then, join #psychology.
<Spaceghostc2c> matti: Oh clevar.
<matti> asteve_: Then will help you with understanding oneself ;]
<Spaceghostc2c> asteve_: Get the metaprogramming ruby book.
<Spaceghostc2c> That'll explain why.
<shevy> asteve_ you create a class method that way
<matti> Spaceghostc2c: Sorry, could not resist myself.
<Spaceghostc2c> It was lulzy.
<Spaceghostc2c> Especially since ##psychology wouldn't help anyone.
<Spaceghostc2c> asteve_: That's the one!
schaerli has joined #ruby
<Spaceghostc2c> Worth every penny
imsplitbit has joined #ruby
<asteve_> shevy: what is the benefit of a class method?
<shevy> asteve_ you can use it without having to type .new
<actwitty_> Spaceghostc2c: thanks!!
<Spaceghostc2c> asteve_: Something you'll learn in the Metprogramming ruby book!
<Spaceghostc2c> actwitty_: No wowries. :D
<shevy> asteve_ rails uses that a lot
<asteve_> shevy: saved memory or something?
<Spaceghostc2c> Nope.
<shevy> asteve_ who said that?
<asteve_> why not typed .new then?
<asteve_> type*
<shevy> because you dont need to instantiate an object for it
<Spaceghostc2c> You should invest in yourself by going and reading some documentation and books!
<shevy> but I wonder
<shevy> "saved memory" ... from where are you coming with this?!?!
<Spaceghostc2c> shevy: Because you have the object already!
<Spaceghostc2c> The class is an object!
<shevy> this is not "Lightning speed C." This is ruby
<asteve_> shevy: if you don't need to instantiate an object you've saved memory
<matti> Spaceghostc2c: So, if you want peace with self and understand self. Does this fall under what Freud was teaching? ;]
<shevy> ..
<shevy> please asteve_ go and use C
<Spaceghostc2c> matti: I try to not.
<shevy> you will save 1000% memory that way
<apeiros_> asteve_: an example for class methods: Date.civil(year, month, day), Date.ordinal(year, day_of_year), Date.commercial(year, week, day_of_week)
<shevy> think of all the trees you save that way asteve_
<shevy> and children
<shevy> will anyone think of the children?!
<apeiros_> asteve_: all of these will invoke Date.new at one point, but they'll do the conversion of the values for you to pass the correct values to Date.new
andrewhl has joined #ruby
EvanR has joined #ruby
schaerli_ has joined #ruby
schaerli_ has joined #ruby
davidpk has joined #ruby
Gesh has joined #ruby
wmoxam has joined #ruby
asteve_ has quit [#ruby]
joaoh82 has joined #ruby
baroquebobcat has joined #ruby
yoklov has joined #ruby
pyreal has joined #ruby
Foxandxss has joined #ruby
<shevy> TheSmallestRailsApp.initialize! rescue false
<shevy> ^^^ who likes this?
internet_user has joined #ruby
CheeToS has joined #ruby
ABK_ has joined #ruby
dfamorato has joined #ruby
VegetableSpoon has joined #ruby
akem has joined #ruby
lyn4xliu has joined #ruby
niku4i has joined #ruby
RegEchse has joined #ruby
seivan has joined #ruby
<rking> ofcan and I were talking about ways to explore the builtin classes. I like to use "ri Array\#each", or else drop into irb or pry and try it out.
<rking> I think there's a way to make pry show more about the builtins.
<apeiros_> in pry: `? Array#each`
<rking> Oh, cool.
<apeiros_> `$ Array#each` if you want the source-code
<ofcan> yea, I'm new and would find it very useful to explore ruby object hierarchy
<apeiros_> needs an additional installation iirc
<rking> pry is my new <3. It can do show-method Array#each and show rb_ary_each().
<rking> oh, $. Even better.
<apeiros_> $ == show-method
<rking> apeiros_ is my new <3, too.
* apeiros_ is either people's <3 or ..I..
<gogiel> rking: gay
<rking> gogiel is my super<3.
<ofcan> pry... oh god, another thing to pick up on :)
* apeiros_ kick gogiel using that as derogatory is not tolerated
gogiel was kicked from #ruby by apeiros_ [using that as derogatory is not tolerated]
* apeiros_ fail
<rking> ofcan: Definitely worth it. It's powerful.
gogiel has joined #ruby
<ofcan> ive begun to learn programming 2 months ago... now battling with linux, ruby, rails, vim... what the hell, who's counting... pry learning it is :)
<gogiel> lol. political correctness ftw
<apeiros_> gogiel: nothing to do with political correctness.
<rking> apeiros_: OK, I give up. What is a ..I..?
<apeiros_> rking: think of a hand, 5 fingers in a specific gesture…
schaerli has joined #ruby
<rking> ofcan: I am in a similar situation -- I've been away from programming for 5-6 years and am now getting back into it seriously.. the amount of new stuff is overwhelming (but exhilarating)
<rking> apeiros_: I see.
ABK_ has joined #ruby
<rking> Hrm... now I wonder how you follow the C calls around in pry. rb_ary_each() is short, and makes me want to read rb_yield()
<shevy> ofcan the object model is quite simple
<shevy> basically the core of things is class Object
<rking> But $ rb_yield doesn't work.
kevinbond has joined #ruby
<rking> I guess vim -t rb_yield. =)
jlebrech has joined #ruby
<ofcan> any extra clarification on how classes, modules, objects interact, and how various variables and methods work withing them is more than welcome :)
nacengineer has joined #ruby
<Spaceghostc2c> rking: The guy who made pry is in here I think.
timonv has joined #ruby
<ofcan> you don't need to guide me by the hand... just show me the way :)
<VegetableSpoon> Hi, I'm a lurker and just discovered pry because of you. Thanks :P
<rking> ofcan: That is a rather broad set of questions.
<apeiros_> Spaceghostc2c: yes, it's banisterfiend
<shevy> ofcan, there really is not that much to understand really, it is not so complicated
<Spaceghostc2c> apeiros_: I know who it is, I wasn't going to highlight him though, kinda potential help vampirey, isn't it?
zeroeth has joined #ruby
<rking> VegetableSpoon: Awesome! Hehe.. ofcan and I were talking about this in #vim, and we decided to bring it here for reasons exactly like that.
<shevy> I think all of ruby class hierarchy can go on one .pdf (one page)
<Spaceghostc2c> He's not even her atm.
<Spaceghostc2c> So I guess not.
<shevy> ofcan, and all of the exceptions can be visualized like this :P http://objectgraph.rubyforge.org/hierarchy_dotOG.html
<ofcan> yup, but just a global overview... a cheatsheet if you will
<Spaceghostc2c> ofcan: Get this: It's all dynamic. :D
<shevy> so you see here that StandardError is the mother of all errors
<shevy> hmm
<shevy> not sure if there is a cheatsheet
<shevy> but look at zenspider quickref anyway
<apeiros_> Spaceghostc2c: oh, I think banister can deal easily with vampires :)
<Spaceghostc2c> apeiros_: I was protecting the vampires. :p
<apeiros_> but yeah, I understand your motivation
<apeiros_> rofl
luxurymode has joined #ruby
<shevy> vim users make me sad
<shevy> why use vim when you have emacs :>
<Spaceghostc2c> Because I don't need >1million keyboard shortcuts.
gokul has joined #ruby
<ofcan> loving the graphical visualisation of error hierarchy... anything like that for whole Ruby ? :)
kpshek has joined #ruby
<ofcan> studying architecture, I've come to love graphical visualisations :)
<rking> shevy: Fair warning, I am vulnerable to all forms, currencies, and denominations of trollbait.
<shevy> what bait
<shevy> vim vs. emacs is unfair
<shevy> you can't win against an OS
<Spaceghostc2c> shevy: I hear they're thinking of renaming Emacs to GINABL
<Spaceghostc2c> GNU Is Not A BootLoader
<shevy> hmm
<Spaceghostc2c> :DDD
<rking> shevy: Well, that is part of the philosophical difference, yes. The Unix way is small tools that do their job well. So yes, to use vim you need to also use ctags, grep, etc.
<shevy> that reminds me... I still have to setup grub2 one day... but I am so lazy :(
neurotech has joined #ruby
<shevy> omg the unix way...
<shevy> the philosophy that allowed the creation of perl
<shevy> because it all was an inconsistent and incoherent mess that it could spawn the chaotic language that is perl
<shevy> :(
<ofcan> any good pry tutorials? just watching http://railscasts.com/episodes/280-pry-with-rails?view=comments and its awesome
sectionme has joined #ruby
<shevy> my favourite pry tutorial is to ask banister :)
dql has joined #ruby
<shevy> is that the one by josh?
<Spaceghostc2c> Lawl.
ABK_ has joined #ruby
<Spaceghostc2c> His name is Ryan.
<rking> shevy: Chaos is an ebb and flow. Perl tied together various idioms as a polyglottish thing, but then it birthed Ruby.
<shevy> hmm then perhaps I mean another screencast
<Spaceghostc2c> rking: Which made sense of it all.
<shevy> hmm isnt that the speaker who also spoke about why failure is necessary?
<Spaceghostc2c> shevy: You mean avdi?
<Spaceghostc2c> Him and Exceptions.
<rking> Spaceghostc2c: Yes, that's what I mean. Tools swing toward complexity as new problems are solved, then it swings back to simplicity as those problems become old.
<shevy> Spaceghostc2c hmm no ... someone who spoke that failure is a good way to learn something
<Spaceghostc2c> shevy: Oh, damn. I don't know.
<Spaceghostc2c> I've got to go mangle my future.
<shevy> rking yeah, ruby is perl's baby
<Mon_Ouie> http://vimeo.com/26391171 this is the one shevy meant
<shevy> oh yeah that one
<shevy> that was my favourite
<frontendloader> I accidentally overwrote str in my irb session
iocor has joined #ruby
<rking> frontendloader: Hrm?
snearch has joined #ruby
dfibre has joined #ruby
wvdschel has joined #ruby
seivan has joined #ruby
<frontendloader> is there a way to unscrew overwriting a method for main:Object in irb without reloading everything?
<rking> frontendloader: Hrmm, yes, probably. I'll toy with it while we wait to see if someone jumps in with the answer.
<frontendloader> eh don't worry about it unless it tickles your fancy that much
<rking> frontendloader: 1) It does. 2) What do you mean by "str"?
<shevy> frontendloader you could remove the method
<frontendloader> its a symptom of my test environment not working too well
<shevy> remove_method :to_s or undef_method
<shevy> hmm
brngardner has joined #ruby
<shevy> not sure how to restore a method if you dont have a copy of what the old method did before
<rking> So we are talking about Object#to_s ?
Tick-Tock has joined #ruby
Floydzy has joined #ruby
<frontendloader> any function in Object#methods
EvanR has joined #ruby
LBRapid_ has joined #ruby
<Mon_Ouie> Object#methods or Object#instance_methods?
lkba has joined #ruby
<frontendloader> which one is called when you write simply methods?
<rking> frontendloader: So how did you overwrite it?
<Mon_Ouie> Presumably the later. They are defined in Kernel, so if you remove whatever you defined in Object it will be back as normal.
<shevy> I guess he just def-ed it
<rking> This is surprising to me. If you do to_s you get "main", but then if you do def to_s; 3; end; to_s; you still get "main"
<rking> But if you do def to_x; 3 end; to_x; it does give "3"
<Mon_Ouie> rking: method(:to_s).owner is main's singleton class
<Mon_Ouie> If you def a method at toplevel, it becomes an instance method of Object (private by default)
ABK_ has joined #ruby
<Mon_Ouie> Since the singleton class always comes first in the inheritance chain, your to_s method isn't called
<Mon_Ouie> def self.to_s; 3; end; to_s #=> 3
<rking> Mon_Ouie: OK, I almost follow. How do I know the exact order of the inheritance chain?
<shevy> hehe
<rking> Mon_Ouie: In Python there's a mro() thingy that will tell you the "Method Resolution Order"
<Mon_Ouie> singleton_class.ancestors
<Mon_Ouie> Except that method doesn't show singleton_classes
<rking> Man, they should make pry the new irb. It's brimming.
alx- has joined #ruby
ABK_ has joined #ruby
<frontendloader> thats what I would like to know if it is undoable
* apeiros_ needs to port his irbrc and make an alias irb=pry
yoklov has joined #ruby
<rking> apeiros_: Are you in the mood to post your .irbrc?
<Spaceghostc2c> I tend to jump into the debugger a lot.
<rking> I only have def m obj; obj.methods.sort - Object.methods end
<frontendloader> pry for debugging is A+
<Mon_Ouie> frontendloader: Object.send :remove_method, :nil?
<Spaceghostc2c> It's pretty awesome, yeah.
<rking> Spaceghostc2c: With what mechanism?
<Spaceghostc2c> rking: The debugger...
<frontendloader> Mon_Ouie: hallelujah
<rking> Spaceghostc2c: Yeah, but how do you invoke it?
<frontendloader> binding.pry anywhere in your code
geekbri has joined #ruby
<Spaceghostc2c> rking: require 'ruby-debug'; Debugger.start; Debugger.settings[:autoeval] = 1; Debugger.settings[:autolist] = 1; debugger
<frontendloader> and require 'pry'
<rking> frontendloader: Spaceghostc2c: Thanks. =)
<Spaceghostc2c> Pry is pretty awesome, don't make a mistake with me on that.
<apeiros_> rking: it's on github. moment…
<Mon_Ouie> https://gist.github.com/2320633 is my pryrc :)
<Spaceghostc2c> But the debugger is more powerful. I hate having to admit.
<gokul> is there autocompleation in pry
<apeiros_> gokul: sure
<davidcelis> yes
<frontendloader> I think ruby-debug is broken for 1.9.3
<gokul> it's not working for me in 1.9.2
<gokul> i mean the pry autocompleation
<rking> Spaceghostc2c: Can you give some examples of how?
<apeiros_> rking: https://gist.github.com/923616 - beware, contains experimental code
knightblader has joined #ruby
<Spaceghostc2c> rking: Read it!
<Spaceghostc2c> frontendloader: It isn't.
<Spaceghostc2c> You just need a third-party patch.
seanstickle has joined #ruby
<frontendloader> the best kind of broken :/
<Spaceghostc2c> I've not seen any breakages from it or heard of any yet.
<rking> Spaceghostc2c: Read ruby-debug itself?
<Spaceghostc2c> rking: The docs and guides and blagposts. :D
<rking> Spaceghostc2c: K. Was looking for lazyman shortcut to the idea. =)
<rking> apeiros_: That's great.. I only wanted some sketches. For example, before looking at it I didn't know about psych.
<apeiros_> I removed the RUBY_ENGINE thing
<apeiros_> breaks the oracle adapter :(
io_syl has joined #ruby
eywu has joined #ruby
KL-7 has joined #ruby
x77686d has joined #ruby
sspiff has joined #ruby
johnmilton has joined #ruby
just3ws has joined #ruby
ABK_ has joined #ruby
ABK_ has joined #ruby
robdodson has joined #ruby
sspiff has joined #ruby
blueadept` has joined #ruby
jameshyde has joined #ruby
macmartine has joined #ruby
Sailias has joined #ruby
davidpk has joined #ruby
wefawa has joined #ruby
liluo has joined #ruby
d2dchat has joined #ruby
cap10morgan has joined #ruby
MrGando has joined #ruby
mattyoho has joined #ruby
waxjar has joined #ruby
Jake232 has joined #ruby
josefig has joined #ruby
josefig has joined #ruby
wallerdev has joined #ruby
eighty4 has joined #ruby
davidcelis has joined #ruby
ginsun has joined #ruby
seanstickle has joined #ruby
Helius has joined #ruby
Teddy2steper has joined #ruby
MrGando has joined #ruby
hobbyist has joined #ruby
Eldariof-ru has joined #ruby
artOfWar has joined #ruby
ed_hz_ has joined #ruby
<td123> is there a function to negate numbers?
<apeiros_> -
<apeiros_> @ td123
<td123> I want to map it over a list though
<apeiros_> and? it's still -
<td123> sorry :) I wanted to do it by doing something like map(&:-) :)
DrShoggoth has joined #ruby
<apeiros_> aha
<apeiros_> -@ is the name of the method as defined
<apeiros_> so map(&:-@)
<td123> thanks, that worked
troulouliou_dev has joined #ruby
natemcguire has joined #ruby
<troulouliou_dev> hi i m testing some regex in ruby 1.9.2 and 1.8.7 and i have different behaviors
<troulouliou_dev> for instance
<troulouliou_dev> a = "\xff\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00"
<troulouliou_dev> a =~ /test/
<troulouliou_dev> gives nil on 1.8.7
<troulouliou_dev> in 1.9.2 i have
<troulouliou_dev> ArgumentError: invalid byte sequence in UTF-8
<troulouliou_dev> from (irb):14
adeponte has joined #ruby
<apeiros_> troulouliou_dev: as stated in the topic: do NOT paste >3 lines in here. use a pastebin (pastie.org, gist.github.com)
<troulouliou_dev> ok sorry
<heftig> troulouliou_dev: where does that string come from?
<any-key> I had this error not long ago, and it's because \xff is not valid UTF-8 (either that or it's \x40)
<heftig> a file?
<apeiros_> "\xff\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00".force_encoding(Encoding::BINARY)
<any-key> using regex on binary is odd
<apeiros_> and =~ /test/n # note the n flag
<any-key> can you even do that successfully?
<apeiros_> any-key: no, it's not odd.
<apeiros_> and yes, of course you can.
<any-key> :\
<troulouliou_dev> apeiros_, force_encoding came with 1.9.2 right ?
fr0gprince_mac has joined #ruby
<heftig> troulouliou_dev: if you're reading from a file, make sure it's opened in binary mode
<troulouliou_dev> i think i did not had the problem on 1.9.1 afai remember
<heftig> then you automatically get strings of encoding BINARY out of it
<any-key> working with bytes and binary are a pain in 1.8
<heftig> any-key: no, just working with multiple encodings is
<troulouliou_dev> heftig, yes it id from a socket and i don't have the problem , only in irb
philips has joined #ruby
<any-key> string lacks .bytes and each_byte
<any-key> which made a few tasks practically impossible
<apeiros_> troulouliou_dev: no idea
<troulouliou_dev> any-key, "aaa".scan(/./).each
<any-key> meh
<any-key> I prefer bytes :P
<apeiros_> any-key: you know, in 1.8, all strings were just bytes
<apeiros_> any-key: so that wasn't really missing.
<apeiros_> what was missing was .chars
<any-key> yes
<apeiros_> for unicode, you could emulate that using unpack
<troulouliou_dev> i shoul dreread the ruby book for 1.9 :)
Indian has joined #ruby
<any-key> you can do anything with unpack >.>
<any-key> and pack
<apeiros_> oh, and scan, right
artOfWar has joined #ruby
<apeiros_> /./u
sectionme has joined #ruby
<rking> Mon_Ouie: Thanks to your snippets a bit ago, I now have read enough that I understand Singleton Classes. apeiros_: Thanks to your irbrc, I had some context when I saw eigenclass mentioned. =)
<troulouliou_dev> apeiros_, i do ,ot need to specify n if it is a binary string readen from a file or socket a in 1.8 right ?
<rking> I know it's probably a cliche to express excitement over Ruby stuff, here, but it's come so far since I left. I made a mess in pry, and thought, "You know what.. I'll type reset". Sure enough, it worked. GMTA.
<troulouliou_dev> i mean for regex /blah/n
<apeiros_> troulouliou_dev: in 1.8, you can't
<apeiros_> 1.8 doesn't have a concept of encodings
<apeiros_> to it, all strings are just a bytearray
angelGao has joined #ruby
ABK_ has joined #ruby
<troulouliou_dev> and in 1.9 all are unicode by dafault ?
<apeiros_> no
<apeiros_> in 1.9, they're just encoding-aware.
<apeiros_> and certain operations require the encoding to be valid
timonv has joined #ruby
<apeiros_> what encoding a string initially gets depends on a couple of things, depending on the source of the string.
<troulouliou_dev> apeiros_, where do i get the encoding ?
<apeiros_> str.encoding # not very surprising…
jgrevich has joined #ruby
jgrevich has joined #ruby
KL-7 has joined #ruby
<troulouliou_dev> apeiros_, pack still encode as Encoding:ASCII-8BIT , anogh for me :)
<troulouliou_dev> enough for me :)
blueadept` has joined #ruby
<apeiros_> no, pack with a specific pattern will use binary. not pack in general.
<troulouliou_dev> apeiros_, thanks you put me on the good way this saved me a lot of time
<apeiros_> hm… I expected pack("U*") to return a unicode string…
codezombie has joined #ruby
<apeiros_> ah, makes sense, though… could be packing binary data along with the U part
<apeiros_> I retract my previous statement then. seems like pack returns a binary encoded string all the time.
<troulouliou_dev> apeiros_, one last question what reflection method (if so called) can show me encoding , i mean this is not a methods that i can see with "aaa".methods ..
<troulouliou_dev> i mean "encoding" nested class
<apeiros_> as said, str.encoding
ABK_ has joined #ruby
<apeiros_> ah, you want a list of encodings
<apeiros_> see the docs of Encoding
andrewhl has joined #ruby
<troulouliou_dev> ni i mean but in general encoding is a nested class , a method ;; ???
<troulouliou_dev> a variable ?
<apeiros_> as said, take a look at the docs of the Encoding class
<shevy> Encoding <-- notice the upper char
<shevy> though you could use it as variable
<shevy> Encoding = 2 # => 2; Encoding = 3 # (irb):2: warning: already initialized constant Encoding # => 3
ABK_ has joined #ruby
cachoimechi has joined #ruby
SeanLazer has joined #ruby
savage- has joined #ruby
<troulouliou_dev> shevy, but inside "mystring".encoding -> encoding is a class of type Encoding , but it is a variable right ?
williamcotton has joined #ruby
<troulouliou_dev> sorry did not coded in ruby for 1 year and forgot some basics
<shevy> why would it be a variable?
<apeiros_> .encoding is a method
jconnolly has quit [#ruby]
<apeiros_> methods return objects
<apeiros_> objects are instances of a class. .encoding happens to return objects that are instances of the class Encoding
ABK_ has joined #ruby
<troulouliou_dev> ok saw it with "string".methods.select {|a| a =~ /enc/}
<apeiros_> the only things that are are variables are the things that you can put on the left side of a =
<troulouliou_dev> sorry i just missed it in the raw output of "".methods
<troulouliou_dev> basically remember now :)
<troulouliou_dev> apeiros_, shevy thanks
juiceman5000 has joined #ruby
ABK_ has joined #ruby
cobragoat has joined #ruby
angelGao has joined #ruby
ABK_ has joined #ruby
joaoh82 has joined #ruby
<Mon_Ouie> It's a method on String. What do you call a nested class?
<shevy> troulouliou_dev but the part inside // is just a string that wants to match against any word containing the string "enc"
<Mon_Ouie> oh, didn't scroll all the way down
<shevy> I think it would be faster to use a.include? 'enc' rather than use //
<Mon_Ouie> methods.grep(/enc/)
<rking> So, how could I get String...something....has_key? :encoding ? Of course I can do String.new.has_key? :encoding, but it seems like there should be a way to list the methods that would be on an instance of the class.
<rking> Sorry, I meant "I can do String.new.methods.has_key? :encoding"
<Mon_Ouie> String.method_defined? :encoding
<apeiros_> and "some string".respond_to?(:encoding)
<Mon_Ouie> And that #has_key? method isn't defined on arrays
<Mon_Ouie> There's #include?
<apeiros_> shevy: include? checks for ==
<rking> Ugh, I'm being soo sloppy,. Yes, I meant .include?
<apeiros_> shevy: so include? :enc would not work
<rking> Mon_Ouie: What about getting them as a list?
<apeiros_> .methods.include? is significantly slower than .respond_to?
<rking> apeiros_: But that's checking the instance.
<apeiros_> rking: so is methods
<apeiros_> rking: unless you wanted to write instance_methods
<Mon_Ouie> apeiros_: I think he meant select { |a| a.include? … } instead of select { |a| a =~ … }
<rking> apeiros_: Right.. but I'm looking for the direct way to go from class -> list of instance methods.
tommyvyo has joined #ruby
<apeiros_> and then method_defined? is significantly faster than instance_methods.include?
cachoimechi has joined #ruby
<apeiros_> rking: yes, instance_methods, as stated
<rking> apeiros_: Yes, that's what I was looking for. =)
<rking> I wonder why the use of "#" for "String#encoding". It seems a bit odd to use the comment char for it, to me.
<apeiros_> rking: . is ambivalent, :: is used for class methods
<apeiros_> what'd you use?
<apeiros_> # makes it at least clear, that it's not meant to be used in code directly like that.
<rking> apeiros_: Aha, that is a good advantage of #, yep.
<Mon_Ouie> I think the convention comes from Smalltalk
<rking> Oh? Shucks, that means I'm forgetting my Smalltalk.
<apeiros_> somebody should go and invent hypetalk
<apeiros_> nobody forgets that
mrsolo has joined #ruby
<apeiros_> or hipstertalk
<rking> Mon_Ouie: I think Smalltalk #(...) is like Ruby [...]
<shevy> hypertalk!
<shevy> oh no wait
<shevy> hypercard
<apeiros_> hypertalk is the language of hypercard
<shevy> heeh
<apeiros_> http://en.wikipedia.org/wiki/HyperTalk - take a look at the examples
<apeiros_> a very clean and readable language
<robdodson> can I ask a very n00b question… why does ruby have so many redundant methods? for instance String#chars or String#each_car. I see it all over the place but I'm not what the reasoning behind it is.
Teddy2steper has joined #ruby
banjara has joined #ruby
<rking> I'm trying to understand this Hypertalk "the" keyword. It might be a simple optional throwaway thing... I'm not sure yet.
cloke has joined #ruby
SegFaultAX|work has joined #ruby
<apeiros_> I think it is
<apeiros_> (optional)
<rking> robdodson: Well, those two are different. "".chars.each would be like "".each_char
nlc has joined #ruby
galymzhan has joined #ruby
<apeiros_> rking: each_char and chars are aliases
<rking> apeiros_: =\ I gross.
galymzhan has quit [#ruby]
<apeiros_> rking: I the gross?
cwang has joined #ruby
<rking> apeiros_: Yeah. Why don't we add 1000s of optional keywords
davidcelis has joined #ruby
<apeiros_> rking: readability
jameshyde has joined #ruby
<rking> "send the message symbol :encoding to the object string quote 'foo'"
strife25 has joined #ruby
<rking> Vs. 'foo'.encoding
<robdodson> rking: chars and each_char seem to produce the same results when I use them.. they look the same in the docs to me
<rking> robdodson: Yeah, I was being wrong. =)
<robdodson> rking: oh ok :)
<rking> robdodson: apeiros_ said it's an alias. I'm not sure why we have both, or even to search around and find the discussion that caused one or the other.
<robdodson> so, I recognize that they alias the same functionality..my question is why? just to make the code more readable depending on your style?
<rking> robdodson: Probably not that reason, no.
<apeiros_> robdodson: I don't know. extensive use of aliases is something I dislike about ruby
<rking> robdodson: Otherwise we'd have .to_s .s .str .to_string .to_sequence_of_characters_that_i_like etc.
ben225 has joined #ruby
<apeiros_> the only case for aliasing I find reasonable is for semantically equal special methods
<apeiros_> e.g. if you alias == and eql?
<Mon_Ouie> Especially since alias makes a "copy" of the method (changing either of them has no effect on the other method)
<Mon_Ouie> (except perhaps for recursive methods)
<apeiros_> Mon_Ouie: I tend to think more of it like assignments to variables
<apeiros_> i.e. def foo assigns a method, alias foo assigns that method to another name
<apeiros_> similar as x = "foo"; y = x; x = "bar" does not influence y
<apeiros_> (it's also probably closer to what actually happens behind the curtain)
mcwise has joined #ruby
apok has joined #ruby
timonv has joined #ruby
x77686d has joined #ruby
juiceman5000 has quit [#ruby]
mmercer has joined #ruby
dbgster has joined #ruby
mmercer has joined #ruby
syamajala has joined #ruby
krz has joined #ruby
ozymandius has joined #ruby
adamkittelson has joined #ruby
RORgasm has joined #ruby
apok has joined #ruby
moshee has joined #ruby
ben225_ has joined #ruby
mmercer has joined #ruby
j3r0m3 has joined #ruby
malcolmva has joined #ruby
rippa has joined #ruby
mmercer has joined #ruby
<mmercer> hrm
tommyvyo has joined #ruby
stephenjudkins has joined #ruby
species has joined #ruby
geekfactor has joined #ruby
geekfactor has joined #ruby
shadoi has joined #ruby
tewecske has joined #ruby
savage-_ has joined #ruby
brngardner has joined #ruby
MrGando has joined #ruby
natemcguire_ has joined #ruby
x77686d has joined #ruby
lockweel has joined #ruby
artm has joined #ruby
voodoofish430 has joined #ruby
j3r0m3 has joined #ruby
Eldariof59-ru has joined #ruby
<rking> Mon_Ouie: Ahh yes, Smalltalk #(...) is our [...], but #sym is our :sym.
kenichi has joined #ruby
otters has joined #ruby
headius has joined #ruby
adeponte has joined #ruby
cha1tanya has joined #ruby
tvw has joined #ruby
Nisstyre has joined #ruby
dzhulk has joined #ruby
stkowski has joined #ruby
kenichi has joined #ruby
daniel_hinojosa has joined #ruby
strife25 has joined #ruby
pu22l3r has joined #ruby
tommyvyo has joined #ruby
Eldariof-ru has joined #ruby
Sailias has joined #ruby
berserkr has joined #ruby
RORgasm has joined #ruby
linoj has joined #ruby
arturaz has joined #ruby
jasmim has joined #ruby
jasmim has quit [#ruby]
looopy has joined #ruby
bawerd has joined #ruby
mdw has joined #ruby
hasrb has joined #ruby
mmlug has joined #ruby
<mmlug> hi
<mmlug> i need your help..
<mmlug> how can i generate random integer 10 times
<mmlug> test = rand(10 ** 10).to_s.rjust(10,'0')
<mmlug> how can i create this random number in 10 times
Progster has joined #ruby
<shevy> 10.times
<hasrb> 10.times { puts rand(10) }
<Sp4rKy> :)
<mmlug> i want to have test = rand(10 ** 10).to_s.rjust(10,'0') 10 times..
<shevy> then use
<shevy> 10.times
<shevy> just pass inside the block
<hasrb> mmlug: do you want an array with 10 integers?
<shevy> the part between {}
<mmlug> ya
phantomfakeBNC has joined #ruby
<hasrb> test = 10.times.collect { rand(10) }
<hasrb> whatever number is in rand() is the range it will pick from
levity_island has joined #ruby
evilgeenius has joined #ruby
bglusman has joined #ruby
startling has joined #ruby
alem0lars has joined #ruby
<Veejay> Array.new(N) { rand(M) }
<evilgeenius> The ActiveRecord methods that I stub are persisting between tests when I use mocha. Is there a way around this?
shadoi1 has joined #ruby
<Veejay> An array with length N with random numbers in 0..M-1
<mmlug> when i used like.. test1 = rand(10 ** 10).to_s.rjust(10,'0')
<mmlug> test = 10.times.collect { rand(test1) }
<mmlug> puts test
<mmlug> some number are only 9 digits
nfluxx has joined #ruby
<evilgeenius> Im using minitest.
<hasrb> evilgeenius: Are you using any_instance from mocha?
<apeiros_> mmlug: of course
<hasrb> evilgeenius: is it in a before block?
<apeiros_> mmlug: rand(n) gives you random numbers in the range 0...n
<mmlug> could you point me..?
<apeiros_> so you could even get a single digit number. read the docs of rand.
<evilgeenius> hasrb: Im doing this : Product.expects(:find).with(1).returns(product)
<evilgeenius> hasrb: The changes that mocha is making is persisting between all my tests and creating strange effects
<apeiros_> mmlug: or do you mean it was 9 digits even with the leading zeros?
<mmlug> ya
<hasrb> evilgeenius: is it in a before block?
<mmlug> i want to have 10 digits number..
<apeiros_> mmlug: that's… not really possible with rjust
<apeiros_> did you at some point convert it back to an integer?
<evilgeenius> hasrb: I don't think it was.
ben225 has joined #ruby
<mmlug> hmmm
<hasrb> evilgeenius: looks like mocha has an unstub method
<hasrb> but you'll probably want to dig through and see why it's actually doing that or where it's getting set
<Veejay> apeiros_: 0..n-1
<evilgeenius> hasrb: So is this not normal behaviour then? It's the first time ive used mocha so im not 100% with it yet.
<Veejay> ?
<apeiros_> Veejay: note the triple-dot
emmanuelux has joined #ruby
<mmlug> how could i make it correct.?
<Veejay> apeiros_: Three dots means non-inclusive of the upper bound?
<apeiros_> Veejay: yes
<hasrb> evilgeenius: I haven't used minitest but with rspec you just define those within a test and they only exist for that test
<Veejay> Didnt know that
<Veejay> Thanks for making me smarter
n1x has joined #ruby
<hasrb> evilgeenius: or basically in the scope of the test so if it's set in a before/after filter then it would stub it
eywu has joined #ruby
arussel has joined #ruby
strife25 has joined #ruby
arussel has quit [#ruby]
j3r0m3 has joined #ruby
JohnBat26 has joined #ruby
senj has joined #ruby
<mmlug> that is my code
<pyreal> I'm having trouble understanding how to capture multiple strings in a block. Can someone peek at https://gist.github.com/2321801 and tell me where I'm a fail Rubyist?
<mmlug> still some random number are only 9 digits
Axsuul has joined #ruby
<davidcelis> pyreal: The block evaluates "foo"
<davidcelis> pyreal: and then returns "bar"
<evilgeenius> hasrb: strangely the unstub method is having no effect
<davidcelis> you probably just want to have the block call puts on both
<davidcelis> pyreal: ^
<shevy> pyreal you drop the first part
<shevy> if you want to return both strings "foo"+"bar"
<davidcelis> well
<hasrb> evilgeenius: pastie your test
<davidcelis> "foo\n" + "bar"
<davidcelis> or strings.join("\n")
fbernier has joined #ruby
<pyreal> yeah it works when i 'puts' both strings but i was hoping to be able to return a string and do whatever with it
zakwilson has joined #ruby
<shevy> who said puts
<davidcelis> pyreal: Then you want to join whatever strings you have with "\n"
<davidcelis> shevy: I did because his example was vague and it would achieve what he wants.
<shevy> ah yeah you did :)
<davidcelis> pyreal: If you want to return a string and do stuff with it, you need to return the entire string (or all parts in an array or joined) at the end
<evilgeenius> hasrb: Here it is. https://gist.github.com/2321869
Karmaon has joined #ruby
ymasory has joined #ruby
<pyreal> davidcelis: kk.. i was trying to reverse engineer RoR capture(&block) style where you can put multiple lines in a block and have them spit back out with modifications
<pyreal> but I can't figure out what they're doing to extract each separate line
kaneda has joined #ruby
<evilgeenius> hasrb: the "expects" method call is stopping most of the other tests from working
<hasrb> evilgeenius: are you referring to how line 28 and 29 are returning the stubbed result?
<hasrb> evilgeenius: are you expecting it to only be stubbed once?
BrianJ has joined #ruby
<evilgeenius> hasrb: I only want it to be stubbed for this one test.
chessguy has joined #ruby
<evilgeenius> hasrb: Not for all my other test cases
headius has joined #ruby
Karmaon has joined #ruby
phantomfakeBNC has joined #ruby
Clordio has joined #ruby
<hasrb> evilgeenius: and is this test running as expected? Just other tests aren't?
Mohan has joined #ruby
Mohan has joined #ruby
Beakr has joined #ruby
fermion has joined #ruby
<mmlug> @hasrb could you help me ?
<hasrb> mmlug: What does the expected end result look like?
ephemerian has joined #ruby
<mmlug> i want to create random number with 10 digits
<mmlug> and should be unique
<mmlug> 1000 random numbers
<evilgeenius> hasrb: All the tests upto that test work fine. The test itself doesn't work, it fails on line 29, and all the tests after it fail with this : "unexpected invocation: Area(id: integer, na.....).find(100)"
jbw has joined #ruby
<hasrb> evilgeenius: ah, just needed to see that error
<hasrb> evilgeenius: you have 2 calls to Area.find so that's why it's erroring
<hasrb> evilgeenius: you have to tell mocha to expect it more than once
mcwise has joined #ruby
x77686d has joined #ruby
Guest30 has joined #ruby
shruggar has joined #ruby
<hasrb> evilgeenius: it's intentional so that you don't cover up another call to find on accident
<Veejay> mmlug: SecureRandom.hex(5)
<Veejay> But that'd be hexadecimal
jbw has joined #ruby
<evilgeenius> hasrb: I've added the test run log to the end of the gist
<hasrb> mmlug: to do the unique part you would just have to use the include? method to see if it exists in the array
<evilgeenius> hasrb: Ok thanks, ill find out how to tell mocha it expect it more than once. It shouldn't affect all the tests after it though should it/
<evilgeenius> ?
<hasrb> evilgeenius: "- expected exactly once, invoked twice" you have to say .2.times, can't remember the exact format
<hasrb> evilgeenius: no, since it's just in that specific test block it's only for that one
<mmlug> hasrb: not sure.
hSATAC has joined #ruby
<Veejay> .times(2)
<Veejay> I think
RangerMauve has joined #ruby
jtoft has joined #ruby
<hasrb> Veejay: thanks
<Veejay> Which I think is horrible syntax really
<Veejay> But yeah
<hasrb> mmlug: read up on the Ruby rdoc, specifically rand(), include? and enumerables
hobbyist has joined #ruby
<RangerMauve> Hey, wahat would a regex for html tags be? I'm looking to delete all html tags in a string by getting rid of everything that starts with a < and ends with a >
<Veejay> But you can also enjoy the syntactic sugar of .twice
<jtoft> Is there a way to stream output of a shell command as it's running, instead of after it's completed?
<hasrb> RangerMauve: look at the Rails source for strip_tags
datherra has joined #ruby
<RangerMauve> hasrb: Will do.
<Veejay> RangerMauve: Why not use a HTML parser to do that?
heftig has joined #ruby
<RangerMauve> I just want a one line sort of thing that will clean inputs of html for me.
<RangerMauve> I feel a parser would be overkill
<Veejay> You won't be able to do taht
<Veejay> that
<Veejay> HTML and regexes, sounds like a nightmare
<hasrb> RangerMauve: yeah, that's not a good idea for inputs
<Veejay> But I guess you'll see for yourself
<RangerMauve> Ruh roh
<hasrb> RangerMauve: also look at the sanitize helper within rails
<RangerMauve> The thing is though, I'm not using rails. =P
<hasrb> RangerMauve: http://wonko.com/post/sanitize
<hasrb> RangerMauve: oooo that's a bit old but I'm sure you can find a sanitize gem
<hasrb> or just use nokogiri
<hasrb> or one of the parsers
brngardner has joined #ruby
<RangerMauve> Oh sweet that's exactly what I needed. Thank you.
<hasrb> RangerMauve: do a search for "sanitize" on rubygems.org
<RangerMauve> Oh, I installed the one you linked me to already.
ozymandius has joined #ruby
<species> symbols are identifiers without a value, right?
ezkl has joined #ruby
<Mon_Ouie> They are like integers, they are a value
zakwilson has joined #ruby
<species> yeah im doing the koans and the stuff in about_arrays is somewhat odd
acuozzo has joined #ruby
<species> in particular, split lets you roll over the end of the array
<apeiros_> o0
<species> i mean slicing
artm has joined #ruby
<RangerMauve> hasrb: Thanks again for the link, it works exactly as I need it to!
<apeiros_> 0o
Boohbah has joined #ruby
<species> ooh, im seeing an inconsistancy between the ruby version in codepad and my version (1.9.2)
digx has joined #ruby
n8ji has joined #ruby
<species> in the way to_s works
<mmlug> hasrb: thanks i need to find it out..
* apeiros_ needs his magic picture again…
<apeiros_> species: http://imgur.com/fBoM2
sohocoke has joined #ruby
deception_ has joined #ruby
davidpk has joined #ruby
<apeiros_> imagine a fence with poles. the index is the pole.
<ezkl> species: 1.9 calls #to_s on Object.inspect
<deception_> Has anyone here used Watir for web app testing?
<deception_> http://watir.com/
<ezkl> deception_: Not for quite a long time.
<deception_> I'm trying to get it to run on a headless ubuntu ec2 server and it hangs when i create a new browser
<deception_> ezkl: It needs a minimal X server. TY though.
<ezkl> deception_: I've implemented effectively the same pattern https://github.com/ezkl/capit
timonv has joined #ruby
<hasrb> deception_: I've been using capybara-webkit recently for headless testing and it's been great, haven't used watir for a while though
<ezkl> and there is also… one sec
fbernier has joined #ruby
ZenoArrow has joined #ruby
<deception_> Thanks! I'm just really looking for library that can deal with JS to scrape the site and submit orders
nemesit has joined #ruby
mutewinter has joined #ruby
<ezkl> deception_: Prolly oughta use PhantomJS or something
<ezkl> deception_: Same basic idea.. http://www.phantomjs.org/
<deception_> My man
ablemike has joined #ruby
<deception_> Now I have so much more to research!
ablemike has joined #ruby
datherra has quit [#ruby]
<ezkl> deception_: It is pretty straight forward. `sudo apt-get install xvfb` then `man xvfb-run`
Guest30 has joined #ruby
heftig has joined #ruby
<evilgeenius> hasrb: No matter what I do the stubs by mocha are carrying through to the rest of the tests..
<hasrb> evilgeenius: by carrying through do you mean that it's giving the error of unexpected invocation?
<evilgeenius> hasrb: yes
<ZenoArrow> Hi all, trying to make sense of the following code http://pastie.org/3740647 What I don't understand is why the dup method is necessary before capitalising the first letter, why is a duplicate object necessary?
<evilgeenius> hasrb: so the test is passing now, but the remaining tests all show that error
<evilgeenius> ZenoArrow: You can just do this : "hello".capitalize
davidpk has joined #ruby
deception_ has quit [#ruby]
<evilgeenius> ZenoArrow: it's not necessary.
<ZenoArrow> evilgeenius, thanks for the tip but the code I'm trying to understand isn't mine, apparently it's from the Ruby Cookbook. I'm trying to understand the author's thoughts, as it seems like an unnecessary step to me too.
<evilgeenius> ZenoArrow: Using dup will ensure that the original object isn't modified, only a copy
<ZenoArrow> Sure, but you can't access the original anymore if you assign it the same variable name.
daniel_hinojosa1 has joined #ruby
zakwilson has joined #ruby
<evilgeenius> ZenoArrow: Whoever uses the class will have the original object
<ZenoArrow> I don't understand, could you elaborate?
Ali1331 has joined #ruby
<matled> ZenoArrow: the original is the one passed to the method
<evilgeenius> ZenoArrow: so : myname = "chris" ; name_object = Name.new ; name.first=myname ;
<evilgeenius> ZenoArrow: myname is the original string, and it won't be modified
<matled> ZenoArrow: the caller might still use the string and not expect that it may change due to calling #first=
CannedCorn has joined #ruby
<CannedCorn> hey guys when i run rails server in development do i need to precompile assets in asset pipeline
<Ali1331> no
<ezkl> ZenoArrow: The guide you're working through is about 6 years old.
<CannedCorn> or are they served out of /assets in dev mode
<CannedCorn> Ali1331 hrm the rails.png isn't showing up
<matled> ZenoArrow: http://pastie.org/3740697
<evilgeenius> ZenoArrow: DO YOU SEE?
<ZenoArrow> ezkl, I'm actually working through rubylearning.com, but the referenced code was taken from the Ruby Cookbook.
<matled> ZenoArrow: if the foo used @bar = bar.dup the value of str would not change
<ZenoArrow> matled, I'll look at that pastie now. BRB...
nfluxx has joined #ruby
hooper has joined #ruby
<CannedCorn> Ali1331?
<Ali1331> err
<Ali1331> is there anything in the log?
<Ali1331> it should say if it couldnt find a file
<CannedCorn> yeah it couldn't find it
<Ali1331> where's it looking?
tommyvyo has joined #ruby
<CannedCorn> "/assets/rails.png"
<CannedCorn> all i did was run rails new and rails s
<CannedCorn> with the latest rails so it should work
<Ali1331> isn't the rails.png in assets/images/?
c0rn has joined #ruby
dzhulk has joined #ruby
<CannedCorn> nope
<CannedCorn> i mean, yeah
<CannedCorn> but the index.html looks for it http://localhost:3000/assets/rails.png
<CannedCorn> is that a bug?
<CannedCorn> i can put in a pull req
<Ali1331> probably
<Ali1331> in production it would look in assets/
<Ali1331> err
<Ali1331> is it a hardcoded link?
<Ali1331> image_tag should take care of the dev/prod difference
blischalk has joined #ruby
<ZenoArrow> matled, thank you for the pastie, but I'm still confused. Let me put it like this, http://pastie.org/3740730 Is there a scope where x.object_id will return the original value?
<matled> ZenoArrow: no, the object should have no reference anymore
dbgster has joined #ruby
KL-7 has joined #ruby
<matled> ZenoArrow: in your original pastie the caller of #first= may still hold a reference to the string after calling the method (i.e. is not using .first= "foo" but .first = var)
<ZenoArrow> Right, so why is this necessary at all: first = first.dup
<ZenoArrow> first[0] = first[0].chr.capitalize
<ZenoArrow> @first = first
<matled> so the caller's object may be changed by calling the #first= method
Karmaon has joined #ruby
madhatter has joined #ruby
<ZenoArrow> matled, in the original pastie, how does the code know which of the 'first' values it should be using?
<ZenoArrow> Seems to me, the reference to the object is replaced.
<matled> ZenoArrow: try this with and without line 9: firstname = "foo"; name = Name.new; Name.first = firstname; puts firstname
<matled> err, s/Name.first/name.first/
<matled> oh, I didn't look at the constructur, but you should be able to modify the code to work :)
CoverSlide has joined #ruby
<dotemacs> Hi, I'm trying to organise a Emacs Conference. To hear what people want, I've put this site up: http://emacsconf.herokuapp.com/ with (RoR) code here: https://github.com/dotemacs/emacsconf
<Ali1331> whats emacs
<ZenoArrow> matled, okay trying that out now. Ali1331, it's hard to describe emacs, but you can think of it as a text editor with lots and lots and lots of extra functionality.
<davidcelis> its like vim, only worse
<ZenoArrow> ...and better.
<davidcelis> ha ha ha
<davidcelis> ಠ_ಠ
<ZenoArrow> ;-)
andrewhl has joined #ruby
scientes has joined #ruby
<shevy> emacs is a pretty good OS
<ZenoArrow> emacs is ridiculously feature packed, I've tried it out a number of times, got my eye on a few projects that take Emacs and give it more sensible keybindings. The 'language' of editing text in vi is something I prefer, but emacs is better for everything else (from what I've seen). Of course with viper mode and similar you can have the best of both. :-)
fmcgeough_ has joined #ruby
Floydzy has joined #ruby
<ZenoArrow> matled, okay I've tried making your changes. See new pastie: http://pastie.org/3740848 . Is this what you wanted me to try?
<matled> ZenoArrow: exactly, try this with and without line 9
downtown has joined #ruby
<ZenoArrow> Okay, thanks. Tried without line 9, the output is exactly the same, just the string 'Foo'.
<matled> ZenoArrow: for me it is "foo" with line 9 and "Foo" without line 9
<ZenoArrow> Ah, actually you're right, I wasn't paying attention!
<ZenoArrow> Will take a look into what's happening now.
<shevy> ZenoArrow hmm you wrote "editing text in vi" why did you write vi? :)
n8ji has joined #ruby
timonv has joined #ruby
<ZenoArrow> shevy, vi is what vim is based on. The basic structure of editing text is similar in both. This is the best introduction to vi I've ever read, if you are unaware of vi then I highly recommend it: http://stackoverflow.com/a/1220118
downtown has quit [""baby don't hurt me, no more""]
<shevy> I dunno. I used vim and only vim and never cared about vi. Though that was years ago already, I think both emacs and vim are way too complicated
Floydzy has joined #ruby
<ZenoArrow> shevy, please read the post I linked you to, then you might see the benefits of vi. :-)
<frontendloader> is there a way to repeat the last X lines in pry?
Cache_Money has joined #ruby
<shevy> ZenoArrow a million commands to learn for your brain. I'll take the shortcut into a neuronal brain interface instead
<ZenoArrow> shevy, the point that the post made was that if you understand the language behind vi then the commands are easier to pick up. That's the secret to getting good at using vi.
<shevy> that is true, one has to think inside the vim in order to use it
zeroeth has joined #ruby
yoklov has joined #ruby
bglusman has joined #ruby
fbernier has joined #ruby
<ZenoArrow> It's all about efficient text editing, once you get the basics down then you should become more efficient at editing text. If you don't care about editing text efficiently, then vi(m) and emacs aren't for you.
<shevy> indeed, because all the other editors suck.
<ZenoArrow> shevy, I wouldn't say that. There are other editors that are good, but in terms of efficiency it's hard to top vim and emacs. From what I've seen, emacs can get more done with less keystrokes compared to vim, look at this: http://www.youtube.com/watch?v=ePIHUfFz8-c
dfamorato has joined #ruby
<shevy> yeah I dunno
<shevy> emacs vs. vim, the eternal war
<frontendloader> golfing is fun, but not a great way to compare the two
<ZenoArrow> What's that got to do with anything, just pick the tool that suits you best.
<frontendloader> perl will golf ruby around the block
<ZenoArrow> frontendloader, I gave it as an example of efficiency, which is what vimgolf is all about.
<Mon_Ouie> ZenoArrow: Except you kind of have to think 5 minutes before figuring out what commands to use to do that kind of thing
<shevy> ZenoArrow, I do. I proudly use other editors than vim and emacs.
<shevy> The efficiency you get by ... spending 100 hours of learning?
<ZenoArrow> Mon_Ouie, not necessarily, in the example I gave it's a macro, as long as you can think recursively then it's easy to define
<frontendloader> I don't get much use out of macros except when golfing
<ZenoArrow> shevy, you don't need to put in that many hours before you see the benefits.
<shevy> I am fine with the basic keybindings of vim.
<frontendloader> 90% of my vim usage is go here, delete X between Y and Z, type something new
<shevy> 5dd always was fun to do
<shevy> my gripe was that there was a perpetual learning curve for marginal gains
svg_ has joined #ruby
<frontendloader> and autoindent spam
<ZenoArrow> frontendloader, it's all up to personal preferences, I'm not saying you have to use macros if you don't want to.
BrianE|mobile has joined #ruby
<svg_> how match the string to other string?
<shevy> Ultimately the real block while programming is not the "efficiency" but the thinking power of your brain.
<svg_> foo(["aab","ab","ac","aa","b","a"] ,"abba") => ["ab","b","a"]
<shevy> svg_ what shall this do?
<ZenoArrow> shevy, the tool you use can either get in your way or assist you, as I said before it's about finding the right tool for you.
<svg_> longest string is prefable
<frontendloader> I don't encounter situations where I'd want to macro something while programming often
<frontendloader> and some of the times I do I end up shooting myself in the foot 10x in sequence
<svg_> shevy, how cut "abba" string using table ["aab","ab","ac","aa","b","a"] elements
<ZenoArrow> svg_, it looks like you're trying to compare arrays.
<ZenoArrow> frontendloader, macros are most useful for repetitive tasks.
<svg_> abba is string it no exist in table
<shevy> well I see your array, I am just not sure about the criterias for what "abba" shall return, or what has to be done on that array
<svg_> ZenoArrow, Show me What compare
startling has joined #ruby
<canton7> he wants to go through all elements in the array, find which are substrings of "abba", and order by length
<shevy> ah... which are substrings of "abba"
<shevy> somehow it is much easier to know what he wants by listening to canton7 :-)
<ZenoArrow> Why not use some regex?
<svg_> canton7, yes but return array must by a this same string (join array)
nif has joined #ruby
<svg_> yes substring is good idea, but what I can to do it?
SeanLazer has joined #ruby
Brainix has joined #ruby
<svg_> ZenoArrow, (regex is not possible, my array is too big)
dfamorato has joined #ruby
<canton7> ["aab","ab","ac","aa","b","a"].select{ |a| "abba".include?(a) }.sort_by(&:length).reverse maybe?
<svg_> I must get array ["ab","b","a"] exactly
<svg_> not every possible
natemcguire has joined #ruby
<shevy> it's strange
<shevy> I understand canton7, but I don't understand svg_
<svg_> this code put : ["a", "b", "ab"]
<svg_> but I must get ["ab","b","a"]
ozymandius has joined #ruby
<canton7> my code outputs ["ab", "b", "a"]
<canton7> although there's nothing stopping it outputting ["ab", "a", "b"] i guess
<shevy> svg_, your problem is solved then
monokrome has joined #ruby
<canton7> shevy, I figured out the problem by looking for patterns in his example, not by what he was saying :P
<ZenoArrow> svg_, you said regex is not possible because your array is too big. Is "abba" the text you want to search for, or is this just an example of something you're searching for?
<svg_> ZenoArrow, example, I have big array and many strings
<shevy> canton7 LOL
<canton7> svg_, I doubt you'll get something more efficient for finding substrings than "string".include?("substring"). If you need more speed than that, either you need to be writing a C extension, or using another language altogether
<svg_> canton7, I undestood, You example working
<svg_> thanks
<canton7> :)
jtoft has joined #ruby
<svg_> but trouble is with sorting
<svg_> ["to","ab","ac","aa","b","a"].select{ |a| "abbato".include?(a) }
<svg_> => ["to", "ab", "b", "a"]
<svg_> ["to", "ab", "b", "a"] is not "abbato"
<svg_> ["to","ab","ac","t","o","aa","b","a"].select{ |a| "abbato".include?(a) }
<svg_> => ["to", "ab", "t", "o", "b", "a"]
<svg_> too much matched
<ZenoArrow> Okay, I'm starting to see what you're doing now, are you trying to compose a larger string out of smaller substrings?
<svg_> yes
<ZenoArrow> Okay, well there are a few considerations you need to make first...
bgupta has joined #ruby
<canton7> ah, yes I see. I missed that particular pattern :P
Deele has joined #ruby
cloke has joined #ruby
<ZenoArrow> Let's say you have the string "abbato" and you want to find a substring that matches the first part, let's say you have a choice between "a", "ab" and "abb", which do you choose?
<svg_> longer
<ZenoArrow> Okay, so in the ideal case you're looking for an exact match, but if not you'll settle for the closest substring you find, yes?
<svg_> yes
<ZenoArrow> Okay, well before we get into the code, let's design it logically...
<ZenoArrow> If you're looking for an exact match, you should look for strings that have the exact same length as the string you're searching for first.
<svg_> There has to be the best fit. It may be that the matches in front of the longest matching string cuts the string, etc..
<ZenoArrow> So in other words, first you're looking for "abbato", then you're "abbat", then you're looking for "abba", etc...
<svg_> my string have 2 MB ;(
<ZenoArrow> To do this, it's worth rememebering that you can treat strings like arrays...
<ZenoArrow> svg, look, you're trying to do an inefficent search then, you should look at ways to break the string down first.
<ZenoArrow> What exactly is this data you're working with? I'm guessing that it might have something to do with music?
MrGando has joined #ruby
<rking> OK guys, somebody here knows. I used to have this great program, "same", that was the opposite of diff. It was deadly at finding bits of code that people copy&pasted. Any clues where it lives, now?
aibo has joined #ruby
hobbyist has joined #ruby
<ZenoArrow> svg_ if you can tell us what the data you're working with contains, then it'll be easier for us to help you.
<ZenoArrow> rking, so this program just showed you what matched?
<svg_> ZenoArrow, no this data is from ocr
<rking> ZenoArrow: Yes, and I think I found it: http://sourceforge.net/news/?group_id=21639
<apeiros_> svg_: all you want to know is whether a target string can be built by a couple of substrings? (and without missings or left-overs)
<rking> ZenoArrow: It's a nontrivial algorithm... the thing ran pretty fast given the exponential nature of the task.
<apeiros_> if so: join all, sort the chars and compare
<apeiros_> same for the target string
fermion has joined #ruby
<rking> Warning on that .zip -- it's an impolite archive.
<ZenoArrow> svg_, okay so let's say you've got a document you've scanned. What are you trying to find in it?
josefig has joined #ruby
frishi has joined #ruby
Vert has joined #ruby
<svg_> ZenoArrow, look this http://sprunge.us/YETf?ruby?raw
<shevy> mice leavings
STP has joined #ruby
_ack has joined #ruby
Floydzy has joined #ruby
nlc has joined #ruby
zakwilson_ has joined #ruby
kaneda has joined #ruby
<ZenoArrow> svg_, when I run that code, it seems to give the result you're looking for, as in "acaabac" is matched with ["ac", "aab", "ac"]. What's the problem with the code?
lolsuper_ has joined #ruby
lolsuper_ has joined #ruby
MasterIdler_ has joined #ruby
codezombie has joined #ruby
nif has joined #ruby
bluOxigen has joined #ruby
bluOxigen has joined #ruby
<rking> http://panoptic.com/rking/tmp/same-example.txt # An example of the kinds of ways to use "same". In this case the code was subtlely changed -- it had been copied and pasted, but the symbol names were changed. So to get the matches I ran a s/\w+/symbol/g filter first.
zeroeth has joined #ruby
<ZenoArrow> I'm off. All the best.
ZenoArrow has quit [#ruby]
nif has joined #ruby
thone_ has joined #ruby
nif_ has joined #ruby
burgestrand has joined #ruby
nif__ has joined #ruby
y3llow has joined #ruby
s0ber has joined #ruby
andrewhl has joined #ruby
y3llow has joined #ruby
nonotza has joined #ruby
gh has joined #ruby
y3llow has joined #ruby
hobbyist has joined #ruby
strife25 has joined #ruby
BrianE|mobile has joined #ruby
artOfWar has joined #ruby
CannedCorn has joined #ruby
just3ws has quit [#ruby]
williamcotton_ has joined #ruby
ozymandius has joined #ruby
Brainix_ has joined #ruby
Prudhvi has joined #ruby
<Prudhvi> Hi all, i am new to Ruby. I am trying to fix a small script. However, i am trying to find the location where a certain object is defined. How can i figure it out?. I tried a grep, but nothing was conclusive
<gogiel> Prudhvi: it can be defined anywhere. you can check where method is defined
<apeiros_> Prudhvi: an *object*? you'll have to follow the code in reverse
<apeiros_> there's no way to directly find that
<apeiros_> or do you mean a method? or a class?
<apeiros_> if the script is indeed small, you can also paste (on pastie.org or gist.github.com) your code and the exception.
mdw has joined #ruby
tatsuya_o has joined #ruby
BrianE|mobile has joined #ruby
burgestrand1 has joined #ruby
eka has joined #ruby
mattyoho has joined #ruby
babinho has joined #ruby
pastjean has joined #ruby
Vendethiel has joined #ruby
maletor has joined #ruby
rexbutler has joined #ruby
<rexbutler> Question: Suppose I want to draw to arbitrary coords in terminal (in different colors). Is there a way to do it without rbcurses? rbcurses is huge.
mbriggs has joined #ruby
<apeiros_> rexbutler: google for ansi escape sequences
<apeiros_> there's some to place the cursor
<rexbutler> apeiros_: Yeah, I just need to clear screen and move around.
jcromartie has joined #ruby
tjf has joined #ruby
tjf has quit [#ruby]
helichopter has joined #ruby
helichopter has quit [#ruby]
helichopter has joined #ruby
<Prudhvi> gogiel: apeiros_ thanks, i found it. It is a method in capistrano lib
niku4i has joined #ruby
artm has joined #ruby
mrwalker has joined #ruby
heftig has joined #ruby
chico has joined #ruby
Foxandxss has joined #ruby
Houdini has joined #ruby
prometheus has joined #ruby
td123 has joined #ruby
BrianE|mobile has joined #ruby
josefig has joined #ruby
josefig has joined #ruby
adamkitt_ has joined #ruby
KL-7 has joined #ruby
ben225 has joined #ruby
cmpf has joined #ruby
artOfWar has joined #ruby
kenneth has joined #ruby
wroathe has joined #ruby
mmokrysz has joined #ruby
mengu_ has joined #ruby
mmokrysz has quit [#ruby]
keymone_ has joined #ruby
wilmoore has joined #ruby
<rking> I get how to use it, but I really don't understand exactly what the <<'s are saying in things like: class Oof; class << self; def rab; 1 end end end
artm has joined #ruby
cpruitt has joined #ruby
gregorg has joined #ruby
<gogiel> Prudhvi: i like rubymine. ctrl-click on method and you got it :)
DouglasA has joined #ruby
<rking> Another example of << that I don't get: o = Object.new; mc = class << m; self end
<Spaceghostc2c> rking: look up eigenclass.
jtoft has quit [#ruby]
wroathe has joined #ruby
<Spaceghostc2c> You know, someone wrote a book that explains all this.
<rking> I see by playing with it that mc == o.singleton_class, but I don't get the syntax.
<rking> Spaceghostc2c: I'm actually looking up eigenclass stuff at the moment, it's what made me ask about <<.
<Spaceghostc2c> You'll find it in what google should return. It's cool stuff.
<rking> OK, I'll persist, then.
<rking> I could definitely use the leg up of knowing what the LHS and RHS of << mean.
mxweas_ has joined #ruby
k3r0 has joined #ruby
adeponte has joined #ruby
dwon has joined #ruby
silverhand has joined #ruby
josefig has joined #ruby
josefig has joined #ruby
delinquentme has joined #ruby
<delinquentme> OKeeeee lets talk theory ... I'm writing a scraper for academic journal information. I've got Publishers who have journals. journals which have volumes and issues within those volumes ... how to set this up
<delinquentme> class PublisherScraper which gets the urls of all the journals that publisher publishes
<delinquentme> then... do I instantiate a class JournalScraper object from that publisher on getting the journal
<delinquentme> ?
looopy has joined #ruby
KnowTheLedge has joined #ruby
keymone has joined #ruby
CheeToS has joined #ruby
Bauer has joined #ruby
<bounce> sign up for udacity's "cs101: building a search engine".
rtyler has joined #ruby
<rtyler> I'm feeling a bit daft here, is there any way I can default bundler to always install the RI docs for gems it installs?
<delinquentme> Page::Link
<delinquentme> link here is what?
lewis has joined #ruby
<delinquentme> when Page::Link then
MrGando has joined #ruby
zeroeth has joined #ruby
RORgasm has joined #ruby
gtuckerkellogg has joined #ruby
Karmaon has joined #ruby
mbriggs has joined #ruby
danielvdotcom has joined #ruby
apok_ has joined #ruby
netrealm has joined #ruby
<shevy> I believe link is a
<shevy> hmm
<shevy> link
<Sou|cutter> https://gist.github.com/2324019 <-- I have no idea why this segfaults... do rspec and fibers just not play together at all?
tommyvyo has joined #ruby
Bauer1 has joined #ruby
<davidcelis> shevy: false
<davidcelis> shevy: link is a Hylian
headius has joined #ruby
rtyler has quit [#ruby]
sonkei has joined #ruby
<Sou|cutter> headius: do fibers work in jruby?