Class: IPis::Formatters::BaseFormatter
- Inherits:
-
Object
- Object
- IPis::Formatters::BaseFormatter
- Defined in:
- lib/ipis/formatters/base_formatter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(result) ⇒ BaseFormatter
constructor
A new instance of BaseFormatter.
Constructor Details
#initialize(result) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
8 9 10 |
# File 'lib/ipis/formatters/base_formatter.rb', line 8 def initialize(result) @result = result end |
Class Method Details
.format(result) ⇒ Object
4 5 6 |
# File 'lib/ipis/formatters/base_formatter.rb', line 4 def self.format(result) new(result).format end |
Instance Method Details
#format ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ipis/formatters/base_formatter.rb', line 12 def format parts = [] @result.each do |k,v| parts << "#{bold(k)}: #{v}" end parts.join("\n") end |