Class: Refinery::Pages::CustomScrubber
- Inherits:
-
Rails::Html::PermitScrubber
- Object
- Rails::Html::PermitScrubber
- Refinery::Pages::CustomScrubber
- Defined in:
- pages/app/presenters/refinery/pages/section_presenter.rb
Instance Method Summary collapse
- #allowed_node?(node) ⇒ Boolean
-
#initialize(tags, attributes) ⇒ CustomScrubber
constructor
A new instance of CustomScrubber.
- #scrub_attribute?(name) ⇒ Boolean
- #skip_node?(node) ⇒ Boolean
Constructor Details
#initialize(tags, attributes) ⇒ CustomScrubber
Returns a new instance of CustomScrubber.
89 90 91 92 93 |
# File 'pages/app/presenters/refinery/pages/section_presenter.rb', line 89 def initialize(, attributes) @direction = :bottom_up @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) .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 |