Sha256: d7329652a1c3393ba7ac17b9a4dd5d0bae0a30bd0b8f2b6ecc79c4251e6c2954

Contents?: true

Size: 294 Bytes

Versions: 10

Compression:

Stored size: 294 Bytes

Contents

class Dir

  # Is a path parental to another?
  #
  #   Dir.parent?('parent', 'parent/child')  #=> true
  #
  # TODO: Needs improvement.
  #
  # TODO: Instance version?

  def self.parent?(parent_path, child_path)
    %r|^#{Regexp.escape(parent_path)}| =~ child_path ? true : false
  end

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/dir/parent.rb
facets-3.1.0 lib/core/facets/dir/parent.rb
facets-3.0.0 lib/core/facets/dir/parent.rb
facets-2.9.3 lib/core/facets/dir/parent.rb
facets-2.9.2 src/core/facets/dir/parent.rb
facets-2.9.2 lib/core/facets/dir/parent.rb
facets-2.9.1 lib/core/facets/dir/parent.rb
facets-2.9.0 lib/core/facets/dir/parent.rb
facets-2.9.0.pre.2 lib/core/facets/dir/parent.rb
facets-2.9.0.pre.1 lib/core/facets/dir/parent.rb