Class: Package::Audit::Formatter::VersionDate

Inherits:
Base
  • Object
show all
Defined in:
lib/package/audit/formatter/version_date.rb

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ VersionDate

Returns a new instance of VersionDate.



11
12
13
14
# File 'lib/package/audit/formatter/version_date.rb', line 11

def initialize(date)
  super()
  @date = date
end

Instance Method Details

#formatObject



16
17
18
19
20
21
22
23
24
# File 'lib/package/audit/formatter/version_date.rb', line 16

def format
  seconds_since_date = (Time.now - Time.parse(@date)).to_i

  if seconds_since_date >= Const::Time::SECONDS_ELAPSED_TO_BE_OUTDATED
    Util::BashColor.yellow(@date)
  else
    @date
  end
end