Class: Spandx::Ruby::Gateway

Inherits:
Core::Gateway show all
Defined in:
lib/spandx/ruby/gateway.rb

Overview

Instance Attribute Summary

Attributes inherited from Core::Gateway

#http

Instance Method Summary collapse

Methods inherited from Core::Gateway

#initialize

Methods included from Core::Registerable

#all, #inherited, #registry

Constructor Details

This class inherits a constructor from Spandx::Core::Gateway

Instance Method Details

#eachObject



7
8
9
10
11
12
13
14
# File 'lib/spandx/ruby/gateway.rb', line 7

def each
  response = http.get('https://index.rubygems.org/versions')
  return unless http.ok?(response)

  parse_each_from(StringIO.new(response.body)) do |item|
    yield item
  end
end

#licenses(name, version) ⇒ Object



20
21
22
# File 'lib/spandx/ruby/gateway.rb', line 20

def licenses(name, version)
  details_on(name, version)['licenses'] || []
end

#licenses_for(dependency) ⇒ Object



16
17
18
# File 'lib/spandx/ruby/gateway.rb', line 16

def licenses_for(dependency)
  licenses(dependency.name, dependency.version)
end

#matches?(dependency) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/spandx/ruby/gateway.rb', line 24

def matches?(dependency)
  dependency.package_manager == :rubygems
end