Class: Sanitize::Whitelist::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/sanitize/whitelist/attribute.rb

Instance Method Summary collapse

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

#freezeObject



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_hashObject



10
11
12
# File 'lib/sanitize/whitelist/attribute.rb', line 10

def to_hash
  @protocols ? {@name => @protocols} : {}
end