Class: PackagePresenter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ PackagePresenter

Returns a new instance of PackagePresenter.



28
29
30
# File 'lib/cmd/inspect.rb', line 28

def initialize obj
  @pkg = obj
end

Instance Attribute Details

#pkgObject

Returns the value of attribute pkg.



26
27
28
# File 'lib/cmd/inspect.rb', line 26

def pkg
  @pkg
end

Instance Method Details

#flavorsObject



40
41
42
# File 'lib/cmd/inspect.rb', line 40

def flavors
  flavors_as_string.empty? ? "nil" : flavors_as_string
end

#flavors_as_stringObject



44
45
46
47
48
# File 'lib/cmd/inspect.rb', line 44

def flavors_as_string
  if @pkg.facts.flavors
    return @pkg.facts.flavors.join ", "
  end
end

#homepageObject



54
55
56
# File 'lib/cmd/inspect.rb', line 54

def homepage
  @pkg.facts.homepage or 'n/a'
end

#is_active?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/cmd/inspect.rb', line 36

def is_active?
  pkg.is_active?
end

#manifestObject



62
63
64
# File 'lib/cmd/inspect.rb', line 62

def manifest
  @pkg.facts.facts_file
end

#nameObject



32
33
34
# File 'lib/cmd/inspect.rb', line 32

def name
  @pkg.name
end

#upgradeable?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/cmd/inspect.rb', line 58

def upgradeable?
  @pkg.is_git_repo?
end

#versionObject



50
51
52
# File 'lib/cmd/inspect.rb', line 50

def version
  @pkg.facts.version or 'n/a'
end