lib/jsonapi/formatter.rb in jsonapi-resources-0.3.3 vs lib/jsonapi/formatter.rb in jsonapi-resources-0.4.0

- old
+ new

@@ -9,11 +9,11 @@ arg end def formatter_for(format) formatter_class_name = "#{format.to_s.camelize}Formatter" - formatter_class_name.safe_constantize if formatter_class_name + formatter_class_name.safe_constantize end end end class KeyFormatter < Formatter @@ -40,15 +40,15 @@ end end class ValueFormatter < Formatter class << self - def format(raw_value, context) + def format(raw_value) super(raw_value) end - def unformat(value, context) + def unformat(value) super(value) end def value_formatter_for(type) formatter_name = "#{type.to_s.camelize}Value" @@ -85,18 +85,18 @@ end end class DefaultValueFormatter < JSONAPI::ValueFormatter class << self - def format(raw_value, context) + def format(raw_value) raw_value end end end class IdValueFormatter < JSONAPI::ValueFormatter class << self - def format(raw_value, context) + def format(raw_value) return if raw_value.nil? raw_value.to_s end end end