Skip to content

Instantly share code, notes, and snippets.

@suer
Created December 7, 2015 03:01
Show Gist options
  • Save suer/022e9c42f3f06b056d7f to your computer and use it in GitHub Desktop.
Save suer/022e9c42f3f06b056d7f to your computer and use it in GitHub Desktop.
Dark patch for Errbit
class NilClass
def match(pattern)
"".match(pattern)
end
end
class File
class << self
def dirname_with_nullable(filename)
return dirname_without_nullable(filename) if filename
""
end
alias_method_chain :dirname, :nullable
def basename_with_nullable(filename, suffix = "")
return basename_without_nullable(filename, suffix) if filename
""
end
alias_method_chain :basename, :nullable
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment