Module: Bibliothecary::Analyser::Determinations

Defined in:
lib/bibliothecary/analyser/determinations.rb

Instance Method Summary collapse

Instance Method Details

#determine_can_have_lockfile(filename, contents = nil) ⇒ Object

calling this with contents=nil can produce less-informed results, but kept for back compat



17
18
19
# File 'lib/bibliothecary/analyser/determinations.rb', line 17

def determine_can_have_lockfile(filename, contents = nil)
  determine_can_have_lockfile_from_info(FileInfo.new(nil, filename, contents))
end

#determine_can_have_lockfile_from_info(info) ⇒ Object



21
22
23
24
# File 'lib/bibliothecary/analyser/determinations.rb', line 21

def determine_can_have_lockfile_from_info(info)
  first_matching_mapping_details(info)
    .fetch(:can_have_lockfile, true)
end

#determine_kind(filename, contents = nil) ⇒ Object

calling this with contents=nil can produce less-informed results, but kept for back compat



6
7
8
# File 'lib/bibliothecary/analyser/determinations.rb', line 6

def determine_kind(filename, contents = nil)
  determine_kind_from_info(FileInfo.new(nil, filename, contents))
end

#determine_kind_from_info(info) ⇒ Object



10
11
12
13
# File 'lib/bibliothecary/analyser/determinations.rb', line 10

def determine_kind_from_info(info)
  first_matching_mapping_details(info)
    .fetch(:kind, nil)
end

#groupable?(info) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/bibliothecary/analyser/determinations.rb', line 26

def groupable?(info)
  # More package managers are groupable than ungroupable, but the methods
  # to get this information should be positive.
  !first_matching_mapping_details(info).fetch(:ungroupable, false)
end