Class: Sanitize::Whitelist::Attribute
- Inherits:
-
Object
- Object
- Sanitize::Whitelist::Attribute
- Defined in:
- lib/sanitize/whitelist/attribute.rb
Instance Method Summary collapse
- #freeze ⇒ Object
-
#initialize(name) ⇒ Attribute
constructor
A new instance of Attribute.
- #protocols(protocols) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(name) ⇒ Attribute
Returns a new instance of Attribute.
2 3 4 |
# File 'lib/sanitize/whitelist/attribute.rb', line 2 def initialize(name) @name = name end |
Instance Method Details
#freeze ⇒ Object
14 15 16 17 |
# File 'lib/sanitize/whitelist/attribute.rb', line 14 def freeze super @protocols.freeze if @protocols end |
#protocols(protocols) ⇒ Object
6 7 8 |
# File 'lib/sanitize/whitelist/attribute.rb', line 6 def protocols(protocols) @protocols = Array(protocols) end |
#to_hash ⇒ Object
10 11 12 |
# File 'lib/sanitize/whitelist/attribute.rb', line 10 def to_hash @protocols ? {@name => @protocols} : {} end |