{"comment":{"url":"https://api.github.com/repos/alphagov/whitehall/comments/10033329","html_url":"https://github.com/alphagov/whitehall/commit/f0fd6efc69868b63acd99381ec68e1c0fe8c92d9#commitcomment-10033329","id":10033329,"user":{"login":"heathd","id":61065,"avatar_url":"https://avatars.githubusercontent.com/u/61065?v=3","gravatar_id":"","url":"https://api.github.com/users/heathd","html_url":"https://github.com/heathd","followers_url":"https://api.github.com/users/heathd/followers","following_url":"https://api.github.com/users/heathd/following{/other_user}","gists_url":"https://api.github.com/users/heathd/gists{/gist_id}","starred_url":"https://api.github.com/users/heathd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heathd/subscriptions","organizations_url":"https://api.github.com/users/heathd/orgs","repos_url":"https://api.github.com/users/heathd/repos","events_url":"https://api.github.com/users/heathd/events{/privacy}","received_events_url":"https://api.github.com/users/heathd/received_events","type":"User","site_admin":false},"position":32,"line":135,"path":"app/helpers/govspeak_helper.rb","commit_id":"f0fd6efc69868b63acd99381ec68e1c0fe8c92d9","created_at":"2015-03-04T16:35:21Z","updated_at":"2015-03-04T16:35:21Z","body":"I was wondering if it might be possible to move this into `Govspeak::ContactsExtractor` as well? e.g.\r\n\r\n```ruby\r\n\r\nclass ContactsExtractor\r\n  def replace_contacts(&block)\r\n    govspeak.gsub(EMBEDDED_CONTACT_REGEXP) do\r\n      yield $1\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nthat way the contact regexp is entirely contained within the extractor. \r\n\r\nIt might require some jigging around to ensure that you can call `#render` on the correct object (ie. `self` needs to point to the correct thing in the block passed in).\r\n\r\nif you don't see an obvious way to make this work, don't worry too much!"}}