Class: InstalledGemFuture

Inherits:
Object
  • Object
show all
Defined in:
lib/installed_gem_future.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem) ⇒ InstalledGemFuture

Returns a new instance of InstalledGemFuture.



5
6
7
8
9
10
# File 'lib/installed_gem_future.rb', line 5

def initialize(gem)
  @gem = gem
  @name = gem.name
  @installed_version = gem.version.to_s
  @futures = Array.new
end

Instance Attribute Details

#gemObject (readonly)

Returns the value of attribute gem.



3
4
5
# File 'lib/installed_gem_future.rb', line 3

def gem
  @gem
end

#installed_versionObject (readonly)

Returns the value of attribute installed_version.



3
4
5
# File 'lib/installed_gem_future.rb', line 3

def installed_version
  @installed_version
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/installed_gem_future.rb', line 3

def name
  @name
end

Instance Method Details

#add_future_version(version) ⇒ Object



12
13
14
# File 'lib/installed_gem_future.rb', line 12

def add_future_version(version)
  @futures << version unless @futures.include? version
end

#countObject



16
17
18
# File 'lib/installed_gem_future.rb', line 16

def count
  @futures.size
end

#inspectObject



20
21
22
# File 'lib/installed_gem_future.rb', line 20

def inspect
  "#{@name} (#{@installed_version}): #{PP.pp(@futures, ' ')}" 
end

#to_htmlObject



24
25
26
# File 'lib/installed_gem_future.rb', line 24

def to_html
  "<tr><td class='gem'>#{@name}</td><td class='current-version'>#{@installed_version}</td><td class='versions-behind'>#{versions_behind}</td>#{futures_to_html}</tr>" 
end