Module: Thor::Hollaback::ClassExt
- Defined in:
- lib/thor/hollaback.rb
Overview
Extension that get loaded into the main Thor class
Instance Method Summary collapse
- #after(execute = nil, &block) ⇒ Object
- #around(execute = nil, &block) ⇒ Object
- #before(execute = nil, &block) ⇒ Object
-
#callback_chain ⇒ Object
Methods for individual command callbacks.
- #class_after(execute = nil, &block) ⇒ Object
- #class_around(execute = nil, &block) ⇒ Object
- #class_before(execute = nil, &block) ⇒ Object
-
#class_callback_chain ⇒ Object
Methods for overall callbacks.
- #create_command(meth) ⇒ Object
Instance Method Details
#after(execute = nil, &block) ⇒ Object
37 38 39 |
# File 'lib/thor/hollaback.rb', line 37 def after(execute = nil, &block) callback_chain.after(execute, &block) end |
#around(execute = nil, &block) ⇒ Object
41 42 43 |
# File 'lib/thor/hollaback.rb', line 41 def around(execute = nil, &block) callback_chain.around(execute, &block) end |
#before(execute = nil, &block) ⇒ Object
33 34 35 |
# File 'lib/thor/hollaback.rb', line 33 def before(execute = nil, &block) callback_chain.before(execute, &block) end |
#callback_chain ⇒ Object
Methods for individual command callbacks
29 30 31 |
# File 'lib/thor/hollaback.rb', line 29 def callback_chain @callback_chain ||= ::Hollaback::Chain.new end |
#class_after(execute = nil, &block) ⇒ Object
16 17 18 |
# File 'lib/thor/hollaback.rb', line 16 def class_after(execute = nil, &block) class_callback_chain.after(execute, &block) end |
#class_around(execute = nil, &block) ⇒ Object
24 25 26 |
# File 'lib/thor/hollaback.rb', line 24 def class_around(execute = nil, &block) class_callback_chain.around(execute, &block) end |
#class_before(execute = nil, &block) ⇒ Object
20 21 22 |
# File 'lib/thor/hollaback.rb', line 20 def class_before(execute = nil, &block) class_callback_chain.before(execute, &block) end |
#class_callback_chain ⇒ Object
Methods for overall callbacks
12 13 14 |
# File 'lib/thor/hollaback.rb', line 12 def class_callback_chain @class_callback_chain ||= ::Hollaback::Chain.new end |
#create_command(meth) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/thor/hollaback.rb', line 45 def create_command(meth) super # The following condition will fail if the user attempts to add a # command without a description or something like method_missing. For # more details, see Thor::create_command. return unless commands[meth] commands[meth].callback_chain = callback_chain @callback_chain = nil end |