<ryanf>
I guess it probably doesn't really matter as long as you aren't leaning on it to render an entire page
<ryanf>
the stuff I changed in rumble was mostly in the direction of making it more suitable for little helper methods instead of full templates, since that's the use case I have
<Xeago>
usin rr to mock: I have to stub out a method on a class that gets called on initialization, and mock another method. How would I do this
<judofyr>
Mab/Markaby has the same issues as e.g. tag helpers. I've speed up some Rails pages by moving a #link_to outside a big loop.
<manveru>
you just put the ones you need into the enum array
<zzak>
Uranio: are you using RVM or system ruby?
<Uranio>
I don't know RVM :(
deryl has joined #ruby-lang
<Uranio>
just compile the ruby from source and get the gems with gem
deryl has quit [Client Quit]
ddd has joined #ruby-lang
nitti has joined #ruby-lang
<zzak>
yeh
<zzak>
you can just run rdoc --ri from your source dir then
ruurd has quit [*.net *.split]
Stereokitsune has quit [*.net *.split]
CodeBlock has quit [*.net *.split]
retro|cz has quit [*.net *.split]
KillerFox has quit [*.net *.split]
Stereoki1sune has joined #ruby-lang
CodeBlock__ has joined #ruby-lang
malev has joined #ruby-lang
jxie has joined #ruby-lang
havenn has joined #ruby-lang
solars has quit [Read error: Operation timed out]
<Uranio>
I was thinking about indexing and caching rdoc and stackoverflow with mnogosearch
<Uranio>
that could make me a strong docs base
malev has quit [Ping timeout: 265 seconds]
malev has joined #ruby-lang
roadt has joined #ruby-lang
anannie has quit [Quit: Leaving...]
<zzak>
you want to cache the entire internet on 4gb?
retro|cz has joined #ruby-lang
KillerFox has joined #ruby-lang
malev has quit [Ping timeout: 246 seconds]
dr_bob has joined #ruby-lang
malev has joined #ruby-lang
dr_bob has quit [Client Quit]
kiddorails1 has quit [Ping timeout: 246 seconds]
<Uranio>
I would like to cache stackoverflow and the rdoc downloaded and umcompresed
<Uranio>
all stored in 3 4GB pendrive
JohnBat26 has quit [Ping timeout: 252 seconds]
malev has quit [Ping timeout: 245 seconds]
<Uranio>
rdoc-core and rdoc-stdlib can be downloaded from the site as packeages
yats has quit [Ping timeout: 246 seconds]
yats_ has joined #ruby-lang
<Uranio>
then I strip the js, images and css folder and is very little
Tearan has joined #ruby-lang
<zzak>
why not just generate them?
malev has joined #ruby-lang
<zzak>
it will be more accurate, since its generated on the actual source, and not somebody elses
blazes816 has joined #ruby-lang
<zzak>
ruby-doc is notorious for documentation flaws because the way it is generated doesn't match normal ruby/rdoc usage
malev has quit [Ping timeout: 255 seconds]
malev has joined #ruby-lang
Guest43524 has quit [Quit: Leaving...]
krohrbaugh has joined #ruby-lang
judofyr has quit [Remote host closed the connection]
Tearan has quit [Quit: Sleepy Badger....]
gix has quit [Quit: Client exiting]
Dreamer3 has quit [Ping timeout: 246 seconds]
chin-tastic has joined #ruby-lang
gix has joined #ruby-lang
malev has quit [Ping timeout: 255 seconds]
jgomez has quit [Quit: Leaving]
kain has quit [Ping timeout: 260 seconds]
Dreamer3 has joined #ruby-lang
malev has joined #ruby-lang
robotmay has quit [Ping timeout: 240 seconds]
kiddorails has joined #ruby-lang
<Uranio>
nice point
ryanlecompte has joined #ruby-lang
sn0wb1rd has quit [Quit: sn0wb1rd]
stiang has joined #ruby-lang
robotmay has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 245 seconds]
Mon_Ouie has joined #ruby-lang
Mellett68 has joined #ruby-lang
kiddorails has quit [Ping timeout: 240 seconds]
tenderlove has joined #ruby-lang
malev has quit [Ping timeout: 240 seconds]
malev has joined #ruby-lang
prathamesh_ has quit [Quit: Leaving]
__butch__ has joined #ruby-lang
alvaro_o has joined #ruby-lang
kain has joined #ruby-lang
bfreeman has joined #ruby-lang
chin-tastic has quit [Ping timeout: 240 seconds]
replore_ has quit [Remote host closed the connection]
pbjorklund has quit [Read error: Connection reset by peer]
pbjorklund has joined #ruby-lang
<Uranio>
there is a -O and -o option in rdoc...
Bwild has quit [Read error: Operation timed out]
Bwild has joined #ruby-lang
yxhuvud has joined #ruby-lang
kain has quit [Ping timeout: 265 seconds]
yats__ has joined #ruby-lang
yats_ has quit [Ping timeout: 248 seconds]
ruurd has joined #ruby-lang
sn0wb1rd has joined #ruby-lang
roadt has quit [Ping timeout: 260 seconds]
gnufied has quit [Quit: Leaving.]
Serial_Killer_C has joined #ruby-lang
malev has quit [Remote host closed the connection]
davidbalbert has quit [Excess Flood]
davidbalbert has joined #ruby-lang
stiang has quit [Quit: stiang]
<whitequark>
hmm
<whitequark>
how exactly Array#uniq works?
<whitequark>
or, in other words, how do I tell it that these two objects are actually equal?
<whitequark>
#eql?.
<erikh>
IIRC, yeah
<erikh>
either that or ==
malev has joined #ruby-lang
pkondzior_ has joined #ruby-lang
burgestrand has joined #ruby-lang
pkondzior_ has quit [Client Quit]
<whitequark>
erikh: well, I verified
cdt has quit [Quit: Ex-Chat]
<erikh>
I always have to look too. Ruby isn't crystal clear when it comes to that kind of stuff
<zzak>
whitequark: it uses Object#eql when comparing their hashes
yats__ has quit [Ping timeout: 255 seconds]
<totallymike>
Hi there. What's a good way to automate testing of pages that load static assets? Specifically when those assets are served by nginx and not the app itself.
<zzak>
totallymike: try #rubyonrails
<totallymike>
I'm not using rails.
Benyhex has joined #ruby-lang
<ddd>
or #sinatra or #ramaze
<ddd>
but I would look at: ri Benchmark
kain has joined #ruby-lang
<erikh>
use curl or mechanize
Tearan has joined #ruby-lang
<whitequark>
erikh: well, it's not obvious, but it makes a lot of sense indeed
headius has joined #ruby-lang
<whitequark>
and it's mostly not obvious because we tend not to think about this at all.
<whitequark>
I'm pretty sure that eql? stands for equivalent?, and equal? should have a big fat note "IMPLEMENTATION DEFINED"
<whitequark>
it's not even used by Ruby itself AFAIK (unless you count hacks like ObjectSpace and so)
<erikh>
it's not obvious because it's not very well documented in a central place.
<whitequark>
this too.
<erikh>
also none of the calls that use these structual bits fail to indicate what they use in the documentation.
<erikh>
ergo, RTFS, which isn't really a solution
<whitequark>
it's not. I looked up the source and it wasn't immediately clear for me
<whitequark>
even through I have months of experience digging in MRI source
<zzak>
for #eql implementation?
<whitequark>
zzak: naw, Array#uniq
mrsolo has joined #ruby-lang
<whitequark>
it has some deeply nested magic calls which kind of operate an implicit hash inside an array
<whitequark>
at first I thought that just reimplementing #hash would be enough
<whitequark>
but one should have both #eql? and #hash
yats__ has joined #ruby-lang
<erikh>
zzak: it's not about the calls themselves, but what they semantically associate to and what calls that depend on them actually use
lcdhoffman has quit [Quit: lcdhoffman]
<erikh>
I mean, Array#uniq could have easily used == and nobody would have been the wiser without looking at the uniq source
nitti has quit [Remote host closed the connection]
<zzak>
from ruby-trunk: It compares elements using their hash (provided by the Object#hash method) then compares hashes with Object#eql?.
<ridders24>
how can i copy all the contents of a public twitter profile including the replies. the twitter API doesnt seem to support including replies in the timeline
nitti has joined #ruby-lang
slaytani1 has joined #ruby-lang
kain has joined #ruby-lang
slaytanic has quit [Ping timeout: 260 seconds]
leopard_me has joined #ruby-lang
leopard_me has quit [Client Quit]
nitti has quit [Ping timeout: 244 seconds]
robotmay has quit [Remote host closed the connection]
thatdutchguy has joined #ruby-lang
kain has quit [Ping timeout: 246 seconds]
runeb has quit [Remote host closed the connection]
dfanjul has joined #ruby-lang
irleif has quit [Quit: Computer has gone to sleep.]
yats_ has quit [Ping timeout: 265 seconds]
nitti has joined #ruby-lang
musl has quit [Quit: Upgrades.]
havenn has quit [Remote host closed the connection]
kain has joined #ruby-lang
savage- has joined #ruby-lang
ryanlecompte has quit [Ping timeout: 246 seconds]
runeb has joined #ruby-lang
irleif has joined #ruby-lang
anannie has joined #ruby-lang
areil has quit [Remote host closed the connection]
sepp2k1 has quit [Ping timeout: 246 seconds]
runeb has quit [Ping timeout: 272 seconds]
kain has quit [Ping timeout: 260 seconds]
carloslopes has quit [Quit: Leaving.]
ridders24 has quit [Ping timeout: 276 seconds]
ridders24 has joined #ruby-lang
sepp2k has joined #ruby-lang
dfanjul has quit [Quit: leaving]
* whitequark
. o O ( I hate unix with every Fiber of my being. )
* whitequark
has included EM::Synchrony somewhere really, really deep inside him.
burgestrand1 has joined #ruby-lang
wyhaines_ has joined #ruby-lang
cdt has joined #ruby-lang
sush24_ has joined #ruby-lang
swarley has joined #ruby-lang
ridders24 has quit [Quit: Leaving]
burgestrand has quit [Ping timeout: 240 seconds]
sush24 has quit [Ping timeout: 265 seconds]
wyhaines has quit [Ping timeout: 246 seconds]
havenn has joined #ruby-lang
sush24_ has quit [Client Quit]
havenn_ has joined #ruby-lang
cdt has quit [Ping timeout: 252 seconds]
Uranio has quit [Quit: WeeChat 0.3.8]
qpingu has joined #ruby-lang
musl has joined #ruby-lang
Serial_Killer_C has quit [Remote host closed the connection]
havenn_ has quit [Ping timeout: 246 seconds]
siyusong has joined #ruby-lang
Serial_Killer_C has joined #ruby-lang
musl has quit [Client Quit]
kain has joined #ruby-lang
Serial_Killer_C has quit [Remote host closed the connection]
kiddorails has quit [Quit: Leaving.]
burgestrand has joined #ruby-lang
thatdutchguy has quit [Remote host closed the connection]
Hakon has joined #ruby-lang
burgestrand1 has quit [Read error: Operation timed out]
tenderlove has quit [Remote host closed the connection]
Hakon is now known as Hackon
rippa has quit [Ping timeout: 260 seconds]
cdt has joined #ruby-lang
Hackon is now known as Hakon
Axsuul has joined #ruby-lang
Tearan has quit [Quit: Sleepy Badger....]
kain has quit [Ping timeout: 240 seconds]
groszek has joined #ruby-lang
slaytani1 has left #ruby-lang [#ruby-lang]
sandbags has joined #ruby-lang
<groszek>
Hi. does anyone know a gem that could parse advanced search, such as (q:"foo"|q:"bar")&(n:123|n:333|n:666) into meaningful data, suitable to throw at database? Of course the input is untrusted, so simple regexp+let database handle it won't do...
ruurd has quit [Quit: Leaving...]
ruurd has joined #ruby-lang
<groszek>
the exact "language" used in search query doesn't matter, it's just an example. maybe there is something simillar already done?
havenn_ has joined #ruby-lang
chin-tastic has quit [Ping timeout: 246 seconds]
<swarley>
groszek; that would be something that would have to be handled at the database level
cdt has quit [Ping timeout: 252 seconds]
<swarley>
you can't simplify something when you don't know what you're simplifying it for
<groszek>
for now i started writing something that will make sure all key:value pairs match what the database has, cleaning the input from any sql injection.. but i don't think it's very elegant
havenn_ has quit [Ping timeout: 260 seconds]
<swarley>
SQL should have a REGEX module
ryanlecompte has joined #ruby-lang
<swarley>
SQLite at least does
<bougyman>
postgres does.
cdt has quit [Ping timeout: 252 seconds]
<groszek>
no no, i don't need regex at database level. I want to extract any text input thrown at it into more elegant data, that i could then throw at any ORM
<groszek>
if possible
<groszek>
just native ruby data, not a SQL in string that i'll just pass to the database
<groszek>
welp, that's what I am working on, since I have no better idea, but I don't like that solution ;)
anannie has quit [Remote host closed the connection]
<swarley>
so..
<swarley>
what are you doing?..
<swarley>
lol
savage- has quit [Ping timeout: 256 seconds]
<swarley>
you can't expand regex
tdy_ has joined #ruby-lang
<groszek>
well, how would you express something like my example above in pure ruby? assuming the keys are actually variables, or keys in a hash.
<groszek>
i know it would be valid by itself, as a conditional, but it's untrusted data here
irleif has quit [Quit: Computer has gone to sleep.]
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
musl has quit [Client Quit]
<swarley>
what does q: signify?
<groszek>
a key called "q"
rolfb has quit [Quit: Leaving...]
musl has joined #ruby-lang
kain has joined #ruby-lang
<swarley>
you could do something like {:q => ["foo", "bar"], :n => [123, 333, 666]} i suppose
<groszek>
makes sense; what if we want to allow any number of levels within parenthesis? e.g. (q:foo | (q:bar | n:5 | (n:1 & z:lol)))
<swarley>
does nesting matter?
Serial_Killer_C has joined #ruby-lang
<groszek>
sorry?
Serial_Killer_C has quit [Remote host closed the connection]
carloslopes has joined #ruby-lang
<Mon_Ouie>
You could also use Or and And classes to represent those composition types, and a KeyEquality as a primitive check
<swarley>
you might want to look into treetop if you're going for syntax that deep
malev has quit [Ping timeout: 260 seconds]
mwjcomputing has quit [Quit: Leaving]
malev has joined #ruby-lang
<groszek>
looks promising, i'll check it
imajes has quit [Excess Flood]
Serial_Killer_C has joined #ruby-lang
imajes has joined #ruby-lang
Tearan has joined #ruby-lang
<whitequark>
groszek: you do not parse context-free languages with regexen
<whitequark>
look at either treetop (simpler) or ragel+racc (faster)
<whitequark>
you just cannot parse your language with only regular expressions, as [canonical] regexps (which are called regular because they match regular languages) cannot correctly match anything that includes balanced parentheses (which move the language to, at least, context-free domain)
<whitequark>
basically a regexp is an FSM which has a bound number of states, and matching balanced whatever requires an unbound number of states
<whitequark>
if your current position is @, then "(@" and "((((@" and "((((((()@" are different states
<whitequark>
this problem is solved by adding stack to the mix
benanne has joined #ruby-lang
<whitequark>
and so, usually this is implemented by bison/yacc/ragel (ragel is the most recent and sane) as "lexer", i.e. the regexp part
<whitequark>
errrr
<whitequark>
flex/ragel
<whitequark>
and bison/yacc/racc (racc is bison for ruby) as "parser", i.e. the stack part
<groszek>
heh. I wanted to spend a nice evening writing an advanced search for my webapp ;)
<whitequark>
I've just realized that one can banish ! operator completely from a programming language and still be able to express arbitrary boolean expressions
<whitequark>
given that the `unless' construct is present
<whitequark>
and even more importantly, this would lead to significantly more readable code.
* whitequark
has tried to understand what exactly "if !group_loop.index > 0" means. it took three attempts.
lcdhoffman has joined #ruby-lang
<drbrain>
whitequark: I have been stumbling through some of that
macmartine has joined #ruby-lang
<whitequark>
or you should read that "intended to mean". obviously that condition is broken and always raises an error
irleif has quit [Quit: Computer has gone to sleep.]
<pabs>
whitequark: in ruby that's an error
<whitequark>
pabs: in my homegrown language with operator priorities blatantly stolen from ruby it is as well
Kingy has quit [Quit: Leaving]
<whitequark>
and I believe that practically everywhere ! has higher priority than <=>
<injekt>
I know people who don't, nor ever will use 'unless'
mytrile has quit [Read error: Connection reset by peer]
<whitequark>
injekt: well, I know people who refuse to program in anything except assembler and Ada
<whitequark>
so?..
<headius>
I like unless…else…end for maximum confusion factor
<injekt>
^
<whitequark>
headius: when used correctly, unless..else is less confusing than the opposite
<injekt>
whitequark: that's not really the same thing
<injekt>
and I disagree
<headius>
whitequark: I can't imagine such a case
<injekt>
I think unless is incredibly confusing in 90% of use cases
<whitequark>
headius: I can't pull one from the top of my mind, but I did write a few in my life
Assurbanipal has quit [Quit: Konversation terminated!]
<tdy>
why use unless if there's an "else"
<headius>
any case that does unless…else…end would be better having the bodies flipped and using if
<whitequark>
injekt: unless..else maybe, simple unless is definitely not
<groszek>
unless !foo != true
<headius>
unless is obviously clear in postfix form, and usually clear in block form
<headius>
unless…else always twists my brain though
<tdy>
yep
<injekt>
in postfix form i find it really readable
<tdy>
i only like it postfix
<whitequark>
groszek: my codegen engine wraps everything in a boolean conversion... like this: if !!(!!(!is_empty(x)) && !!(!is_empty(y)))
<injekt>
block is.. okay, else is confusing
itz has quit [Ping timeout: 245 seconds]
<headius>
ttfn
headius has quit [Quit: headius]
itz has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
<erikh>
I avoid postfix conditionals and use of unless in large chains of conditionals
<erikh>
I don't consider them blasphemy or anything, but it doesn't take running across too many abuses of them to understand why they're to be avoided
<erikh>
also: nested ternary
<erikh>
but that one's so obvious you should be hurt for thinking it might be a good idea
<groszek>
haha... I once wrote an IRC bot entirely in one ternary operator
<groszek>
(well, with one infinite loop outside)
<erikh>
like, larry wall should just appear from the heavens and lart you to death
swarley has quit [Quit: Leaving]
<whitequark>
groszek: you can avoid the infinite loop by using callcc.
<groszek>
it was in php :P
<whitequark>
oh crap
<whitequark>
this way it doesn't even matter that it was a ternary one-liner
Carnage\ has quit []
<erikh>
irc bot, php, nested ternary
ruurd has quit [Quit: Leaving...]
justinram has quit [Remote host closed the connection]
<groszek>
actually it's one of the things I'm most proud of, right after recursive lambda in erlang :P
<erikh>
I'm scared to see the things you're not proud of
esad has joined #ruby-lang
bfreeman has quit [Quit: bfreeman]
<whitequark>
groszek: recursive lambda? as in K or Y combinator?
AlHafoudh has quit [Quit: Computer has gone to sleep.]