class Decidim::ViewHooks::ViewHook

Internal class to encapsulate each view registered on a view hook.

Attributes

priority[R]

Public Class Methods

new(priority, block) click to toggle source

priority - a Number (Integer|Float) to sort the block. block - a block that will bbe rendered in a view context.

# File lib/decidim/view_hooks.rb, line 91
def initialize(priority, block)
  @priority = priority
  @block = block
end

Public Instance Methods

render(view_context) click to toggle source

Public: renders the block inside the view context.

view_context - a context to render the view hook.

Returns a String.

# File lib/decidim/view_hooks.rb, line 103
def render(view_context)
  @block.call(view_context)
end