Sha256: cb86f21283bcfd84cbe3bd45706daed7ac54c3aa16db912bf5031a0a62ceea3a
Contents?: true
Size: 581 Bytes
Versions: 1
Compression:
Stored size: 581 Bytes
Contents
module JsonAttributes::LegacyAttributes def attributes _json_attrs = if self.class.instance_variable_get(:@field) self.send(self.class.instance_variable_get(:@field)).try(: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.2 | lib/json_attributes/legacy_attributes.rb |