Class: JSONAPI::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/formatter.rb

Direct Known Subclasses

KeyFormatter, RouteFormatter, ValueFormatter

Class Method Summary collapse

Class Method Details

.format(arg) ⇒ Object



4
5
6
# File 'lib/jsonapi/formatter.rb', line 4

def format(arg)
  arg.to_s
end

.formatter_for(format) ⇒ Object



12
13
14
15
# File 'lib/jsonapi/formatter.rb', line 12

def formatter_for(format)
  formatter_class_name = "#{format.to_s.camelize}Formatter"
  formatter_class_name.safe_constantize
end

.unformat(arg) ⇒ Object



8
9
10
# File 'lib/jsonapi/formatter.rb', line 8

def unformat(arg)
  arg
end