Sha256: e20c80952df9e593d8f6d0b3591d0e08df5f930dc476ff360cef634d61c58965
Contents?: true
Size: 395 Bytes
Versions: 58
Compression:
Stored size: 395 Bytes
Contents
# frozen_string_literal: true require 'pathname' class Pathname # Indicate if +self+ is child of +parent_path+. # # @return [Boolean] def child_of?(parent_path) self_parts = expand_path.each_filename.to_a parent_parts = parent_path.expand_path.each_filename.to_a return false if self_parts == parent_parts parent_parts.zip(self_parts).all? { |x, y| x == y } end end
Version data entries
58 entries across 58 versions & 2 rubygems