37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/property/attribute.rb', line 37
def store_properties_in(accessor)
if accessor.nil? || accessor == self
accessor = ''
else
accessor = "#{accessor}."
end
load_and_dump_methods =" private\n def load_properties\n raw_data = \#{accessor}read_attribute('properties')\n prop = raw_data ? decode_properties(raw_data) : Properties.new\n # We need to set the owner to access property definitions and enable\n # type casting on write.\n prop.owner = self\n prop\n end\n\n def dump_properties\n if @properties && @properties.changed?\n if [email protected]?\n \#{accessor}write_attribute('properties', encode_properties(@properties))\n else\n \#{accessor}write_attribute('properties', nil)\n end\n @properties.clear_changes!\n end\n true\n end\n EOF\n class_eval(load_and_dump_methods, __FILE__, __LINE__)\nend\n"
|