Class: Spandx::Ruby::Parsers::GemfileLock

Inherits:
Core::Parser show all
Defined in:
lib/spandx/ruby/parsers/gemfile_lock.rb

Constant Summary collapse

STRIP_BUNDLED_WITH =
/^BUNDLED WITH$(\r?\n)   (?<major>\d+)\.\d+\.\d+/m.freeze

Constants inherited from Core::Parser

Core::Parser::UNKNOWN

Instance Method Summary collapse

Methods inherited from Core::Parser

for, parse

Methods included from Core::Registerable

#all, #each, #inherited, #registry

Instance Method Details

#match?(pathname) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/spandx/ruby/parsers/gemfile_lock.rb', line 9

def match?(pathname)
  basename = pathname.basename
  basename.fnmatch?('Gemfile*.lock') ||
    basename.fnmatch?('gems*.lock')
end

#parse(lockfile) ⇒ Object



15
16
17
18
19
# File 'lib/spandx/ruby/parsers/gemfile_lock.rb', line 15

def parse(lockfile)
  dependencies_from(lockfile).map do |specification|
    map_from(lockfile, specification)
  end
end