lib/rack/dev-mark/theme/title.rb in rack-dev-mark-0.2.0 vs lib/rack/dev-mark/theme/title.rb in rack-dev-mark-0.3.0

- old
+ new

@@ -1,10 +1,20 @@ module Rack module DevMark module Theme - class Title - def insert_into(html, env, revision) - html.sub %r{(<title[^>]*>)}i, "\\1(#{env}) " + class Title < Base + def initialize(options = {}) + @options = options + end + + 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 end end end end