Class: Rack::DevMark::Theme::Title

Inherits:
Base
  • Object
show all
Defined in:
lib/rack/dev-mark/theme/title.rb

Instance Attribute Summary

Attributes inherited from Base

#env, #revision

Instance Method Summary collapse

Methods inherited from Base

#setup, #stylesheet_link_tag

Constructor Details

#initialize(options = {}) ⇒ Title

Returns a new instance of Title.



7
8
9
# File 'lib/rack/dev-mark/theme/title.rb', line 7

def initialize(options = {})
  @options = options
end

Instance Method Details

#insert_into(html) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rack/dev-mark/theme/title.rb', line 11

def insert_into(html)
  s = env.to_s
  s = s.upcase if @options[:upcase]
  if @options[:type].to_s == 'postfix'
    html.sub %r{(</title[^>]*>)}i, " (#{s})\\1"
  else
    html.sub %r{(<title[^>]*>)}i, "\\1(#{s}) "
  end
end