Class: Gemterms::Component
- Inherits:
-
Object
- Object
- Gemterms::Component
- Defined in:
- lib/gemterms/project.rb
Overview
A licenced component that is part of an overall project.
Instance Attribute Summary collapse
-
#licenses ⇒ Object
readonly
Returns the value of attribute licenses.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(name, version, licenses) ⇒ Component
constructor
A new instance of Component.
-
#licensed? ⇒ true, false
license.
-
#multiple? ⇒ true, false
licenses.
Constructor Details
#initialize(name, version, licenses) ⇒ Component
Returns a new instance of Component.
7 8 9 10 11 |
# File 'lib/gemterms/project.rb', line 7 def initialize(name, version, licenses) @name = name @version = version @licenses = licenses end |
Instance Attribute Details
#licenses ⇒ Object (readonly)
Returns the value of attribute licenses.
5 6 7 |
# File 'lib/gemterms/project.rb', line 5 def licenses @licenses end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/gemterms/project.rb', line 5 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/gemterms/project.rb', line 5 def version @version end |
Instance Method Details
#licensed? ⇒ true, false
license
15 16 17 |
# File 'lib/gemterms/project.rb', line 15 def licensed? !@licenses.nil? && @licenses.detect { |l| !l.unknown } end |
#multiple? ⇒ true, false
licenses.
21 22 23 |
# File 'lib/gemterms/project.rb', line 21 def multiple? !@licenses.nil? && (@licenses.count { |l| !l.unknown } > 1) end |