Class: Dicey::CLI::Formatters::BaseListFormatter Abstract Private
- Inherits:
-
Object
- Object
- Dicey::CLI::Formatters::BaseListFormatter
- Includes:
- Mixins::RationalToInteger
- Defined in:
- lib/dicey/cli/formatters/base_list_formatter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This class is abstract.
Base formatter for outputting lists of key-value pairs separated by newlines. Can add an optional description into the result.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#call(hash, description = nil) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 |
# File 'lib/dicey/cli/formatters/base_list_formatter.rb', line 17 def call(hash, description = nil) initial_string = description ? "# #{description}\n" : +"" hash.each_with_object(initial_string) do |(key, value), output| output << line(transform(key, value)) << "\n" end end |