thoughtbot/paperclip — pull request #1428 by adamniedzielski (2014-01-28 20:39:21+00:00)
Title: Memoize result of identify command

Thumbnail#identified_as_animated? method makes a call to ImageMagick and it is invoked 3 times inside Thumbnail. This looks in the logs like this:

```
2014-01-28 21:30:26 [INFO ] Command :: identify -format %m '/tmp/9fdb62f932adf55af2c0e09e5586196420140128-16848-13ev7mr.jpeg[0]' (pid:16848)
2014-01-28 21:30:26 [INFO ] Command :: identify -format %m '/tmp/9fdb62f932adf55af2c0e09e5586196420140128-16848-13ev7mr.jpeg[0]' (pid:16848)
2014-01-28 21:30:26 [INFO ] Command :: identify -format %m '/tmp/9fdb62f932adf55af2c0e09e5586196420140128-16848-13ev7mr.jpeg[0]' (pid:16848)
```

Such external call means forking the whole Ruby process and I think that it should be avoided due to performance reasons. This pull request simply memoizes the value returned by the first call.