Class: Refinery::Pages::CustomScrubber

Inherits:
Rails::Html::PermitScrubber
  • Object
show all
Defined in:
pages/app/presenters/refinery/pages/section_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(tags, attributes) ⇒ CustomScrubber



89
90
91
92
93
# File 'pages/app/presenters/refinery/pages/section_presenter.rb', line 89

def initialize(tags, attributes)
  @direction = :bottom_up
  @tags = tags
  @attributes = attributes
end

Instance Method Details

#allowed_node?(node) ⇒ Boolean



95
96
97
# File 'pages/app/presenters/refinery/pages/section_presenter.rb', line 95

def allowed_node?(node)
  tags.include?(node.name)
end

#scrub_attribute?(name) ⇒ Boolean



103
104
105
# File 'pages/app/presenters/refinery/pages/section_presenter.rb', line 103

def scrub_attribute?(name)
  attributes.exclude?(name) && name !~ /\Adata-[\w-]+\z/
end

#skip_node?(node) ⇒ Boolean



99
100
101
# File 'pages/app/presenters/refinery/pages/section_presenter.rb', line 99

def skip_node?(node)
  node.text?
end