allMask = "*"
class String
define_method(:pathParts) {
ret = self.split(/[\\\/]/, -1)
if(ret.size > 0 && ret[ret.size - 1] == allMask)
ret[0 ... ret.size - 1]
else
ret
end
}
end
p "a/b/c".pathParts
YWxsTWFzayA9ICIqIgpjbGFzcyBTdHJpbmcKICBkZWZpbmVfbWV0aG9kKDpwYXRoUGFydHMpIHsKICAgIHJldCA9IHNlbGYuc3BsaXQoL1tcXFwvXS8sIC0xKQogICAgaWYocmV0LnNpemUgPiAwICYmIHJldFtyZXQuc2l6ZSAtIDFdID09IGFsbE1hc2spCiAgICAgIHJldFswIC4uLiByZXQuc2l6ZSAtIDFdCiAgICBlbHNlCiAgICAgIHJldAogICAgZW5kCiAgfQplbmQKcCAiYS9iL2MiLnBhdGhQYXJ0cw==