module Srvy::Formatters

Public Class Methods

format_many(format_name, result) click to toggle source
# File lib/srvy/formatters.rb, line 19
def self.format_many(format_name, result)
  from_name(format_name).format_many(result)
end
format_single(format_name, result) click to toggle source
# File lib/srvy/formatters.rb, line 15
def self.format_single(format_name, result)
  from_name(format_name).format_single(result)
end
from_name(name) click to toggle source
# File lib/srvy/formatters.rb, line 7
def self.from_name(name)
  case name.to_sym
  when :host_port ; HostPort.new
  when :dalli ;     Dalli.new
  else ;            raise ArgumentError, "Unknown formatter name: #{name}"
  end
end