Class: Trenni::Sanitize::Filter::Node

Inherits:
Struct
  • Object
show all
Defined in:
lib/trenni/sanitize/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



53
54
55
# File 'lib/trenni/sanitize/filter.rb', line 53

def name
  @name
end

#skipObject

Returns the value of attribute skip

Returns:

  • (Object)

    the current value of skip



53
54
55
# File 'lib/trenni/sanitize/filter.rb', line 53

def skip
  @skip
end

#tagObject

Returns the value of attribute tag

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Boolean)


58
59
60
# File 'lib/trenni/sanitize/filter.rb', line 58

def skip?(mode = ALL)
	(self.skip & mode) == mode
end