2017-09-27 14:35:55 +02:00
|
|
|
module RxFile
|
2015-06-15 07:21:15 +02:00
|
|
|
|
|
|
|
# Volotile module keeps track of attributes that are not menat to be written
|
|
|
|
# The idea being similar to private methods. So not every little detail is relevant
|
|
|
|
# for the object. Some attribuets may be calculated, cached etc,
|
|
|
|
#
|
|
|
|
# There is only one useful call for the user, "add" attributes for a given class
|
|
|
|
#
|
|
|
|
module Volotile
|
2015-05-03 19:16:06 +02:00
|
|
|
@@mapping = { }
|
2015-06-15 07:21:15 +02:00
|
|
|
|
2017-09-27 14:35:55 +02:00
|
|
|
# Add attributes that are then ommited from the rxf writing process
|
2015-06-15 07:21:15 +02:00
|
|
|
# The clazz is the real class object (eg String), and thus the
|
|
|
|
# adding must happen after the class definition, often at the end of the file
|
|
|
|
# attributes are an array of Symbols
|
2015-05-03 19:16:06 +02:00
|
|
|
def self.add clazz , attributes
|
|
|
|
@@mapping[clazz] = attributes
|
|
|
|
end
|
2015-06-15 07:21:15 +02:00
|
|
|
|
|
|
|
private
|
|
|
|
# return the volotile attributes as an array (or empty array)
|
|
|
|
def self.attributes clazz
|
|
|
|
@@mapping[clazz] || []
|
|
|
|
end
|
|
|
|
|
2015-05-03 19:16:06 +02:00
|
|
|
end
|
|
|
|
end
|