Class: Gemsurance::GemInfoRetriever::GemInfo
- Inherits:
-
Object
- Object
- Gemsurance::GemInfoRetriever::GemInfo
- Defined in:
- lib/gemsurance/gem_info_retriever.rb
Constant Summary collapse
- STATUS_OUTDATED =
'outdated'- STATUS_CURRENT =
'current'- STATUS_VULNERABLE =
'vulnerable'
Instance Attribute Summary collapse
-
#current_version ⇒ Object
readonly
Returns the value of attribute current_version.
-
#documentation_uri ⇒ Object
readonly
Returns the value of attribute documentation_uri.
-
#homepage_uri ⇒ Object
readonly
Returns the value of attribute homepage_uri.
-
#in_gem_file ⇒ Object
readonly
Returns the value of attribute in_gem_file.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#newest_version ⇒ Object
readonly
Returns the value of attribute newest_version.
-
#source_code_uri ⇒ Object
readonly
Returns the value of attribute source_code_uri.
-
#vulnerabilities ⇒ Object
readonly
Returns the value of attribute vulnerabilities.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #add_vulnerability!(vulnerability) ⇒ Object
- #current? ⇒ Boolean
-
#initialize(name, current_version, newest_version, in_gem_file, homepage_uri, source_code_uri, documentation_uri, status = STATUS_CURRENT) ⇒ GemInfo
constructor
A new instance of GemInfo.
- #outdated? ⇒ Boolean
- #vulnerable? ⇒ Boolean
Constructor Details
#initialize(name, current_version, newest_version, in_gem_file, homepage_uri, source_code_uri, documentation_uri, status = STATUS_CURRENT) ⇒ GemInfo
Returns a new instance of GemInfo.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 11 def initialize(name, current_version, newest_version, in_gem_file, homepage_uri, source_code_uri, documentation_uri, status = STATUS_CURRENT) @name = name @current_version = current_version @newest_version = newest_version @in_gem_file = in_gem_file @homepage_uri = homepage_uri @documentation_uri = documentation_uri @source_code_uri = source_code_uri @status = status @vulnerabilities = [] end |
Instance Attribute Details
#current_version ⇒ Object (readonly)
Returns the value of attribute current_version.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def current_version @current_version end |
#documentation_uri ⇒ Object (readonly)
Returns the value of attribute documentation_uri.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def documentation_uri @documentation_uri end |
#homepage_uri ⇒ Object (readonly)
Returns the value of attribute homepage_uri.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def homepage_uri @homepage_uri end |
#in_gem_file ⇒ Object (readonly)
Returns the value of attribute in_gem_file.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def in_gem_file @in_gem_file end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def name @name end |
#newest_version ⇒ Object (readonly)
Returns the value of attribute newest_version.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def newest_version @newest_version end |
#source_code_uri ⇒ Object (readonly)
Returns the value of attribute source_code_uri.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def source_code_uri @source_code_uri end |
#vulnerabilities ⇒ Object (readonly)
Returns the value of attribute vulnerabilities.
8 9 10 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 8 def vulnerabilities @vulnerabilities end |
Instance Method Details
#==(other) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 41 def ==(other) @name == other.name && @current_version == other.current_version && @newest_version == other.newest_version && @status == other.instance_variable_get(:@status) && @vulnerabilities == other.vulnerabilities end |
#add_vulnerability!(vulnerability) ⇒ Object
24 25 26 27 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 24 def add_vulnerability!(vulnerability) @status = STATUS_VULNERABLE @vulnerabilities << vulnerability end |
#current? ⇒ Boolean
33 34 35 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 33 def current? @status == STATUS_CURRENT end |
#outdated? ⇒ Boolean
29 30 31 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 29 def outdated? @status == STATUS_OUTDATED end |
#vulnerable? ⇒ Boolean
37 38 39 |
# File 'lib/gemsurance/gem_info_retriever.rb', line 37 def vulnerable? @status == STATUS_VULNERABLE end |