class Prettys::Converter

Constants

SUPPORTED_FORMATS

Attributes

format[R]

Public Class Methods

new(format) click to toggle source
# File lib/converter.rb, line 13
def initialize(format)
  self.format = format
end

Public Instance Methods

convert(object) click to toggle source
# File lib/converter.rb, line 22
def convert(object)
  object.send(SUPPORTED_FORMATS[format])
end
format=(format) click to toggle source
# File lib/converter.rb, line 17
def format=(format)
  raise ArgumentError, "Unsupported format." unless SUPPORTED_FORMATS.include?(format)
  @format = format
end