Class: Bundler::Alive::Status
- Inherits:
-
Object
- Object
- Bundler::Alive::Status
- Defined in:
- lib/bundler/alive/status.rb
Overview
Represents Status
Constant Summary collapse
- REPOSITORY_URL_UNKNOWN =
Value of repository URL unknown
"unknown"
- ALIVE_UNKNOWN =
Value off alive unknown
"unknown"
Instance Attribute Summary collapse
-
#alive ⇒ Object
readonly
Returns the value of attribute alive.
-
#checked_at ⇒ Object
readonly
Returns the value of attribute checked_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repository_url ⇒ Object
readonly
Returns the value of attribute repository_url.
Instance Method Summary collapse
-
#initialize(name:, repository_url:, alive:, checked_at:) ⇒ Status
constructor
Creates instance of
Status
. -
#report ⇒ String
Reports not alive gem.
-
#to_h ⇒ Hash
Hash of status.
-
#unknown? ⇒ Boolean
Is status of alive unknown?.
Constructor Details
#initialize(name:, repository_url:, alive:, checked_at:) ⇒ Status
Creates instance of Status
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bundler/alive/status.rb', line 27 def initialize(name:, repository_url:, alive:, checked_at:) raise ArgumentError if !repository_url.nil? && !repository_url.instance_of?(SourceCodeRepositoryUrl) repository_url = REPOSITORY_URL_UNKNOWN if repository_url.nil? alive = ALIVE_UNKNOWN if alive.nil? @name = name @repository_url = repository_url @alive = alive @checked_at = checked_at freeze end |
Instance Attribute Details
#alive ⇒ Object (readonly)
Returns the value of attribute alive.
15 16 17 |
# File 'lib/bundler/alive/status.rb', line 15 def alive @alive end |
#checked_at ⇒ Object (readonly)
Returns the value of attribute checked_at.
15 16 17 |
# File 'lib/bundler/alive/status.rb', line 15 def checked_at @checked_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/bundler/alive/status.rb', line 15 def name @name end |
#repository_url ⇒ Object (readonly)
Returns the value of attribute repository_url.
15 16 17 |
# File 'lib/bundler/alive/status.rb', line 15 def repository_url @repository_url end |
Instance Method Details
#report ⇒ String
Reports not alive gem
66 67 68 69 70 71 72 |
# File 'lib/bundler/alive/status.rb', line 66 def report <<~REPORT Name: #{name} URL: #{decorated_repository_url} REPORT end |
#to_h ⇒ Hash
Returns Hash of status.
53 54 55 56 57 58 59 |
# File 'lib/bundler/alive/status.rb', line 53 def to_h { repository_url: decorated_repository_url, alive: decorated_alive, checked_at: checked_at || "" } end |
#unknown? ⇒ Boolean
Is status of alive unknown?
46 47 48 |
# File 'lib/bundler/alive/status.rb', line 46 def unknown? alive == ALIVE_UNKNOWN end |