Module: Hookable::ClassMethods
- Defined in:
- lib/specwrk/hookable.rb
Instance Method Summary collapse
- #on_setup(&block) ⇒ Object
- #setup(**args) ⇒ Object
- #setup_hooks ⇒ Object
- #unique_option(name, opts = {}) ⇒ Object
Instance Method Details
#on_setup(&block) ⇒ Object
46 47 48 |
# File 'lib/specwrk/hookable.rb', line 46 def on_setup(&block) setup_hooks << block end |
#setup(**args) ⇒ Object
42 43 44 |
# File 'lib/specwrk/hookable.rb', line 42 def setup(**args) setup_hooks.each { |blk| blk.call(**args) } end |
#setup_hooks ⇒ Object
50 51 52 |
# File 'lib/specwrk/hookable.rb', line 50 def setup_hooks @setup_hooks end |
#unique_option(name, opts = {}) ⇒ Object
38 39 40 |
# File 'lib/specwrk/hookable.rb', line 38 def unique_option(name, opts = {}) option(name, opts) unless .find { |existing_option| existing_option.name == name } end |