Class: IPis::Formatters::BaseFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ipis/formatters/base_formatter.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#formatObject



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