def invoke_from_option(*names, &block)
options = names.last.is_a?(Hash) ? names.pop : {}
verbose = options.fetch(:verbose, :white)
names.each do |name|
unless class_options.key?(name)
raise ArgumentError, "You have to define the option #{name.inspect} " \
"before setting invoke_from_option."
end
invocations[name] = true
invocation_blocks[name] = block if block_given?
class_eval "def _invoke_from_option_\#{name.to_s.gsub(/\\W/, '_')}\nreturn unless options[\#{name.inspect}]\n\nvalue = options[\#{name.inspect}]\nvalue = \#{name.inspect} if TrueClass === value\nklass, command = self.class.prepare_for_invocation(\#{name.inspect}, value)\n\nif klass\nsay_status :invoke, value, \#{verbose.inspect}\nblock = self.class.invocation_blocks[\#{name.inspect}]\n_invoke_for_class_method klass, command, &block\nelse\nsay_status :error, %(\\\#{value} [not found]), :red\nend\nend\n", __FILE__, __LINE__
end
end