Class: Papers::DependencySpecification
- Inherits:
-
Object
- Object
- Papers::DependencySpecification
- Defined in:
- lib/papers/dependency_specification.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#license ⇒ Object
Returns the value of attribute license.
-
#license_url ⇒ Object
Returns the value of attribute license_url.
-
#name ⇒ Object
Returns the value of attribute name.
-
#project_url ⇒ Object
Returns the value of attribute project_url.
Class Method Summary collapse
- .all_from_manifest(manifest) ⇒ Object
- .missing_from_manifest(manifest) ⇒ Object
- .unknown_in_manifest(manifest) ⇒ Object
Instance Method Summary collapse
- #acceptable_license? ⇒ Boolean
-
#initialize(options) ⇒ DependencySpecification
constructor
A new instance of DependencySpecification.
Constructor Details
#initialize(options) ⇒ DependencySpecification
5 6 7 8 9 10 |
# File 'lib/papers/dependency_specification.rb', line 5 def initialize() @name = [:name] @license = [:license] @license_url = [:license_url] @project_url = [:project_url] end |
Instance Attribute Details
#license ⇒ Object
Returns the value of attribute license.
3 4 5 |
# File 'lib/papers/dependency_specification.rb', line 3 def license @license end |
#license_url ⇒ Object
Returns the value of attribute license_url.
3 4 5 |
# File 'lib/papers/dependency_specification.rb', line 3 def license_url @license_url end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/papers/dependency_specification.rb', line 3 def name @name end |
#project_url ⇒ Object
Returns the value of attribute project_url.
3 4 5 |
# File 'lib/papers/dependency_specification.rb', line 3 def project_url @project_url end |
Class Method Details
.all_from_manifest(manifest) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/papers/dependency_specification.rb', line 18 def self.all_from_manifest(manifest) (manifest[manifest_key] || []).map do |name, info| license_url = info['license_url'] license = info['license'] project_url = info['project_url'] self.new(name: name, license: license, license_url: license_url, project_url: project_url) end.sort { |a, b| a.name.downcase <=> b.name.downcase } end |
.missing_from_manifest(manifest) ⇒ Object
27 28 29 |
# File 'lib/papers/dependency_specification.rb', line 27 def self.missing_from_manifest(manifest) introspected.to_set - all_from_manifest(manifest).map(&:name).to_set end |
.unknown_in_manifest(manifest) ⇒ Object
31 32 33 |
# File 'lib/papers/dependency_specification.rb', line 31 def self.unknown_in_manifest(manifest) all_from_manifest(manifest).map(&:name).to_set - introspected.to_set end |
Instance Method Details
#acceptable_license? ⇒ Boolean
12 13 14 |
# File 'lib/papers/dependency_specification.rb', line 12 def acceptable_license? Papers.config.license_whitelist.include?(license) end |