Class: MoreViewHooks::Hook
- Inherits:
-
Object
- Object
- MoreViewHooks::Hook
- Defined in:
- lib/more_view_hooks/hook.rb
Overview
Describes a preconfigured view hook which will be later applied by using the elegant Deface gem
Instance Attribute Summary collapse
-
#deface_options ⇒ Object
readonly
Returns the value of attribute deface_options.
Instance Method Summary collapse
- #apply! ⇒ Object
-
#initialize(hook_name, context, options) ⇒ Hook
constructor
A new instance of Hook.
Constructor Details
#initialize(hook_name, context, options) ⇒ Hook
Returns a new instance of Hook.
7 8 9 10 11 12 |
# File 'lib/more_view_hooks/hook.rb', line 7 def initialize(hook_name, context, ) @deface_options = .merge( text: "<%= call_hook(:#{hook_name}, #{context || '{}'}) %>", name: "more_view_hooks_#{hook_name}" ) end |
Instance Attribute Details
#deface_options ⇒ Object (readonly)
Returns the value of attribute deface_options.
5 6 7 |
# File 'lib/more_view_hooks/hook.rb', line 5 def @deface_options end |
Instance Method Details
#apply! ⇒ Object
14 15 16 |
# File 'lib/more_view_hooks/hook.rb', line 14 def apply! Deface::Override.new() end |