Module: Buildpack::Packager::TablePresentation
- Included in:
- DefaultVersionsPresenter, DependenciesPresenter
- Defined in:
- lib/buildpack/packager/table_presentation.rb
Instance Method Summary collapse
- #sanitize_version_string(version) ⇒ Object
- #sort_string_for(dependency) ⇒ Object
- #to_markdown(table_contents) ⇒ Object
Instance Method Details
#sanitize_version_string(version) ⇒ Object
10 11 12 |
# File 'lib/buildpack/packager/table_presentation.rb', line 10 def sanitize_version_string(version) version == 0 ? '-' : version end |
#sort_string_for(dependency) ⇒ Object
14 15 16 17 18 |
# File 'lib/buildpack/packager/table_presentation.rb', line 14 def sort_string_for(dependency) interpreter_names = %w(ruby jruby php hhvm python go node) sort_index = interpreter_names.index(dependency['name']) || 9999 sprintf '%s-%s-%s', sort_index, dependency['name'], dependency['version'] end |
#to_markdown(table_contents) ⇒ Object
6 7 8 |
# File 'lib/buildpack/packager/table_presentation.rb', line 6 def to_markdown(table_contents) table_contents.split("\n")[1...-1].tap { |lines| lines[1].tr!('+', '|') }.join("\n") end |