Get http user agent

How to fix this?
Middleman don’t recognize user agent or request.env[‘HTTP_USER_AGENT’]

https://gist.github.com/henriqueutsch/607128bacff2c9c9f02a2ba020eb2745

Out of curiosity, how are you planning to detect user-agent in a source code of a static site generator? Middleman produces a static HTML/CSS/JS code.