Method: Thor::Actions#initialize

Defined in:
lib/thor-plus/actions.rb

#initialize(args = [], options = {}, config = {}) ⇒ Object

Extends initializer to add more configuration options.

Configuration

behavior<Symbol>

The actions default behavior. Can be :invoke or :revoke. It also accepts :force, :skip and :pretend to set the behavior and the respective option.

destination_root<String>

The root directory needed for some actions.



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/thor-plus/actions.rb', line 74

def initialize(args = [], options = {}, config = {})
  self.behavior = case config[:behavior].to_s
                  when "force", "skip"
                    _cleanup_options_and_set(options, config[:behavior])
                    :invoke
                  when "revoke"
                    :revoke
                  else
                    :invoke
                  end
  super
  self.destination_root = config[:destination_root]
end