Sha256: 3c4ecc67b3796d2861d82932553d709b1ab64f3302b76787e5ffa93d775c42f7
Contents?: true
Size: 825 Bytes
Versions: 2
Compression:
Stored size: 825 Bytes
Contents
require 'ivy/serializers/mapping' module Ivy module Serializers class Registry def initialize @mappings = Hash.new { |hash, klass| hash[klass] = new_mapping(klass) } end def attributes(generator, resource) mapping_for(resource.class).generate_attributes(generator, resource) end def map(klass, &block) mapping_for(klass).instance_eval(&block) end def relationships(generator, resource) mapping_for(resource.class).relationships(generator, resource) end def resource(generator, resource) mapping_for(resource.class).resource(generator, resource) end private def mapping_for(klass) @mappings[klass] end def new_mapping(klass) Mapping.new(klass) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ivy-serializers-0.4.0 | lib/ivy/serializers/registry.rb |
ivy-serializers-0.3.0 | lib/ivy/serializers/registry.rb |