Method: Thor::Base#initialize
- Defined in:
- lib/wip/vendor/thor/base.rb
#initialize(args = [], options = {}, config = {}) ⇒ Object
It receives arguments in an Array and two hashes, one for options and other for configuration.
Notice that it does not check if all required arguments were supplied. It should be done by the parser.
Parameters
- args<Array>
-
An array of objects. The objects are applied to their respective accessors declared with
argument
. - options<Hash>
-
An options hash that will be available as self.options. The hash given is converted to a hash with indifferent access, magic predicates (options.skip?) and then frozen.
- config<Hash>
-
Configuration for this Thor class.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/wip/vendor/thor/base.rb', line 40 def initialize(args=[], ={}, config={}) args = Thor::Arguments.parse(self.class.arguments, args) args.each { |key, value| send("#{key}=", value) } = self.class. if .is_a?(Array) = config.delete(:task_options) # hook for start = .merge() if , = , {} else , = [], end opts = Thor::Options.new(, ) self. = opts.parse() opts.check_unknown! if self.class.(config) end |