disposable
disposable copied to clipboard
Add :accessor for avoiding defining accessors
If we have an accessor defined before declaring a property in an included module, it will get overriden. The :accessor option allows us to specify whether we want Disposable::Twin to define accessors for that property.
module Titleable
def title
# ...
end
def title=(value)
# ...
end
end
class Song < Disposable::Twin
include Titleable
property :title, accessor: false
end
I know this is probably a fairly uncommon scenario, but I needed this in Shrine.
I realized that this is a too specific use case, I just got around it in Shrine by overriding Disposable::Twin.create_accessors.
I might have another use case for that...
Sure thing!