class Rack::DevMark::Theme::Tag

Public Instance Methods

insert_into(html, env, params = {}) click to toggle source
# File lib/rack/dev-mark/theme/tag.rb, line 7
def insert_into(html, env, params = {})
  name = @options[:name]

  if name
    html = gsub_tag_content html, name do |value|
      env_with_value(env, value)
    end
  end

  if attribute = @options[:attribute]
    Array(attribute).each do |attr|
      html = gsub_tag_attribute html, name, attr do |value|
        env_with_value(env, value)
      end
    end
  end

  html
end

Private Instance Methods

env_with_value(env, org) click to toggle source
# File lib/rack/dev-mark/theme/tag.rb, line 29
def env_with_value(env, org)
  s = env.to_s
  s = s.upcase if @options[:upcase]

  if @options[:type].to_s == 'postfix'
    "#{org} (#{s})"
  else
    "(#{s}) #{org}"
  end
end