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

.cachedObject



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

def cached
  return FormatterWrapperCache.new(self)
end

.format(arg) ⇒ Object



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

def format(arg)
  arg.to_s
end

.formatter_for(format) ⇒ Object



20
21
22
# File 'lib/jsonapi/formatter.rb', line 20

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

.uncachedObject



16
17
18
# File 'lib/jsonapi/formatter.rb', line 16

def uncached
  return self
end

.unformat(arg) ⇒ Object



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

def unformat(arg)
  arg
end