module SerialAttr::Model::ClassMethods
Attributes
serial_attr_blacklist[W]
serial_attr_whitelist[W]
Public Instance Methods
serial_attr(*args)
click to toggle source
Adds list of attributes to the serialization whitelist
Note: Blacklist takes precedence over whitelist
@example add a list of attributes
class Person include SerialAttr::Model serial_attr :name, :address, :phone_number end
@param [Symbol, Array] args list of attributes to add
# File lib/serial_attr/model.rb, line 61 def serial_attr(*args) self.serial_attr_whitelist |= args end
serial_attr_blacklist()
click to toggle source
# File lib/serial_attr/model.rb, line 45 def serial_attr_blacklist @serial_attr_blacklist ||= [] end
serial_attr_whitelist()
click to toggle source
# File lib/serial_attr/model.rb, line 40 def serial_attr_whitelist @serial_attr_whitelist ||= [] end
skip_serial_attr(*args)
click to toggle source
Add list of attributes to the serialization blacklist and skip on serialization
Note: Blacklist takes precedence over whitelist
@example skip a list of attributes
class Person include ActiveAttr::Model include SerialAttr::Model attribute :name attribute :address attribute :phone_number skip_serial_attr :phone_number end
@param [Symbol, Array] args list of attributes to skip in serialization
# File lib/serial_attr/model.rb, line 82 def skip_serial_attr(*args) self.serial_attr_blacklist |= args end