Class: DependencyTimelineAudit::Gem

Inherits:
Object
  • Object
show all
Defined in:
lib/dependency-timeline-audit/gem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, name:, locked_version:) ⇒ Gem

Returns a new instance of Gem.



5
6
7
8
9
10
# File 'lib/dependency-timeline-audit/gem.rb', line 5

def initialize(config:, name:, locked_version:)
  @config = config
  @name = name
  @locked_version = GemVersion.new(gem: self, name: locked_version)
  @latest_version = GemVersion.new(gem: self, name: api.latest_version)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/dependency-timeline-audit/gem.rb', line 3

def config
  @config
end

#latest_versionObject (readonly)

Returns the value of attribute latest_version.



3
4
5
# File 'lib/dependency-timeline-audit/gem.rb', line 3

def latest_version
  @latest_version
end

#locked_versionObject (readonly)

Returns the value of attribute locked_version.



3
4
5
# File 'lib/dependency-timeline-audit/gem.rb', line 3

def locked_version
  @locked_version
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/dependency-timeline-audit/gem.rb', line 3

def name
  @name
end

Instance Method Details



16
17
18
19
20
21
22
23
# File 'lib/dependency-timeline-audit/gem.rb', line 16

def print_info
  puts "Gem: #{TextFormat.bold}#{name}#{TextFormat.reset}"
  TextFormat.color = locked_version.color
  puts "  - Locked to: #{locked_version.name} (Released: #{format_date(locked_version.released_at)})"
  TextFormat.color = latest_version.color
  puts "  - Latest: #{latest_version.name} (Released: #{format_date(latest_version.released_at)})"
  TextFormat.reset!
end

#to_sObject



12
13
14
# File 'lib/dependency-timeline-audit/gem.rb', line 12

def to_s
  name.to_s
end