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



19
20
21
# File 'lib/bibliothecary/analyser/determinations.rb', line 19

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



23
24
25
26
# File 'lib/bibliothecary/analyser/determinations.rb', line 23

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



8
9
10
# File 'lib/bibliothecary/analyser/determinations.rb', line 8

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

#determine_kind_from_info(info) ⇒ Object



12
13
14
15
# File 'lib/bibliothecary/analyser/determinations.rb', line 12

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

#groupable?(info) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/bibliothecary/analyser/determinations.rb', line 28

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