Class: Heroku::Nav::Header

Inherits:
Base
  • Object
show all
Defined in:
lib/heroku/nav.rb

Instance Method Summary collapse

Methods inherited from Base

api_url, #call, #can_insert?, fetch, html, #initialize, #refresh, resource, resource_url, retry_upto

Constructor Details

This class inherits a constructor from Heroku::Nav::Base

Instance Method Details

#insert!Object



86
87
88
89
90
91
92
# File 'lib/heroku/nav.rb', line 86

def insert!
  if @nav['html']
    @body.gsub!(/(<head>)/i, "\\1<link href='#{self.class.api_url}/header.css' media='all' rel='stylesheet' type='text/css' />")
    @body.gsub!(/(<body.*?>\s*(<div .*?class=["'].*?container.*?["'].*?>)?)/i, "\\1#{@nav['html']}")
    @headers['Content-Length'] = Rack::Utils.bytesize(@body).to_s
  end
end