Class: Buildpack::Packager::DependenciesPresenter
- Inherits:
-
Struct
- Object
- Struct
- Buildpack::Packager::DependenciesPresenter
- Includes:
- TablePresentation
- Defined in:
- lib/buildpack/packager/dependencies_presenter.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
Instance Method Summary collapse
Methods included from TablePresentation
#sanitize_version_string, #sort_string_for, #to_markdown
Instance Attribute Details
#dependencies ⇒ Object
Returns the value of attribute dependencies
5 6 7 |
# File 'lib/buildpack/packager/dependencies_presenter.rb', line 5 def dependencies @dependencies end |
Instance Method Details
#inspect ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/buildpack/packager/dependencies_presenter.rb', line 8 def inspect has_modules = dependencies.any? { |dependency| dependency['modules'] } table = Terminal::Table.new do |table| dependencies.sort_by do |dependency| sort_string_for dependency end.each do |dependency| columns = [ dependency['name'], sanitize_version_string(dependency['version']), dependency['cf_stacks'].sort.join(',') ] if has_modules columns += [dependency.fetch('modules', []).sort.join(', ')] end table.add_row columns end end table.headings = if has_modules %w(name version cf_stacks modules) else %w(name version cf_stacks) end table.to_s end |
#present ⇒ Object
36 37 38 |
# File 'lib/buildpack/packager/dependencies_presenter.rb', line 36 def present to_markdown(inspect) end |