module Aepic::Concerns::Serializer::ClassMethods
Public Instance Methods
jsonld()
click to toggle source
# File lib/aepic/concerns/serializer.rb, line 35 def jsonld {'@context' => {xsd: 'http://www.w3.org/2001/XMLSchema#'}.merge(jsonld_context)} end
jsonld_context()
click to toggle source
# File lib/aepic/concerns/serializer.rb, line 17 def jsonld_context {}.tap do |context| schema[:attributes].each do |name, type| context[name] = XSD_TYPES[type] end schema[:associations].each do |name, type| class_name = name.to_s if class_name =~ /_ids?\Z/ context[name] = 'xsd:integer' else class_name = name.to_s.classify associated_class = "#{class_name}Decorator".constantize context[name] = associated_class.jsonld_context end end end end