Module: Thor::Hollaback::CommandExt

Defined in:
lib/thor/hollaback.rb

Overview

Extensions that get loaded into the Thor command class

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



60
61
62
# File 'lib/thor/hollaback.rb', line 60

def self.prepended(base)
  base.send(:attr_accessor, :callback_chain)
end

Instance Method Details

#run(cli, *args) ⇒ Object



64
65
66
67
68
69
70
71
72
73
# File 'lib/thor/hollaback.rb', line 64

def run(cli, *args)
  if !callback_chain ||
     (callback_chain.empty? && cli.class.class_callback_chain.empty?)

    super
  else
    combined = callback_chain + cli.class.class_callback_chain
    combined.compile { super }.call(cli)
  end
end