Class: AntiSamy::Tag
- Inherits:
-
Object
- Object
- AntiSamy::Tag
- Defined in:
- lib/antisamy/model/tag.rb
Overview
A model for HTML “tags” and the rules dictating their validation/filtration. Also contains information about their allowed attributes.
Instance Attribute Summary collapse
-
#action ⇒ Object
Name and Action fields.
-
#name ⇒ Object
Name and Action fields.
Instance Method Summary collapse
-
#<<(attribute) ⇒ Object
Add an attribute to this property.
-
#attribute(name) ⇒ Object
Fetch a property by name form this tag.
-
#attributes ⇒ Object
fetch the map of attributes.
-
#initialize(name) ⇒ Tag
constructor
Create a new Tag object.
Constructor Details
#initialize(name) ⇒ Tag
Create a new Tag object
9 10 11 12 13 |
# File 'lib/antisamy/model/tag.rb', line 9 def initialize(name) @name = name @action = action @allowed_attributes = {} end |
Instance Attribute Details
#action ⇒ Object
Name and Action fields. Actions determine what we do when we see this tag
6 7 8 |
# File 'lib/antisamy/model/tag.rb', line 6 def action @action end |
#name ⇒ Object
Name and Action fields. Actions determine what we do when we see this tag
6 7 8 |
# File 'lib/antisamy/model/tag.rb', line 6 def name @name end |
Instance Method Details
#<<(attribute) ⇒ Object
Add an attribute to this property
16 17 18 |
# File 'lib/antisamy/model/tag.rb', line 16 def <<(attribute) @allowed_attributes[attribute.name.downcase] = attribute end |
#attribute(name) ⇒ Object
Fetch a property by name form this tag
26 27 28 |
# File 'lib/antisamy/model/tag.rb', line 26 def attribute(name) @allowed_attributes[name] end |
#attributes ⇒ Object
fetch the map of attributes
21 22 23 |
# File 'lib/antisamy/model/tag.rb', line 21 def attributes @allowed_attributes end |