Class: Pathname

Inherits:
Object show all
Defined in:
lib/ruber/utils.rb

Instance Method Summary collapse

Instance Method Details

#child_of?(other) ⇒ Boolean

Whether the pathname represents a file or directory under the directory represented by another pathname

can be parent of self

Parameters:

  • the (Pathname, String)

    string or pathname representing the directory which

Returns:

  • (Boolean)


249
250
251
252
# File 'lib/ruber/utils.rb', line 249

def child_of? other
  other = Pathname.new(other) if other.is_a? String
  self.relative_path_from(other).to_s[0..2]!= '../'
end