Module: JSONAPI::Attributes
- Defined in:
- lib/jsonapi-serializers/attributes.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(target) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jsonapi-serializers/attributes.rb', line 3 def self.included(target) target.send(:include, InstanceMethods) target.extend ClassMethods target.class_eval do def self.inherited(target) [:attributes_map, :to_one_associations, :to_many_associations] .each{|k| key = "@#{k}" attr = self.instance_variable_get(key) target.instance_variable_set(key, attr.dup) if attr } end end end |