naz has quit [Read error: Connection reset by peer]
justinseiter has joined #ruby-lang
headius has quit [Quit: headius]
Guedes has joined #ruby-lang
S1kx has joined #ruby-lang
S2kx has quit [Ping timeout: 264 seconds]
<zenspider>
flibitijibibo: aaaand... nothing.
krzkrzkrz has joined #ruby-lang
krz has quit [Ping timeout: 246 seconds]
krzkrzkrz is now known as krz
gsav has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
justinseiter has quit [Ping timeout: 248 seconds]
krz has quit [Ping timeout: 250 seconds]
krzkrzkrz is now known as krz
mikenz00001 has quit [Quit: Page closed]
imperator has quit [Quit: Leaving]
lcdhoffman has quit [Quit: lcdhoffman]
<zenspider>
RAWR!
<zenspider>
holy shit
<zenspider>
I'm down to just ruby2ruby not being parsable by ruby19parser
savage- has quit [Read error: Operation timed out]
qpingu has quit [Quit: Leaving.]
headius has joined #ruby-lang
S1kx has quit [Read error: Connection reset by peer]
qpingu has joined #ruby-lang
<zenspider>
oooh... and that one looks like it might be easy too!
<zenspider>
god this new process is awesome
S1kx has joined #ruby-lang
<zenspider>
very very very efficient
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
<ged>
zenspider: Which new process?
mrsolo has quit [Quit: Leaving]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
<zenspider>
I've got a new script called ruby_parse_extract_errors which "magically" reduces the code being parsed down to the combination of methods that will cause the parse error
mistym has quit [Remote host closed the connection]
<zenspider>
as such, I can scan through my projects using a simple shell script and it'll spit out all the errors reduced down as much as possible
mistym has joined #ruby-lang
mistym has joined #ruby-lang
<zenspider>
then extracting the essence of the error is really easy
<ged>
Wow, neat!
<zenspider>
that, and I have some scripts to normalize racc vs yacc output to make things much more clean and comparable so I can hone in on where things went wrong ...
<zenspider>
takes me a couple minutes instead of an hour
<zenspider>
aaaand there goes the last one!
<ged>
Very nice.
<zenspider>
holy crap. I can parse all my projects using the 1.9 parser ... finally
spuk has joined #ruby-lang
nofxxxx has quit [Ping timeout: 255 seconds]
gix has quit [Ping timeout: 264 seconds]
krzkrzkrz has joined #ruby-lang
<zenspider>
ruby_parser 3.0.0.a5 released
<zenspider>
rawr
virunga has quit [Quit: Sto andando via]
ltd has quit [Ping timeout: 256 seconds]
krz has quit [Ping timeout: 246 seconds]
krzkrzkrz is now known as krz
gix has joined #ruby-lang
dous has quit [Remote host closed the connection]
krzkrzkrz has joined #ruby-lang
nertzy has joined #ruby-lang
lcdhoffman has joined #ruby-lang
seanstickle has quit [Quit: seanstickle]
krz has quit [Ping timeout: 252 seconds]
krzkrzkrz is now known as krz
bryancp has joined #ruby-lang
bryancp has quit [Remote host closed the connection]
bryancp has joined #ruby-lang
nofxxxx has joined #ruby-lang
headius has quit [Quit: headius]
timepilot has joined #ruby-lang
towski has quit [Remote host closed the connection]
<burgestrand>
Can I build a gem for another platform than my current one?
<burgestrand>
Or, how?
yugui is now known as yugui_zzz
bfreeman_ has joined #ruby-lang
bfreeman has quit [Read error: Connection reset by peer]
jtoy has quit [Quit: jtoy]
s0ra_h is now known as sora_h
bfreeman_ has quit [Client Quit]
Nisstyre has quit [Read error: Connection reset by peer]
yugui_zzz is now known as yugui
Nisstyre has joined #ruby-lang
flibitijibibo has left #ruby-lang ["Left Channel"]
justinseiter has joined #ruby-lang
ryanf has quit [Quit: Lost terminal]
ryanf has joined #ruby-lang
verbad has joined #ruby-lang
sora_h is now known as s0ra_h
wallerdev has quit [Read error: Connection reset by peer]
kain has quit [Quit: This computer has gone to sleep]
kain has joined #ruby-lang
sevvie has joined #ruby-lang
cha1tanya has joined #ruby-lang
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby-lang
igotnolegs has quit [Quit: Computer has gone to sleep.]
robbyoconnor has joined #ruby-lang
Fullmoon has joined #ruby-lang
rutkla has joined #ruby-lang
WillMarshall has quit [Read error: Connection reset by peer]
mikenz has quit [Quit: Leaving.]
heftig has joined #ruby-lang
zmack has quit [Remote host closed the connection]
dous has quit [Remote host closed the connection]
gsav has joined #ruby-lang
tomzx_ has joined #ruby-lang
wallerdev has joined #ruby-lang
WillMarshall has joined #ruby-lang
andrewhl has quit [Remote host closed the connection]
andrewhl has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
andrewhl has quit [Remote host closed the connection]
andrew___ has joined #ruby-lang
jxie has quit [Read error: Connection reset by peer]
jxie has joined #ruby-lang
Fretta has quit [Quit: Fretta]
leriksenau has joined #ruby-lang
s0ra_h is now known as sora_h
dhruvasagar has quit [Read error: Connection reset by peer]
dhruvasagar has joined #ruby-lang
kristofferrr has joined #ruby-lang
neoesque has quit [Quit: Bye!]
rutkla has quit [Ping timeout: 240 seconds]
umttumt has joined #ruby-lang
neoesque has joined #ruby-lang
rubyjunkie has joined #ruby-lang
savage- has quit [Remote host closed the connection]
<kristofferrr>
Hi guys, I'm having a problem with .first() not selecting the amount of results passed to it. Code and further explanation at http://pastie.org/private/8tgsguxtzk5mwdubid4q4q - anyone got an idea what's going on?
Oloryn_lt2 has quit [Read error: Connection reset by peer]
sora_h is now known as s0ra_h
banisterfiend has joined #ruby-lang
andrew___ has quit [Remote host closed the connection]
kitallis has joined #ruby-lang
savage- has joined #ruby-lang
dous has joined #ruby-lang
solars has joined #ruby-lang
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
workmad3 has joined #ruby-lang
WillMarshall has quit [Read error: Connection reset by peer]
ruurd has joined #ruby-lang
workmad3 has quit [Ping timeout: 252 seconds]
tenderlove has quit [Remote host closed the connection]
kalleth has quit [Ping timeout: 252 seconds]
leriksenau has quit [Remote host closed the connection]
Z33K|Lux has quit []
leriksenau has joined #ruby-lang
rutkla has joined #ruby-lang
rubyjunkie has quit [Ping timeout: 264 seconds]
tomzx_ has quit [Ping timeout: 246 seconds]
vmoravec has quit [Remote host closed the connection]
dc5ala has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
headius has joined #ruby-lang
diegoviola has quit [Ping timeout: 264 seconds]
srbartlett has quit [Remote host closed the connection]
gsav has quit [Ping timeout: 252 seconds]
savage- has quit [Remote host closed the connection]
leriksenau has quit [Quit: leriksenau]
s0ra_h is now known as sora_h
heftig has quit [Ping timeout: 272 seconds]
umttumt has quit [Remote host closed the connection]
headius has quit [Quit: headius]
umttumt has joined #ruby-lang
Machiavelli43 has joined #ruby-lang
sora_h is now known as s0ra_h
brianpWins has quit [Quit: brianpWins]
sevvie has quit [Quit: sevvie]
jxie has quit [Quit: leaving]
Machiavelli43 has left #ruby-lang [#ruby-lang]
mssola has joined #ruby-lang
judofyr has joined #ruby-lang
kain has quit [Quit: This computer has gone to sleep]
cha1tanya has quit [Ping timeout: 255 seconds]
robin850 has joined #ruby-lang
woollyams has quit [Quit: Computer has gone to sleep.]
gnufied has joined #ruby-lang
zmack has joined #ruby-lang
zmack_ has joined #ruby-lang
<ramonmaruko>
Hello, is it possible to get the ctime of a File with a nanosecond precision for 1.8.7?
zmack has quit [Ping timeout: 260 seconds]
fgomez has quit [Ping timeout: 260 seconds]
kalleth_ has joined #ruby-lang
kalleth_ has quit [Remote host closed the connection]
workmad3 has joined #ruby-lang
<rue>
You can try #to_f if the underlying system supports it, but I’m not certain
cantonic_ has joined #ruby-lang
<ramonmaruko>
tried ctime.to_f and it still doesn't detect the difference between the two points in time I'm interested in
<ramonmaruko>
works fine for 1.9.2, however
Criztian has joined #ruby-lang
cantonic has quit [Ping timeout: 252 seconds]
cantonic_ is now known as cantonic
cha1tanya has joined #ruby-lang
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby-lang
zz_chrismcg is now known as chrismcg
Hakon has joined #ruby-lang
dous has quit [Remote host closed the connection]
physicist has joined #ruby-lang
physicist has quit [Client Quit]
robotmay has joined #ruby-lang
umttumt has quit [Remote host closed the connection]
neocoin has quit [Remote host closed the connection]
neocoin has joined #ruby-lang
neocoin has quit [Read error: Connection reset by peer]
neoesque has quit [Quit: Bye!]
dRbiG has quit [Ping timeout: 252 seconds]
virunga has joined #ruby-lang
dRbiG has joined #ruby-lang
LnL has joined #ruby-lang
jordan` has quit [Ping timeout: 248 seconds]
jordan` has joined #ruby-lang
jxie has joined #ruby-lang
s0ra_h is now known as sora_h
charlies_ is now known as charliesome_
judofyr_ has joined #ruby-lang
judofyr has quit [Read error: Connection reset by peer]
abletony84 has joined #ruby-lang
sora_h is now known as s0ra_h
s0ra_h is now known as sora_h
facest has quit [Ping timeout: 255 seconds]
faces has joined #ruby-lang
<abletony84>
Hi, I just did a "gem install rails" here on OpenBSD, but I'm getting zsh: command not found: rails - anybody know what's up? I've never had to add any paths to dotfiles for this kinda stuff.
LnL has quit [Quit: Leaving]
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
guns has quit [Ping timeout: 246 seconds]
<kristofferrr>
I'm having a problem with .first() not selecting the amount of results it should. Code and further explanation at http://pastie.org/private/8tgsguxtzk5mwdubid4q4q - has anyone got an idea about what's going on?
krz has quit [Read error: Connection reset by peer]
krz has joined #ruby-lang
<jasiek>
where can i find more information about the rb_exc_new* family of functions? i'm trying to modify the behavior of the built-in Enumerator class.
andrew___ has quit [Remote host closed the connection]
andrew___ has joined #ruby-lang
andrew___ has quit [Remote host closed the connection]
AlHafoudh has joined #ruby-lang
abletony84 has quit [Quit: leaving]
gsav has joined #ruby-lang
dc5ala has quit [Quit: Ex-Chat]
bryancp has joined #ruby-lang
virunga has joined #ruby-lang
BlackShadow has joined #ruby-lang
kristofferrr has quit [Ping timeout: 240 seconds]
ryez has joined #ruby-lang
rolfb has joined #ruby-lang
gnufied1 has joined #ruby-lang
gnufied has quit [Read error: Connection reset by peer]
abletony84 has joined #ruby-lang
<abletony84>
Anybody know why the libv8 gem won't build? https://gist.github.com/3226160 - it says "Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher" but I already have gcc-4.6.2.
kvirani has joined #ruby-lang
Jake232 has joined #ruby-lang
<Jake232>
How can is it that with nokogiri I can run MyModule::MyClass(html_string), and it works
<Jake232>
without calling a metohod?
<Jake232>
NokoGiri::HTML(html) does the same as NokoGiri::HTML.parse(html)
<judofyr>
Jake232: Nokogiri.HTML(html) also works
toretore has joined #ruby-lang
<judofyr>
Jake232: class Nokogiri; def self.HTML(s) … end end
<judofyr>
it's just a regular method
<virunga>
abletony84: did you put the gcc's path in the PATH env variable?
<rue>
Ninjaboy!
<judofyr>
Jake232: although it's not used often, :: can be used to call class methods: s = String::new
<Jake232>
But what about the ::, that's for namespacing? You can't call a method with it can you?
<Jake232>
Oh
<Jake232>
That explains it then
<rue>
I kinda prefer to use the #parse… it looks weird just namespaced
<Jake232>
I pressumed that Nokogiri::HTML was a class, rather than a method
<judofyr>
it's a class too
<judofyr>
Nokogiri::HTML is a class, Nokogiri::HTML() is a method call
<abletony84>
virunga: yup
<judofyr>
methods and classes lives in different namespaces
<Jake232>
So I can have a class with the same name as a method?
<judofyr>
as long as the class name is uppercase, yes
<Jake232>
And, parenthesis are optional in ruby, so how would it know whether you wanted the method or the class?
<whitequark>
Jake232: when method begins with an uppercase letter, no way
<judofyr>
Jake232: parenthesis are not optional when you use :: and the method begins with an uppercase
<apeiros_>
judofyr: you can even call normal methods with it
<Jake232>
Ahh, where can I read up on this? I've never even seen uppercase methods before
<Jake232>
and I've been using Ruby for months now
<rue>
You should always, always, use parentheses with the capitalized methods
<judofyr>
apeiros_: makes sense. I've never seen it before though.
<judofyr>
apieros*
<rue>
Like Integer("1") and so on…
<rue>
Hahaa
<apeiros_>
Jake232: um, method names are only restricted to start with [A-Za-z_]
<apeiros_>
other than that, I'm not aware of any limitation
<judofyr>
well, strictly speaking method names can be anything as long as you use send/define_method…
<apeiros_>
and those limitations even only apply to methods you want to be able to invoke without send. with send, every valid symbol is a valid method name afair
<judofyr>
;)
kvirani has quit [Remote host closed the connection]
<oddmunds>
apeiros_: what about methods named [], +, etc?
<judofyr>
oddmunds: ah, those are special :)
<judofyr>
+@, -@ are even more special
<oddmunds>
they're not normal methods?
tommyvyo has joined #ruby-lang
<apeiros_>
they're normal methods with special syntax
<judofyr>
yes
<oddmunds>
ruby is so consistent – on the surface
dous has quit [Remote host closed the connection]
<rue>
1.-@
<apeiros_>
heh
<judofyr>
they don't follow the [A-Za-z_]-rule
<judofyr>
rue: +1.-@.!
<rue>
!
<judofyr>
+1.-@.!::!
<apeiros_>
lets say ruby sacrifices a little bit of consistence for a little bit of convenience.
<oddmunds>
1.O
<apeiros_>
I'd say it's nicer to be able to write x = -a instead of x = a.negative
<apeiros_>
(or negated? whatever)
<oddmunds>
yeah
<oddmunds>
does the can you write '- a' or does it have to be '-a'?
<rue>
Try it
<judofyr>
+0.-@::!? ?::1
<oddmunds>
-"does the"
<rue>
Should always -a, of course.
<darix>
apeiros_: i think there was already a discussion to allow more characters in method names and such. so you could actually use the lambda symbol
<rue>
darix: You can
<apeiros_>
darix: I don't know how it is in 1.9, but in 1.8, you could
<workmad3>
apeiros_: you can use unicode characters in method and variable names in 1.9
<Jake232>
I don't think particulary many people use Ruby where they need gaurenteed speed though
<Jake232>
Or if they do, it's ussually a library with C bindings
<whitequark>
Jake232: and I think there's no real reason for that, except that no one has written a fast enough Ruby yet
<whitequark>
well, there's a nuance, as usual: my implementation will probably never run Rails, at least not in foreseeable future
<Jake232>
It's the same with all dynamic languages, not just Ruby, and you're correct, I guess that is the reason. I think the reason people enjoy dynamic lanuages though for the ease of use and the fact they do things for you
<Jake232>
is what makes them so incredibly hard to make fast
<whitequark>
but if you need something to crank the data with the speed of C, it'll be the right tool to use
<whitequark>
Jake232: look up Smalltalk or Scheme implementations
<whitequark>
some of them are _very_ fast
<whitequark>
1.5x slower than C, for example
<whitequark>
both are incredibly dynamic
Mon_Ouie has quit [Ping timeout: 264 seconds]
Mon_Ouie has joined #ruby-lang
<workmad3>
whitequark: both of them have also had a long, long time to get good VMs for the language
<Jake232>
Pythons PyPy is nice, however it restricts the 'dynamicness' of the language significantly
<whitequark>
workmad3: indeed. and Ruby isn't particularly new either
zenspider has quit [Read error: Connection reset by peer]
<workmad3>
whitequark: true, but the main implementation has only recently moved to using a VM internally
<whitequark>
*shrug* so what? MRI's main goal is being a reference
<Jake232>
Rubinius has made a good go at making Ruby faster right? I've never used it
<Jake232>
but from what I've heard it's significanlty faster
<whitequark>
in my experience, it's 2x slower than MRI at real workloads
sepp2k1 has joined #ruby-lang
<whitequark>
depends heavily on the workload, I've measured that on my decompiler
<workmad3>
whitequark: yeah, I was meaning more that, while the language isn't new (although still newer than smalltalk and scheme), the runtime technology is still quite young in comparison
<whitequark>
it's so CPU and GC-heavy so it checks your RAM better than memtest86+
<whitequark>
workmad3: basic principles of translating and optimizing dynamic languages didn't change significantly in last 20 years or so
<whitequark>
maybe 30.
<rue>
You can’t lump dynamic languages together
s0ber has joined #ruby-lang
<whitequark>
Lars Bak and his excellent JVM/V8 work is all based on his thesis from beginning of '90's
<Harzilein>
hi
sepp2k has quit [Ping timeout: 264 seconds]
<Harzilein>
is there a nice gem that allows me to replace huge static case or elsif with something dynamic?
<Harzilein>
i'd like that replaced with something object oriented, so the matcher captures can be separated
burgestrand has joined #ruby-lang
<whitequark>
rue: of course
sevvie has joined #ruby-lang
<whitequark>
rue: but implementing a good compiler is a research-heavy task in the first place
rippa has joined #ruby-lang
<whitequark>
the implementation itself isn't easy too, but the hardest part was determining the principles. it's done already.
<rue>
Eugh
<whitequark>
with LLVM, you also have like half of optimizing done for you, too
<rue>
That’s really just not true
<Jake232>
You make it sound like a easy task ;)
<whitequark>
you don't need to care about peculiarities of your target architecture. just focus on your language
<whitequark>
rue: what exactly?
<Harzilein>
anyome?
<Harzilein>
anyone*
<rue>
In the case of 85% Ruby, maybe. But shit just doesn’t get ‘done for you’ if the model doesn’t fit
<rue>
Harzilein: You can hide the stuff, and go with something like consts[tt].call, and stuff methods or procs in there
<rue>
But that’s not necessarily any better.
<whitequark>
rue: everything that generates x86 code will benefit from generic x86 optimizations
<whitequark>
substitute x86 for any arch that LLVM supports, and that's what I mean
<whitequark>
LLVM doesn't understand anything about your dynamic language, of course.
<rue>
I don’t think Ruby’s problem is x86 optimization
<whitequark>
that's up to you. but at least you get spared of writing numerous backends for every architecture out there
<Harzilein>
rue: well, it'd already be sufficient if it allows for easy compositing of the list of matchers throug monkey-patching, of course some kind of full-blown dsl would be nice as well
<whitequark>
rue: of course. but any implementation which is going to be fast should do JIT or AOT, and that's pretty much solved for you.
<rue>
Assuming your runtime model supports it
<whitequark>
exactly
<rue>
I mean, you’re not wrong about the benefits of LLVM
<rue>
But it’s *so* far from being a magic bullet it’s not funny
<whitequark>
I never said it's a magic bullet
<whitequark>
it's an excellent tool for translating your pseudocode to target assembly. just that and nothing more
<rue>
Let’s say that your initial statement could be read as slightly too optimistic.
<whitequark>
ok
<whitequark>
as per runtime model, my plan is to support AOT targets only.
<whitequark>
JIT is a domain of Rubinius and JRuby, and they do it really well. I'm no match for JVM dev team.
mztriz has joined #ruby-lang
<whitequark>
but I'm pretty sure that I will be able to make a translator which will allow you to program a microcontroller with 8 kilobytes of RAM in Ruby.
<rue>
In a subset of Ruby
<whitequark>
let's say that the word "Ruby" refers to the ISO-standardized language
<yorickpeterse>
andkerosine: needs more obfuscation
<andkerosine>
Obfuscation?
<andkerosine>
It looks like a shell stream?
<yorickpeterse>
as in, even less descriptive method names :)
<whitequark>
EPIC
<yorickpeterse>
(I'm mostly joking here)
<yorickpeterse>
But the idea is pretty neat
<andkerosine>
whitequark: Can't tell if serious...
<yorickpeterse>
andkerosine: can't you replace `-> arg` with just `->`?
<yorickpeterse>
Or is that meant to call Proc#arg?
<cout>
andkerosine: it's interesting, but if something goes wrong, debugging is going to be a pain
<andkerosine>
It certainly /looks/ pretty, but that's not supposed to count for much.
dous has joined #ruby-lang
<cout>
that's no problem though if you're like me and write perfect code the first time every time :)
Jay_Levitt has joined #ruby-lang
erikh has quit [Ping timeout: 252 seconds]
<whitequark>
andkerosine: well, I'm serious that it's epic indeed
<whitequark>
"epic" != "good for any actual use"
<andkerosine>
Raskell?
<cout>
whitequark: um, epic means big
<whitequark>
cout: ah.
<whitequark>
whatever
<andkerosine>
yorickpeterse: Unless I've misunderstood how this works, the Procs need to keep chaining and taking a single argument until they get to the <, where the cumulative Proc is the one that gets applied.
<whitequark>
bonus points for adding arguments to the mix
<whitequark>
let me try doing it
voker57 has joined #ruby-lang
voker57 has quit [Changing host]
voker57 has joined #ruby-lang
<andkerosine>
Involves monkey-patching Array to behave differently when the first element is a Symbol, unless I've overlooked something.
<whitequark>
oh, I'm going to use a slightly different approach
<andkerosine>
I like the aesthetics, but it's a terrible idea. : )
Jake232 has quit [Quit: Computer has gone to sleep.]
savage- has joined #ruby-lang
dous has joined #ruby-lang
<certainty>
andkerosine: nah, it isn't. Symbolic computation :p
<certainty>
i'm not serious of course. But it shows some great oportunities. Could be a neat part of a dsl
justinseiter has joined #ruby-lang
<andkerosine>
Everything's better with a fancy name.
ttilley_off is now known as ttilley
<andkerosine>
It actually is kind of reasonable for relatively simple chains, but allowing for arguments or other more dynamic behavior quickly makes it too ugly to defend.
<andkerosine>
It's really unfortunate that operators can't begin on a new line, or it might actually be feasible.
savage- has quit [Read error: Connection reset by peer]
savage- has joined #ruby-lang
<jasiek>
how do i report a feature i'd like to have added to mri? i've a working patch ready.
ttilley is now known as ttilley_off
<banisterfiend>
jasiek: cool what does it do
mr_porter_duff has joined #ruby-lang
krz has joined #ruby-lang
<jasiek>
adds a method called source to StopIteration that returns the enumerator responsible for raising an exception. useful for when you iterate over a number of collections (merging multiple files, etc)
cha1tanya has quit [Ping timeout: 240 seconds]
fgomez has joined #ruby-lang
fgomez has quit [Remote host closed the connection]
bryancp has quit [Remote host closed the connection]
dv310p3r has joined #ruby-lang
fgomez has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
ttilley_off is now known as ttilley
dv310p3r has quit [Max SendQ exceeded]
dv310p3r has joined #ruby-lang
rutkla has joined #ruby-lang
lsegal has joined #ruby-lang
<cout>
jasiek: submit a patch to the bug tracker and it will automatically email ruby-core, where it will be discussed
erichmenge has joined #ruby-lang
<andkerosine>
Are there any active Assembly channels, or do people tend to just go to ##c?
<cout>
depends on the platform, probably
<andkerosine>
That makes sense.
kvirani has joined #ruby-lang
<cout>
I avoid ##c due to the troll that hang out there
<cout>
trolls
<banisterfiend>
cout: are you friendly with Zhivago? :P
qwerxy has quit [Quit: offski]
<andkerosine>
God, he's such a knowledgeable dick. : )
dous has quit [Remote host closed the connection]
<banisterfiend>
he's also op on #lisp
BlackShadow has joined #ruby-lang
<cout>
banisterfiend: used to be
<cout>
banisterfiend: he was helpful, once upon a time, but now he's cranky and talks down to everyone
<banisterfiend>
yeah he's jaded as f*ck
dhruvasa1ar has quit [Quit: leaving]
erikh has joined #ruby-lang
wallerdev has joined #ruby-lang
<cout>
sad, really
<cout>
but if I were still doing C programming after all these years, I might be the same
<cout>
ruby saved me from myself :)
owen1 has joined #ruby-lang
butchanton has quit [Quit: Leaving.]
<owen1>
is it better to use instance method or class method? is instance method easier to test?
<cout>
owen1: instance methods are almost always better
m3nd3s has joined #ruby-lang
<cout>
owen1: if you find yourself wanting to use a class method, then you should ask yourself whether it makes sense to make a new object
<apeiros_>
owen1: class methods are quite often a code smell
* certainty
uses class methods when i really just need a namespace
<apeiros_>
certainty: and why don't you add the method to the class of the objects your "method" operates on?
<certainty>
apeiros_: because it is a method that works on a more general concept like Enumerables
<apeiros_>
certainty: that doesn't really answer the question
<apeiros_>
Enumerable is a perfect example that a generic concept can work very well with a wide range of classes without having to resort to class methods…
<bougyman>
when do you use class methods, apeiros_ ?
<bougyman>
i use them for very specific things, mostly delegation and constructor customizations.
<certainty>
apeiros_: i generally don't want to add methods to every class that falls in a given category. Why should i do that?
mr_porter_duff has left #ruby-lang [#ruby-lang]
<apeiros_>
bougyman: 2 biggest use cases are convenience constructors and if I have an inheritance model with metadata on the subclasses (similar to AR)
<bougyman>
yep yep
<apeiros_>
certainty: that's what you have modules for
<bougyman>
same thing
<apeiros_>
certainty: again, see Enumerable as prime example
<certainty>
apeiros_: take a concept that isn't currently expressed by a module or class
<apeiros_>
certainty: make a concrete example
<bougyman>
i think we wouldn't need class methods for the latter if we had generic dispatch, apeiros_.
<apeiros_>
you're writing functions instead of methods. you should ask yourself why you don't make use of 'self'
<certainty>
apeiros_: you're right a module would probably be a better place, but then i had to include it in every class that uses the method no?
<apeiros_>
certainty: yes. again, just like Enumerable
mztriz has quit [Quit: Leaving]
<apeiros_>
alternatively you should have a class that takes any of those classes' instances as value and provides the methods as instance methods (something akin a presenter pattern)
<bougyman>
I do sometimes use a module for grouping generic functions.
<certainty>
apeiros_: Enumerable is widespread already though. That's not the case with concepts that don't have a representation yet
<apeiros_>
certainty: and if you really really don't want to write proper methods, do it at least like e.g. Math does it. use a module and make your functions module_function's
<bougyman>
yep
<apeiros_>
certainty: so?
<bougyman>
that's exactly what I meant.
gsav has joined #ruby-lang
<apeiros_>
bougyman: though with Math I quite don't understand why they didn't add it to e.g. Numeric as ordinary methods
andrew___ has joined #ruby-lang
erichmenge has quit [Quit: Be back later]
<certainty>
apeiros_: yes, you're probably right about the modules. What is the big difference between putting it in the Class vs. the Modul?
<apeiros_>
certainty: include Math; sin(x) # can't do that with methods on a class
<certainty>
apeiros_: you can extend
<apeiros_>
no you can't
<apeiros_>
obj.extend SomeClass # raises
<certainty>
bad wording, i mean inherit as in <
<apeiros_>
that's not the same
<apeiros_>
you force yourself to inherit from a specific class
sora_h is now known as s0ra_h
<apeiros_>
suddenly you have an odd inheritance chain just to get some methods…
<apeiros_>
or worse, you're forced to decide from what to inherit, based on class methods that'd become available…
<certainty>
apeiros_: you don't need to. You can just du YourClass.meth(some_value)
<certainty>
do even
<apeiros_>
yes. that was not the point.
<apeiros_>
the point was that you can include a module and don't have to use the full qualification.
<apeiros_>
Math.sin(x) works too
<apeiros_>
but why'd you do that repeatedly if you can just include Math and go with sin(x)?
<certainty>
apeiros_: i fail to see why that is a requirement
<apeiros_>
*sob*
<apeiros_>
whatever. your code.
<certainty>
apeiros_: i'm serious. What is the advantage? I don't get it.
<apeiros_>
what's more readable? `sin(x)*sqrt(z)+PI` or `Math.sin(x)*Math.sqrt(z)+Math::PI`?
<certainty>
apeiros_: certainly the first. So it's about readabilÃity?
brunocoelho has joined #ruby-lang
<apeiros_>
yes. also less to write. of course you can always fully write out your namespace. but that's annoying if it's just a couple of helper functions.
<apeiros_>
but I remain at: having pseudo-functions (functions don't make use of self, as opposed to methods), you're probably having a code smell and your function should belong somewhere else as method
S1kx has quit [Ping timeout: 240 seconds]
<apeiros_>
that's (one reason) why we have OOP after all. we can do some pseudo-oop with C + structs + long function names too…
<certainty>
apeiros_: i see that the module version has the advantage that it can be used in both ways.
S1kx has joined #ruby-lang
<certainty>
apeiros_: well i'm not sure that methods are always a good way to handle things. I mean methods that belong to a certain Class and always have a self
<certainty>
there are object systems that do this quite differently which work equally well
<apeiros_>
as said, show a concrete case…
<apeiros_>
I don't deny that there are other object systems that use different paradigms
<apeiros_>
but this is #ruby-lang, not #arbitrary-lang
<certainty>
apeiros_: in ruby that's not so much of a problem as you can reopen classes. But in other systems it would be hard to specialize for classes after they have been defined
<apeiros_>
if you don't use a language's specific features, why use it at all? there's no point.
<certainty>
apeiros_: i usually do want to use its features. But i also seek to see al its features
<certainty>
which is not always easy as this discussion shows
<certainty>
i had a very different view on class methods till now
S1kx has quit [Client Quit]
RickHull has joined #ruby-lang
<certainty>
apeiros_: to wrap this up. I'll think twice if i want to put a method into a class or a module next time. Thanks for the inspiration
<apeiros_>
yw
erichmenge has joined #ruby-lang
<RickHull>
i've got tree data in postgres. every row has a parent id. i want to build a web interface for this, with expanding nodes. so the user clicks a node to expand its children. the tree is too big to deliver in one shot, so the webserver will query the db on every expansion
jtoy has joined #ruby-lang
<RickHull>
i'm not too comfortable with js/ajax, so my default would be to just rebuild the tree on the server with each expansion
<RickHull>
that said, what are the options these days for the client to maintain the tree?
<RickHull>
websockets?
<RickHull>
ajax?
<bougyman>
websockets is nice and easy
<bougyman>
ajax requires polling, you're better with websockets.
<RickHull>
what's a good way to start with websockets? i haven't decided on a webserver or framework
sgonyea has joined #ruby-lang
brunocoelho has quit [Remote host closed the connection]
<sgonyea>
Hi, is it possible to take a rake task :foo and have another task run before :foo?
tenderlove has quit [Remote host closed the connection]
<RickHull>
i'm pretty comfortable with rails but padrino seems interesting
henk has left #ruby-lang ["WeeChat 0.3.6"]
<sgonyea>
ie, something else defines "foo" ... but before foo runs, I want another task to set some stuff up.
<sgonyea>
Ideally while being able to just do "rake foo"
<apeiros_>
and it's fine if there are multiple `task :foo`'s lying around
<apeiros_>
they don't redefine the task. multiple "mentions" just add stuff
<RickHull>
oh i just remember tenderlove had a post about SSE in rails
<RickHull>
i wonder if SSE is helpful here, need to reread
<apeiros_>
SSE?
guns has joined #ruby-lang
guns is now known as Guest91772
Guest91772 has quit [Client Quit]
<RickHull>
server sent events
<apeiros_>
o0
<apeiros_>
gotta read up on that
<RickHull>
the client has no opportunity to respond
<RickHull>
just a one-way thing
<RickHull>
i'm just learning about it
<apeiros_>
but since your client's action is what causes the rebuild - why not ajax?
<apeiros_>
websockets are only of use if the server is what causes an action…
<RickHull>
yeah i think that's right
<apeiros_>
depending on what you intend to do, I'd probably just send the tree to some levels deep. e.g. 2 levels for the root, and upon every click get 2-3 levels of the currently expanded subtree.
<RickHull>
when you get to a leaf (likely a list of sibling leaves), have e.g. 2 checkboxes for favorite / ignore
<RickHull>
for each leaf
<RickHull>
that's pretty much it
<RickHull>
i'm sure i'll try to add the ability to send mail next
<RickHull>
i'm not sure why you want 2-3 levels, if you're getting data on every click
<RickHull>
i would think every click, you get just the children
jtoy has quit [Quit: jtoy]
jbsan has quit [Read error: Connection reset by peer]
jbsan has joined #ruby-lang
scampbell has joined #ruby-lang
mistym has joined #ruby-lang
erpuds has quit [Quit: erpuds]
robin850 has quit [Quit: Konversation terminated!]
s0ra_h is now known as sora_h
mk03 has joined #ruby-lang
Leeky is now known as Leeky_afk
Axsuul has joined #ruby-lang
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
sora_h is now known as s0ra_h
workmad3 has joined #ruby-lang
erpuds has joined #ruby-lang
uniosx has joined #ruby-lang
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
mistym has quit [Remote host closed the connection]
Berglund has quit [Quit: Computer died.]
uniosx has quit [Quit: Page closed]
virunga has joined #ruby-lang
[1]jonah has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
mistym has joined #ruby-lang
mistym has joined #ruby-lang
workmad3 has quit [Ping timeout: 248 seconds]
uniosx has joined #ruby-lang
tenderlove has joined #ruby-lang
tenderlove has quit [Remote host closed the connection]
tenderlove has joined #ruby-lang
mwjcomputing has quit [Quit: Leaving]
rippa has quit [Ping timeout: 250 seconds]
sailias has quit [Quit: Leaving.]
mistym has quit [Remote host closed the connection]
s0ra_h is now known as sora_h
mssola has quit [Quit: Konversation terminated!]
akira989 has quit [Remote host closed the connection]
mistym has joined #ruby-lang
chimkan_ has joined #ruby-lang
qwerxy has joined #ruby-lang
mistym has quit [Remote host closed the connection]
mrsolo has joined #ruby-lang
postmodern has joined #ruby-lang
carloslopes has quit [Quit: Leaving.]
andrew___ has quit [Remote host closed the connection]
kvirani has quit [Remote host closed the connection]
chimkan__ has joined #ruby-lang
chimkan_ has quit [Read error: No route to host]
imajes has quit [Excess Flood]
chimkan__ has quit [Ping timeout: 252 seconds]
imajes has joined #ruby-lang
erpuds has quit [Quit: erpuds]
Skif has quit [Ping timeout: 240 seconds]
sora_h is now known as s0ra_h
erpuds has joined #ruby-lang
sevvie has joined #ruby-lang
sevvie has quit [Client Quit]
hynkle has quit [Quit: Computer has gone to sleep.]
kain has quit [Quit: This computer has gone to sleep]
MrWGW has quit [Ping timeout: 244 seconds]
Berglund has joined #ruby-lang
kain has joined #ruby-lang
qwerxy has quit [Quit: offski]
scampbell has quit [Quit: Ex-Chat]
Berglund has quit [Client Quit]
MrWGW has joined #ruby-lang
mistym has quit [Remote host closed the connection]
erichmenge has quit [Quit: Be back later]
rutkla has quit [Ping timeout: 255 seconds]
wmoxam_ has quit [Quit: leaving]
erpuds has quit [Quit: erpuds]
headius_ has joined #ruby-lang
headius has quit [Ping timeout: 248 seconds]
headius_ is now known as headius
s0ra_h is now known as sora_h
loincloth has joined #ruby-lang
<loincloth>
hi everybody
lcdhoffman has joined #ruby-lang
m3nd3s has quit [Remote host closed the connection]
<loincloth>
if i send a Mechanize::Page#body to a Logger#info or similar, i see '\n', '\r' and '\t' printed in the log.. how can I replace those with the equivalent escape sequences so I see those characters' formatting in the log?
thone_ has joined #ruby-lang
thone has quit [Read error: Connection reset by peer]
<loincloth>
i'm trying to craft one regexp to use with one gsub call, but having difficulty
<loincloth>
it occurs to me just now that maybe a more verbose gsub with a block that checks what was matched and returns the appropriate escape character might be the way to go
<loincloth>
I was hoping something like gsub(/\\\\([nrt])/, "\#{$1}
<loincloth>
")
<loincloth>
would work, but yeah..
nofxxx has joined #ruby-lang
<loincloth>
oh woof.. think i was just doing it wayyyy wrong
tonni has quit [Ping timeout: 246 seconds]
<loincloth>
yeah.. forgot i was running everything through a log helper which was .inspect-ing everything
<loincloth>
carry on...
kain has quit [Ping timeout: 240 seconds]
tonni has joined #ruby-lang
nofxx has quit [Ping timeout: 248 seconds]
woollyams has quit [Quit: Computer has gone to sleep.]
krz has quit [Quit: krz]
uniosx has left #ruby-lang [#ruby-lang]
bglusman has quit [Remote host closed the connection]
tenderlove has quit [Remote host closed the connection]