R
RichardOnRails
I'm running Ruby over WindowsXP-Pro/SP2. So I wanted File.join to use
backslash.
I tried:
class WFile < File
def join(arg1, arg2)
super.join(arg1, arg2).gsub(/\//, '\\')
end
end
but WFile.join(s1,s2) didn't work. My question is why?
BTW, I don't want to start or enter into a debate about the wisdom
nor aesthetics of this approach.
Also, I got the File.wjoin to work (using the code below), so I'm
happy. I just want to learn why my first idea is flawed.
class File # Join with a backslash rather than a forward slash
def File.wjoin(arg1, arg2)
join(arg1, arg2).gsub(/\//, '\\')
end
end
Thanks in Advance,
Richard
backslash.
I tried:
class WFile < File
def join(arg1, arg2)
super.join(arg1, arg2).gsub(/\//, '\\')
end
end
but WFile.join(s1,s2) didn't work. My question is why?
BTW, I don't want to start or enter into a debate about the wisdom
nor aesthetics of this approach.
Also, I got the File.wjoin to work (using the code below), so I'm
happy. I just want to learn why my first idea is flawed.
class File # Join with a backslash rather than a forward slash
def File.wjoin(arg1, arg2)
join(arg1, arg2).gsub(/\//, '\\')
end
end
Thanks in Advance,
Richard