Class: MetaTags::Tag
- Defined in:
- lib/meta_tags/tag.rb,
sig/lib/meta_tags/tag.rbs
Overview
Represents an HTML meta tag with no content (
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Hash[String | Symbol, untyped]
readonly
Returns the value of attribute attributes.
-
#name ⇒ String
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, attributes = {}) ⇒ Tag
constructor
Initializes a new instance of Tag class.
- #prepare_attributes(attributes) ⇒ Hash[String | Symbol, untyped]
-
#render(view) ⇒ String
Render tag into a Rails view.
Constructor Details
#initialize(name, attributes = {}) ⇒ Tag
Initializes a new instance of Tag class.
13 14 15 16 |
# File 'lib/meta_tags/tag.rb', line 13 def initialize(name, attributes = {}) @name = name.to_s @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Hash[String | Symbol, untyped] (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/meta_tags/tag.rb', line 6 def attributes @attributes end |
#name ⇒ String (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/meta_tags/tag.rb', line 6 def name @name end |
Instance Method Details
#prepare_attributes(attributes) ⇒ Hash[String | Symbol, untyped]
29 30 31 32 33 |
# File 'lib/meta_tags/tag.rb', line 29 def prepare_attributes(attributes) attributes.each do |key, value| attributes[key] = value.iso8601 if value.respond_to?(:iso8601) end end |