Class: RubyLens::Index::Manifest::NixStoreProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/rubylens/index/manifest.rb

Constant Summary collapse

STORE_ROOT =
Pathname("/nix/store").freeze
STORE_OBJECT_PATTERN =
/\A[0123456789abcdfghijklmnpqrsvwxyz]{32}-.+\z/

Instance Method Summary collapse

Instance Method Details

#trusted?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
# File 'lib/rubylens/index/manifest.rb', line 21

def trusted?(path)
  path = Pathname(path).expand_path
  return false unless Paths.inside?(path, STORE_ROOT)

  first_component = path.relative_path_from(STORE_ROOT).each_filename.first
  first_component && STORE_OBJECT_PATTERN.match?(first_component)
end