class JSONAPI::Consumer::Formatter

Public Class Methods

format(arg) click to toggle source
# File lib/jsonapi/consumer/formatter.rb, line 6
def format(arg)
  arg.to_s
end
formatter_for(format) click to toggle source
# File lib/jsonapi/consumer/formatter.rb, line 16
def formatter_for(format)
  formatter_class_name = "JSONAPI::Consumer::#{format.to_s.camelize}Formatter"
  formatter_class_name.safe_constantize
end
unformat(arg) click to toggle source
# File lib/jsonapi/consumer/formatter.rb, line 10
def unformat(arg)
   # We call to_s() here so that unformat consistently returns a string
   # (instead of a symbol) regardless which Formatter subclass it is called on
  arg.to_s
end