consider the following example
module DataMapper
class Property
class CustomType < DataMapper::Property::Text
def load(value)
# do stuff and return formatted value
end
end
end
end
Class A
property :name, String
property :value, CustomType
end
now when I do A.first
or A.first.value
the load
method gets executed, but the calculations that I need to do inside load
is dependent on that instance's name
property. So how do I get the context of this instance/resource(as referred inside source code) inside the load method ?
Please let me know if the question is not clear yet !