Sha256: c675e4a4a6c62b06759043d8b9a81a79d4fbcb2ebca423b6acbd019d1f8a4979
Contents?: true
Size: 569 Bytes
Versions: 1
Compression:
Stored size: 569 Bytes
Contents
module JsonAttributes::LegacyAttributes def attributes _json_attrs = if self.class.instance_variable_get(:@field) self.send(self.class.instance_variable_get(:@field)).dup else {} end.with_indifferent_access (self.class.instance_variable_get(:@json_attrs) || []).each do |_attribute| _json_attrs[_attribute] = nil unless _json_attrs.has_key?(_attribute) _json_attrs[_attribute] ||= self.send(_attribute) end super.merge(_json_attrs).with_indifferent_access.slice!(self.class.instance_variable_get(:@field)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json_attributes-0.1.1 | lib/json_attributes/legacy_attributes.rb |