Class: Trenni::Sanitize::Filter::Node
- Inherits:
-
Struct
- Object
- Struct
- Trenni::Sanitize::Filter::Node
- Defined in:
- lib/trenni/sanitize/filter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #accept!(mode = ALL) ⇒ Object
- #limit_attributes(keys) ⇒ Object
- #skip!(mode = ALL) ⇒ Object
- #skip?(mode = ALL) ⇒ Boolean
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
53 54 55 |
# File 'lib/trenni/sanitize/filter.rb', line 53 def name @name end |
#skip ⇒ Object
Returns the value of attribute skip
53 54 55 |
# File 'lib/trenni/sanitize/filter.rb', line 53 def skip @skip end |
#tag ⇒ Object
Returns the value of attribute tag
53 54 55 |
# File 'lib/trenni/sanitize/filter.rb', line 53 def tag @tag end |
Instance Method Details
#[](key) ⇒ Object
66 67 68 |
# File 'lib/trenni/sanitize/filter.rb', line 66 def [] key self.tag&.attributes[key] end |
#accept!(mode = ALL) ⇒ Object
62 63 64 |
# File 'lib/trenni/sanitize/filter.rb', line 62 def accept!(mode = ALL) self.skip &= ~mode end |
#limit_attributes(keys) ⇒ Object
70 71 72 |
# File 'lib/trenni/sanitize/filter.rb', line 70 def limit_attributes(keys) self.tag&.attributes&.select!{|key, value| keys.include?(key)} end |
#skip!(mode = ALL) ⇒ Object
54 55 56 |
# File 'lib/trenni/sanitize/filter.rb', line 54 def skip!(mode = ALL) self.skip |= mode end |
#skip?(mode = ALL) ⇒ Boolean
58 59 60 |
# File 'lib/trenni/sanitize/filter.rb', line 58 def skip?(mode = ALL) (self.skip & mode) == mode end |