Class: Pathname

Inherits:
Object show all
Defined in:
lib/githooks/core_ext/pathname.rb,
lib/githooks/core_ext/pathname.rb

Instance Method Summary collapse

Instance Method Details

#exclude?(component) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/githooks/core_ext/pathname.rb', line 53

def exclude?(component)
  !include?(component)
end

#include?(component) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/githooks/core_ext/pathname.rb', line 49

def include?(component)
  to_s.split(File::SEPARATOR).include?(component)
end

#realdirpath(basedir = nil) ⇒ Object



29
30
31
# File 'lib/githooks/core_ext/pathname.rb', line 29

def realdirpath(basedir = nil)
  java_realpath(basedir)
end

#realpath(basedir = nil) ⇒ Object



23
24
25
26
27
# File 'lib/githooks/core_ext/pathname.rb', line 23

def realpath(basedir = nil)
  java_realpath(basedir).tap do |path|
    fail Errno::ENOENT, path.to_s unless path.exist?
  end
end