pkrnj has quit [Quit: Computer has gone to sleep.]
idkazuma has quit [Remote host closed the connection]
retro|cz has quit [Ping timeout: 245 seconds]
mjio has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 245 seconds]
torrieri has joined #ruby-lang
Eric_ has quit [Quit: Leaving...]
geopet has quit [Quit: geopet]
retro|cz has joined #ruby-lang
rc- has joined #ruby-lang
klebervirgilio has joined #ruby-lang
iamjarvo has quit [Quit: Leaving.]
marr has quit [Ping timeout: 245 seconds]
klebervirgilio has quit [Ping timeout: 255 seconds]
cored has quit [Ping timeout: 272 seconds]
klebervirgilio has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
scottschecter has quit [Quit: WeeChat 0.4.0]
powershellyoda has joined #ruby-lang
scottschecter has joined #ruby-lang
beho_ has quit [Remote host closed the connection]
Aiur has quit [Quit: Computer has gone to sleep.]
slyphon has joined #ruby-lang
torrieri has quit [Quit: Leaving...]
rc- has quit []
bzalasky has quit [Remote host closed the connection]
sepp2k has joined #ruby-lang
bzalasky has joined #ruby-lang
pkrnj has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
srbaker has joined #ruby-lang
powershellyoda has left #ruby-lang [#ruby-lang]
kuon has quit [Quit: Leaving...]
cw has joined #ruby-lang
r0bby is now known as robbyoconnor
Wardrop_ has joined #ruby-lang
Domon has joined #ruby-lang
<Wardrop_>
Hey does anyone know if Ruby (core or stdlib) provides an easy way join two relative URL paths?
<Wardrop_>
File#join would be perfect, but File#join will use backslashes on Windows. I need something that's always join with exactly one forward flash.
Stilo has joined #ruby-lang
<Wardrop_>
E.g. join('/article', '/hello) #=> /article/hello
<ryanf>
so you don't want to use Array#join because you want it to insert slashes if necessary?
<Wardrop_>
ryanf: Correct. I can obviously work-around that by post-processing it with gsub, etc, but I'm wondering if Ruby already provides something that does this.
<Wardrop_>
URI#join doesn't work either, as it doesn't like getting two "relative" URL's.
<drbrain>
URI#+
<drbrain>
but, you need to start with an absolute URI
<drbrain>
there's no safe way to join relative URIs
<andrewvos>
YES OF COURSE I WANT TO COMMIT ALL THESE FILES I JUST TOLD YOU TO IGNORE
cultureulterior_ has joined #ruby-lang
<yorickpeterse>
subversion?
<yorickpeterse>
Are you suicidal?
<yorickpeterse>
(there's help for that)
r0bby is now known as robbyoconnor
<yorickpeterse>
(for both suicidal thoughts and using SVN)
jsaak has quit [Ping timeout: 264 seconds]
gokul has quit [Read error: Connection reset by peer]
gnufied1 has joined #ruby-lang
<badeball>
second that. I don't see any reason for sticking with SVN. large company, many people to learn using another VCS, etc. is just stupid. make the shift right now.
<yorickpeterse>
badeball: chances are he's forced to use it because "fuck you, company policy|
gnufied has quit [Ping timeout: 264 seconds]
<badeball>
yeah, probably, but you have to nip stuff like that in the bud.
retro|cz has joined #ruby-lang
<darix>
andrewvos: the ignore is the same as in git ... it just removes them from the status output. you can version files matched by the ignore in both SCMs
<yorickpeterse>
darix: in Git that requires -f to be set, even for `git add .`
<yorickpeterse>
Come to think of it, it's not the first Python code I wrote
<yorickpeterse>
that was some chat bot for deviantard
<yorickpeterse>
My first ever Java code is probably long lost
<yorickpeterse>
ha well, I did find a forum thread about it
<yorickpeterse>
shit, that's only from Jan 2009
<yorickpeterse>
haha, and of course the typical "bump" right after posting it
krz has quit [Quit: krz]
fire has joined #ruby-lang
judofyr has joined #ruby-lang
cirenyc has joined #ruby-lang
carloslopes has joined #ruby-lang
cirenyc has quit [Ping timeout: 245 seconds]
sailias has quit [Quit: Leaving.]
vlad_starkov has joined #ruby-lang
postmodern has quit [Remote host closed the connection]
vlad_starkov has quit [Remote host closed the connection]
beho_ has joined #ruby-lang
beho has quit [Ping timeout: 248 seconds]
jerrytgarcia has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
gustavnils has joined #ruby-lang
dustint has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 252 seconds]
srbaker has joined #ruby-lang
idkazuma has joined #ruby-lang
jerrytgarcia has quit [Read error: Connection reset by peer]
cirenyc has joined #ruby-lang
jerrytgarcia has joined #ruby-lang
beiter has quit [Quit: beiter]
cirenyc has quit [Ping timeout: 252 seconds]
idkazuma has quit [Remote host closed the connection]
beiter has joined #ruby-lang
rippa has joined #ruby-lang
cored has quit [Ping timeout: 252 seconds]
adambeynon has joined #ruby-lang
cored has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
idkazuma has joined #ruby-lang
iamjarvo has joined #ruby-lang
toretore has quit [Read error: Connection reset by peer]
toretore has joined #ruby-lang
kurko_ has joined #ruby-lang
<soahccc>
Can I somehow define a method explicitly to public? I know that I can do a "public\ndef meth" but this doesn't seem to work when including the module somewhere else :(
<soahccc>
judofyr: hmm do I have to send it to the destination then?
<judofyr>
soahccc: yeah, it's a method on Module
<gnufied>
this must be rails
yfeldblum has quit [Ping timeout: 260 seconds]
<judofyr>
yeah, I don't think defining it explicitly will help
<judofyr>
I think Rails is doing something magic
<gnufied>
use send()
<gnufied>
:(
<gnufied>
soahccc: how does dapper gem implements h() method?
sailias has joined #ruby-lang
<gnufied>
I think they use send too, for invoking view helpers from presneters
<darix>
soahccc: just curious ...why would you do it in first place?
<gnufied>
presenters*
rippa has quit [Ping timeout: 240 seconds]
<gnufied>
darix: he is using presenter pattern, for object oriented helpers
<gnufied>
but he wants access to predefined or plugin defined helpers
<gnufied>
from presenter
<gnufied>
something like that I think
<gnufied>
:-)
<darix>
couldnt he just include those helpers in his presenters?
<soahccc>
darix: Sure I could but this isn't the only helper I extracted into our gem :)
<darix>
soahccc: so?
<gnufied>
darix: well, depends on what helper does
<gnufied>
for example, if helper accesses content_tag or something like that, including it in presenter class won't work
<soahccc>
darix: They shouldn't go in the presenter alone but the whole view thing so ActionView::Base is the correct target I suppose
<gnufied>
he must access helper through an instance of view object
<soahccc>
gnufied: I do pass the (not a) view_context to the presenter
<soahccc>
which is then in @tpl like formbuilder
<gnufied>
cool. I haven't used any of presneter thingies, I am doing arm chair thinking
<gnufied>
soahccc: can you not use send() ?
<soahccc>
gnufied: Yeah that works: ActionView::Base.send(:public, :icon)
<soahccc>
I still don't get why I can call it in a view directly (shouldn't it be private there too?)
<gnufied>
no no
<gnufied>
@tpl.send(:icon, :search,..)
<gnufied>
^ why not use that?
<soahccc>
Yeah well I could do that but as I use those icons a LOT especially in the presenters that would be crap
<soahccc>
I still could make a wrapper method in my base presenter but I acutally don't want that method to be private
<gnufied>
why would you have to call send() all the time?
sush24 has joined #ruby-lang
<gnufied>
in your tpl class you can define a wrapper method that does this send thing
<gnufied>
sorry, I mean in your presenter class
lun_ has joined #ruby-lang
<soahccc>
Yeah as I said, I could do that as a workaround but I don't understand why it is even private (there is no reason for the method to be private).
wmoxam has joined #ruby-lang
tonni has quit [Remote host closed the connection]
<gnufied>
as for your question, rails may be marking included methods via helpers private after including them. or they may even be including helpers in a anonymous module and then delegating it
<gnufied>
rails does second thing quite a bit
<gnufied>
nothing is as straightforward as it seems
<gnufied>
so, worth reading ActionView code, if you want to get to the bottom of it
<soahccc>
gnufied: yeah, I struggled a lot and ended up with a "dirtier" solution but everbody seems to use it (e.g. send include to Enumerable doesn't work, you have to class eval)
<gnufied>
sorry, I am not aware of enumerable thingy
<gnufied>
as in, why you have to use class_eval
<soahccc>
Yeah I wasn't to but tried to extend it's functionallity. Unfortunately this doesn't affect types already included enumerable so you directly have to overwrite it via class_eval or module Enumerable ; def ...
urbanmonk has joined #ruby-lang
sailias has quit [Ping timeout: 264 seconds]
slyphon has joined #ruby-lang
ryez has joined #ruby-lang
noop has quit [Quit: Leaving]
Aiur has joined #ruby-lang
urbanmonk has quit [Client Quit]
wizonesolutions has quit [Ping timeout: 255 seconds]
<whitequark>
"playable track count" or "playable tracks count"?
tbuehlmann has joined #ruby-lang
glebm has joined #ruby-lang
havenn has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
MaddinXx has joined #ruby-lang
<zzak>
ignore playable
<zzak>
"track count" or "tracks count"
Eric_ has joined #ruby-lang
<whitequark>
zzak: hm. "track count", I guess?
eam_ is now known as eam
<zzak>
track as in music?
<whitequark>
yep
<zzak>
try changing the noun
<zzak>
i kinda like plural form
<zzak>
"car count" vs "cars count"
<zzak>
i think either could work
<zzak>
noun/subject
<whitequark>
mkay
<whitequark>
thanks!
<whitequark>
naming database columns is hard ><
cirenyc has quit [Ping timeout: 252 seconds]
<zzak>
why are you putting the count in a field?
<whitequark>
zzak: counter cache
<whitequark>
otherwise it would be a pretty evil N+1 query
<zzak>
on which column
<zzak>
table rather
<whitequark>
track belongs_to release; class Track; scope :playable, where(condition); end
__butch__ has joined #ruby-lang
<whitequark>
and I need to select releases with playable tracks and get their count
<zzak>
use includes?
<whitequark>
zzak: no, I don't think it would work
<whitequark>
in order to select only releases with playable tracks I need to make a subquery
justinram has joined #ruby-lang
<whitequark>
EXISTS (SELECT 1 FROM tracks WHERE condition)
spuk has joined #ruby-lang
soypirate has joined #ruby-lang
fn_ has quit [Remote host closed the connection]
havenn has joined #ruby-lang
MehLaptop has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
<zzak>
What's wrong with Release.tracks.playable.count ?
<zzak>
or size on the result?
beiter has joined #ruby-lang
<whitequark>
zzak: um
<whitequark>
I need to select all releases which have playable track *and* count of those tracks for the releases
<whitequark>
and preferably in a way which is O(1)
<whitequark>
i.e. I'm not going to send a query per release.
nazty has quit [Read error: Connection reset by peer]
nazty has joined #ruby-lang
tylersmith has joined #ruby-lang
<zzak>
isn't that ARel's job?
<whitequark>
zzak: this is not possible in SQL without an auxiliary counter cache.
jonahR has joined #ruby-lang
<whitequark>
or a subquery, which immediately puts you out of O(1) scope
mistym has quit [Remote host closed the connection]
sn0wb1rd has joined #ruby-lang
<zzak>
oh
<zzak>
theres actually a counter_cache thing in rails?
<whitequark>
yea
<zzak>
TIL
<whitequark>
but it's not good enough for me, as I need also a condition
gregmoreno has joined #ruby-lang
<whitequark>
aiui
<zzak>
disregard my previous advice, im not sure what you're supposed to name the counter field in regard to rails. i was thinking you were just asking for english advice haha
jbsan has joined #ruby-lang
<whitequark>
zzak: exactly for english advice
<whitequark>
as I've said, I'm rolling my own system
<whitequark>
rails is not clever enough to update counter cache for a collection with a condition
<zzak>
you would have to use a callback
tylersmith has quit [Quit: tylersmith]
* whitequark
sighs
<zzak>
;D
<whitequark>
thank you, I'm being paid to write rails stuff for more than two years.
tylersmith has joined #ruby-lang
<zzak>
not sure if actually helped, or just being sarcastic
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
<whitequark>
zzak: sarcastic
<whitequark>
but your english advice definitely helped!
<whitequark>
I've been bikeshedding on that for 15 minutes or so
<zzak>
cool, np!
<zzak>
thanks for teaching me about counter_cache
<whitequark>
there's also url_for with namespaces, like link_to [:edit, :admin, @site, @post]
<whitequark>
good for writing generic controllers/views
<zzak>
i knew about this one
<whitequark>
oh, I only recently learned about it
<zzak>
one sec
maxmanders has quit [Quit: Computer has gone to sleep.]
kristofferrr has quit [Quit: ❤]
MehLaptop has quit [Remote host closed the connection]
<whitequark>
zzak: any chance you'd know why release.tracks = tracks (tracks is a persisted collection of Track); release.save would succeed (save returns true), but the foreign keys in tracks are not updated?
<whitequark>
I've even tried to add autosave on has_many :tracks in release
<whitequark>
whereas .track_ids = tracks.map(&:id) works perfectly
<zzak>
maybe invalid track?
<zzak>
its not bubbling up to release object, are they nested attributes?
<whitequark>
that's not even a form
<whitequark>
actually the form works perfectly, it's the spec which fails :D
<zzak>
check the params
<whitequark>
params?
joevandyk has quit [Quit: joevandyk]
<zzak>
you said the form works, check the params it's using
<zzak>
and compare with your spec
<whitequark>
zzak: the form obviously constructs the objects in a different fashion
glebm has quit [Quit: Computer has gone to sleep.]
<whitequark>
actually I've no idea why the spec is written like that. legacy code.
<whitequark>
interesting.
<whitequark>
tracks.map &:save does the job
amerine has joined #ruby-lang
joevandyk has joined #ruby-lang
jondot has joined #ruby-lang
sebastia_ has joined #ruby-lang
glebm has joined #ruby-lang
Legend001 has joined #ruby-lang
ryez has quit [Ping timeout: 245 seconds]
sebastiansier has quit [Ping timeout: 250 seconds]
torrieri has joined #ruby-lang
Randroid has joined #ruby-lang
rippa has quit [Read error: Connection reset by peer]
rippa has joined #ruby-lang
Legend001 has quit [Client Quit]
torrieri has quit [Client Quit]
retro|cz has quit [Ping timeout: 245 seconds]
torrieri has joined #ruby-lang
sepp2k1 has quit [Remote host closed the connection]
methods has joined #ruby-lang
thone has quit [Read error: Operation timed out]
hahuang65 has joined #ruby-lang
tonni has joined #ruby-lang
Randroid has quit [Quit: Randroid]
<methods>
can i force gem to install binaries to the proper system directories ? I'm trying to get it to refresh everything
<methods>
seems to be for me that /usr/local/bin/puppet isn't getting installed
<methods>
or i mean any puppet in normal bin folders
mrsolo has joined #ruby-lang
swav has quit [Remote host closed the connection]
benanne has joined #ruby-lang
swav has joined #ruby-lang
swav has quit [Read error: Connection reset by peer]
swav has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
MaddinXx_ has joined #ruby-lang
gregmoreno has quit [Remote host closed the connection]
swav has quit [Remote host closed the connection]
swav has joined #ruby-lang
gregmoreno has joined #ruby-lang
<methods>
that's basically what wayland is supposed to be which i believe ubuntu was supporting
<methods>
oh they talk about wayland at the bottom.. keeps reading..
<yorickpeterse>
Basically Canonical is yet again reinventing the wheel
<yorickpeterse>
Yet so far nothing good has come out of that
<methods>
well i mean their ubuntu for mobile is cool and it was their goal but .. their execution was terrible.. they should have supported something like cinnamon or classic gnome all way through
dhruvasagar has quit [Read error: Operation timed out]
sockmonk` has joined #ruby-lang
swav has quit [Ping timeout: 248 seconds]
moxie_ has joined #ruby-lang
sockmonk has quit [Ping timeout: 264 seconds]
krohrbaugh has joined #ruby-lang
MaddinXx_ has quit [Read error: Connection reset by peer]
<moxie_>
When a class is defined within another class… does the parent classes name just act as a module for the child?
MaddinX__ has joined #ruby-lang
<yorickpeterse>
moxie_: No, it acts as a namespace
<yorickpeterse>
A module is not the same as a namespace, but it can be used as one
<moxie_>
yorickpeterse: okay, that's what I meant
<yorickpeterse>
same goes for classes
<zzak>
why does a phone need an gui at all? i have a phone, it makes calls, end of story
<moxie_>
so I could have a Membership class, and then define classes like Membership::Tier
<yorickpeterse>
moxie_: yes
<moxie_>
yorickpeterse: cool ty.
vlad_starkov has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
soypirate has quit [Ping timeout: 252 seconds]
mercwithamouth has joined #ruby-lang
maxmanders has joined #ruby-lang
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
kain has quit [Quit: exit]
kain has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 248 seconds]
<yorickpeterse>
semantics question:
<yorickpeterse>
When looking at the code `rescue Foo, Bar => e`, what would one call the "Foo, Bar" bit and the "=> e" bit? Just "constants" and "variables" is too generic
<yorickpeterse>
Something like "rescue_constants" and "rescue_variables" but a bit less meh-ish
<zzak>
exception classes on the left
<drbrain>
yorickpeterse: in ri ruby:exceptions I have roughly "exception assignment" for the "=> e" part
<drbrain>
and roughly "exceptions classes" for the "Foo, Bar" part
<yorickpeterse>
It needs to translate to a
<yorickpeterse>
fuck
<yorickpeterse>
It needs to translate to some sort of identifier
<yorickpeterse>
Because it will be used for instruction names in this case
djwonk has joined #ruby-lang
brianpWins has joined #ruby-lang
<yorickpeterse>
drbrain: hm, I'm not sure if I like the use of "exceptions" though. It's very pedantic but I believe Ruby doesn't call them that either
<zzak>
drbrain: what is "e" actually, an instance of ExceptionClass ?
<yorickpeterse>
at least the classes have "Error" in them instead of Exception
<drbrain>
zzak: yes
sush24 has quit [Quit: This computer has gone to sleep]
<zzak>
drbrain: where is it assigned, #raise? or rescue()
<drbrain>
yorickpeterse: you mean, internally?
methods has left #ruby-lang [#ruby-lang]
<drbrain>
zzak: the VM does it
krohrbaugh has quit [Quit: Leaving.]
<zzak>
drbrain++
<drbrain>
Kernel#raise sets $!, when the rescue body is started it does e = $! (or whichever
cultureulterior_ has quit [Quit: cultureulterior_]
<yorickpeterse>
drbrain: that too, but also in general
marr has quit [Ping timeout: 245 seconds]
<drbrain>
yorickpeterse: since the root exception/error is Exception, I go with that, even though there are RuntimeError and StandardError and so-forth
beiter has quit [Quit: beiter]
krohrbaugh has joined #ruby-lang
sush24 has joined #ruby-lang
<yorickpeterse>
hmm
<drbrain>
all the internal stuff seems to just use "e"
<drbrain>
rb_eStandardError, eclass
<drbrain>
there's also th->errinfo and TAG_EXEC()
<yorickpeterse>
that's probably because it's a lazy way of writing "error"
<drbrain>
could be either
<drbrain>
rb_make_exception
<yorickpeterse>
exception_classes and exception_variables it is then
<drbrain>
it seems very much split on if they're "errors" or "exceptions"
<drbrain>
I would go with exception since that's the general computing term for this feature
<yfeldblum>
yorickpeterse, there's normally no need to rescue Exception instances, but only StandardError instances (sometimes LoadError if you're handling `require` failures)
mistym is now known as mistym_lunch
sockmonk` has quit [Read error: Connection reset by peer]
davidbalbert is now known as davidbalber|away
sockmonk` has joined #ruby-lang
sn0wb1rd has quit [Quit: sn0wb1rd]
<yorickpeterse>
I know of the structure :)
<yorickpeterse>
basically I'm translating Ruby code to VM instructions and needed a name to group these two data collections
<yfeldblum>
yorickpeterse, ah sorry i thought you were asking something else
<yorickpeterse>
no worries
<zzak>
i like instances over variables
<zzak>
or objects
<yfeldblum>
yorickpeterse, "exception type constraints" and "exception argument"
chrismar035 has joined #ruby-lang
<yfeldblum>
yorickpeterse, or "exception instance"
<yorickpeterse>
zzak: hmm, good point
maxmanders has quit [Ping timeout: 245 seconds]
krohrbaugh has quit [Quit: Leaving.]
Gate_ has left #ruby-lang [#ruby-lang]
Gate has joined #ruby-lang
retro|cz has joined #ruby-lang
maxmanders has joined #ruby-lang
breakingthings has joined #ruby-lang
krohrbaugh has joined #ruby-lang
jsilver has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
runeb has joined #ruby-lang
beiter has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 256 seconds]
mercwithamouth has joined #ruby-lang
ryanf has joined #ruby-lang
krohrbaugh has quit [Read error: Connection reset by peer]