Module: SerialAttr::Model::ClassMethods
- Defined in:
- lib/serial_attr/model.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#serial_attr(*args) ⇒ Object
Adds list of attributes to the serialization whitelist.
-
#skip_serial_attr(*args) ⇒ Object
Add list of attributes to the serialization blacklist and skip on serialization.
Instance Attribute Details
#serial_attr_blacklist ⇒ Object
45 46 47 |
# File 'lib/serial_attr/model.rb', line 45 def serial_attr_blacklist @serial_attr_blacklist ||= [] end |
#serial_attr_whitelist ⇒ Object
40 41 42 |
# File 'lib/serial_attr/model.rb', line 40 def serial_attr_whitelist @serial_attr_whitelist ||= [] end |
Instance Method Details
#serial_attr(*args) ⇒ Object
Adds list of attributes to the serialization whitelist
Note: Blacklist takes precedence over whitelist
61 62 63 |
# File 'lib/serial_attr/model.rb', line 61 def serial_attr(*args) self.serial_attr_whitelist |= args end |
#skip_serial_attr(*args) ⇒ Object
Add list of attributes to the serialization blacklist and skip on serialization
Note: Blacklist takes precedence over whitelist
82 83 84 |
# File 'lib/serial_attr/model.rb', line 82 def skip_serial_attr(*args) self.serial_attr_blacklist |= args end |