Class: Rack::DevMark::Theme::Tag

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

Direct Known Subclasses

Title

Instance Attribute Summary

Attributes inherited from Base

#env, #revision, #timestamp

Instance Method Summary collapse

Methods inherited from Base

#setup

Constructor Details

#initialize(options = {}) ⇒ Tag

Returns a new instance of Tag.



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

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

Instance Method Details

#insert_into(html) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rack/dev-mark/theme/tag.rb', line 12

def insert_into(html)
  name = @options[:name]

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

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

  html
end