Class: Blocks::HookDefinition
- Inherits:
-
HashWithRenderStrategy
- Object
- Hash
- HashWithRenderStrategy
- Blocks::HookDefinition
- Defined in:
- lib/blocks/builders/hook_definition.rb
Constant Summary collapse
- BEFORE_ALL =
:before_all
- AROUND_ALL =
:around_all
- BEFORE =
:before
- AROUND =
:around
- SURROUND =
:surround
- PREPEND =
:prepend
- APPEND =
:append
- AFTER =
:after
- AFTER_ALL =
:after_all
- HOOKS =
[BEFORE_ALL, BEFORE, PREPEND, AROUND_ALL, AROUND, SURROUND, APPEND, AFTER, AFTER_ALL]
Constants inherited from HashWithRenderStrategy
Blocks::HashWithRenderStrategy::RENDERING_STRATEGIES, Blocks::HashWithRenderStrategy::RENDER_WITH_BLOCK, Blocks::HashWithRenderStrategy::RENDER_WITH_PARTIAL, Blocks::HashWithRenderStrategy::RENDER_WITH_PROXY
Instance Attribute Summary collapse
-
#block_definition ⇒ Object
Returns the value of attribute block_definition.
-
#block_to_render ⇒ Object
Returns the value of attribute block_to_render.
-
#hook_type ⇒ Object
Returns the value of attribute hook_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#runtime_block ⇒ Object
Returns the value of attribute runtime_block.
Attributes inherited from HashWithRenderStrategy
Instance Method Summary collapse
-
#initialize(block_definition, hook_type, options, &block) ⇒ HookDefinition
constructor
A new instance of HookDefinition.
Methods inherited from HashWithRenderStrategy
#except, #extractable_options?, #nested_under_indifferent_access, #render_strategy_and_item, #render_strategy_item, #renders_with_proxy?, #reverse_merge!, #slice, #to_hash, #to_s
Constructor Details
#initialize(block_definition, hook_type, options, &block) ⇒ HookDefinition
Returns a new instance of HookDefinition.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/blocks/builders/hook_definition.rb', line 21 def initialize(block_definition, hook_type, , &block) self.block_definition = block_definition self.hook_type = hook_type super &nil reverse_merge! self.block_to_render = self.delete(:render) || self[RENDER_WITH_PROXY] self.name = "#{block_to_render.to_s + ' block ' if block_to_render}#{hook_type} #{block_definition.name} options" # name = self[:render] || "#{hook_type} #{block_definition.name} options" # super name, *args, &block if block if render_strategy self.runtime_block = block else reverse_merge! block: block end end end |
Instance Attribute Details
#block_definition ⇒ Object
Returns the value of attribute block_definition.
19 20 21 |
# File 'lib/blocks/builders/hook_definition.rb', line 19 def block_definition @block_definition end |
#block_to_render ⇒ Object
Returns the value of attribute block_to_render.
19 20 21 |
# File 'lib/blocks/builders/hook_definition.rb', line 19 def block_to_render @block_to_render end |
#hook_type ⇒ Object
Returns the value of attribute hook_type.
19 20 21 |
# File 'lib/blocks/builders/hook_definition.rb', line 19 def hook_type @hook_type end |
#name ⇒ Object
Returns the value of attribute name.
19 20 21 |
# File 'lib/blocks/builders/hook_definition.rb', line 19 def name @name end |
#runtime_block ⇒ Object
Returns the value of attribute runtime_block.
19 20 21 |
# File 'lib/blocks/builders/hook_definition.rb', line 19 def runtime_block @runtime_block end |