Class: Mullet::HTML::Attributes
- Inherits:
-
Hash
- Object
- Hash
- Mullet::HTML::Attributes
- Defined in:
- lib/mullet/html/attributes.rb
Overview
Maps attribute names to values. Also renders attributes to HTML.
Instance Method Summary collapse
- #escape_quote(value) ⇒ Object
-
#render ⇒ Object
Renders attributes to HTML syntax.
Instance Method Details
#escape_quote(value) ⇒ Object
6 7 8 |
# File 'lib/mullet/html/attributes.rb', line 6 def escape_quote(value) return value.include?('"') ? value.gsub(/"/, '"') : value end |
#render ⇒ Object
Renders attributes to HTML syntax.
13 14 15 16 17 18 19 |
# File 'lib/mullet/html/attributes.rb', line 13 def render() output = '' each do |key, value| output << %( #{key}="#{escape_quote(value)}") end return output end |