Displaying 1 result from an estimated 1 matches for "extendedclass".
Did you mean:
extendclass
2006 Aug 15
5
Conditional extend of active record
...ot;resize" logic somewhere and avoid long winded case/if
statements.
def resize
if type == image
..resize in rmagick
elseif type == video
..send to encoder
else
..do some default resize action
end
end
It would be nice to be able to have something like this:
def resize
ExtendedClass.resize
end
where ExtendedClass represents a more specific version of the resize
function depending on the file type.
I think what I''m looking for is a mixture of extending (via
file.extend(Image) or file.extend(Video) for example), but that is
getting a bit messy to manage.
Any ideas?...