Sha256: 22319625585c32db74a74ff7da3c83b3f7dc950a527a64526859250a2223de41
Contents?: true
Size: 857 Bytes
Versions: 5
Compression:
Stored size: 857 Bytes
Contents
module MetaTags # Represents an HTML meta tag with no content (<tag />). class Tag attr_reader :name, :attributes # Initializes a new instance of Tag class. # # @param [String, Symbol] name HTML tag name # @param [Hash] attributes list of HTML tag attributes # def initialize(name, attributes = {}) @name = name @attributes = attributes end # Render tag into a Rails view. # # @param [ActionView::Base] view instance of a Rails view. # @return [String] HTML string for the tag. # def render(view) view.tag(name, prepare_attributes(attributes), MetaTags.config.open_meta_tags?) end protected def prepare_attributes(attributes) attributes.each do |key, value| attributes[key] = value.iso8601 if value.respond_to?(:iso8601) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
meta-tags-2.10.0 | lib/meta_tags/tag.rb |
meta-tags-2.9.0 | lib/meta_tags/tag.rb |
meta-tags-2.8.0 | lib/meta_tags/tag.rb |
meta-tags-2.7.1 | lib/meta_tags/tag.rb |
meta-tags-2.7.0 | lib/meta_tags/tag.rb |